Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ftrace: Revert 8ab2b7efd ftrace: Remove unnecessary disabling of irqs

Revert the commit that removed the disabling of interrupts around
the initial modifying of mcount callers to nops, and update the comment.

The original comment was outdated and stated that the interrupts were
being disabled to prevent kstop machine, which was required with the
old ftrace daemon, but was no longer the case.

What the comment failed to mention was that interrupts needed to be
disabled to keep interrupts from preempting the modifying of the code
and then executing the code that was partially modified.

Revert the commit and update the comment.

Reported-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Steven Rostedt and committed by
Steven Rostedt
a4f18ed1 265a5b7e

+7
+7
kernel/trace/ftrace.c
··· 3330 3330 { 3331 3331 unsigned long *p; 3332 3332 unsigned long addr; 3333 + unsigned long flags; 3333 3334 3334 3335 mutex_lock(&ftrace_lock); 3335 3336 p = start; ··· 3347 3346 ftrace_record_ip(addr); 3348 3347 } 3349 3348 3349 + /* 3350 + * Disable interrupts to prevent interrupts from executing 3351 + * code that is being modified. 3352 + */ 3353 + local_irq_save(flags); 3350 3354 ftrace_update_code(mod); 3355 + local_irq_restore(flags); 3351 3356 mutex_unlock(&ftrace_lock); 3352 3357 3353 3358 return 0;