Re: [PATCH 1/5] ftrace: use module notifier for function tracer

From: Tim Abbott
Date: Tue Apr 21 2009 - 14:49:09 EST


On Tue, 21 Apr 2009, Steven Rostedt wrote:

> > However, Ksplice does its run-pre matching checks outside stop_machine,
>
> Does Ksplice use break points to do the modification?

No, we use jump instructions.

> I'd be interested in knowing how Ksplice protects against the nastiness
> of code executing on one CPU that is being modified by another CPU.

The run-pre matching checks, which verify that the pre-patch code the user
gave Ksplice matches the running kernel, occur before stop_machine with
the module_mutex held. Then, inside stop_machine, we check that no thread
is in the process of executing a to-be-patched function before inserting
the jump instructions. We need the transition from the old code to the
new code to be atomic (i.e. no old code can run after any new code is
run). So, we need to check all the return addresses on each thread's
kernel stack as well as the instruction pointers.

-Tim Abbott
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/