Skip to contentSkip to conversation

Question about -rc and stable patches

DISCUSSION Steven Rostedt 1 participant 3 messages Mar 3, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Hi Linus and Greg,

Recently I have been sent patches that fix a bug in the enabling of ftrace function tracer, where if something goes wrong with the enabling (or disabling), it can cause a crash of the computer.

Now, my question is, the bug requires something to go wrong at a point where I've never seen it go wrong before. But if you inject a problem (code that makes it fail on the 1000th iteration), sure enough, the recovery is not correct and the machine crashes.

Is this fix something that I should push to -rc as well as to stable? Or should I just add this to my 3.15 queue, as I have never heard of someone triggering it. The only report is from someone that was testing the failure cases.

Thanks,

-- Steve

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#2 lore raw
Quoted 7 lines · On Mon, 3 Mar 2014 14:41:04 -0800 Greg Kroah-Hartman…
Quoted 6 lines · Steven Rostedt

Hi Linus and Greg,

Recently I have been sent patches that fix a bug in the enabling of ftrace function tracer, where if something goes wrong with the enabling (or disabling), it can cause a crash of the computer.

Quoted 7 lines
Quoted 4 lines

Now, my question is, the bug requires something to go wrong at a point where I've never seen it go wrong before. But if you inject a problem (code that makes it fail on the 1000th iteration), sure enough, the recovery is not correct and the machine crashes.

What exactly do you mean by "inject a problem"? What kind of permissions does that require to do?

Modify kernel source ;-) Basically, I added this patch to the kernel, compiled it, enabled function tracing, and it crashed:

arch/x86/kernel/ftrace.c +3 -0
index 8cabf63..9f354e5 100644
@@ -586,6 +586,9 @@ void ftrace_replace_code(int enable)
 	for_ftrace_rec_iter(iter) {
 		rec = ftrace_rec_iter_record(iter);
 
+		if (count == 1000)
+			ret = -EPERM;
+		else
 		ret = add_breakpoints(rec, enable);
 		if (ret)
 			goto remove_breakpoints;

Not something that can be done from normal operations.

-- Steve

author maintainer
#3 lore raw
Quoted 16 lines · On Mon, 3 Mar 2014 17:45:32 -0500 Steven Rostedt <[email protected]> wrote:
arch/x86/kernel/ftrace.c +3 -0
index 8cabf63..9f354e5 100644
@@ -586,6 +586,9 @@ void ftrace_replace_code(int enable)
 	for_ftrace_rec_iter(iter) {
 		rec = ftrace_rec_iter_record(iter);
 
+		if (count == 1000)
+			ret = -EPERM;
+		else
 		ret = add_breakpoints(rec, enable);
 		if (ret)
 			goto remove_breakpoints;
Quoted 2 lines

Not something that can be done from normal operations.

I'll also add that one reason that this hasn't been an issue before, is that the code that converts calls to mcount to nops, is done at kernel boot up. If the above code were to fail, it is highly likely that the code that converted mcount to nops would fail too. And if that happens, it completely disables function tracing, preventing this code from running.

The code that converts mcount to nops, handles the above error properly.

-- Steve