Messages in this thread Patch in this message | | | From | Mathieu Desnoyers <> | Subject | [RFC PATCH 1/9] tracepoint: call vmalloc_sync_mappings() on registration | Date | Thu, 9 Apr 2020 15:35:35 -0400 |
| |
Similarly to register_die_notifier(), tracepoints register callbacks which can be invoked from execution contexts such as the page fault handler and NMIs which should not generate a page fault. Those callbacks can access virtual mappings and can be implemented in modules.
Calling vmalloc_sync_mappings() before registering a tracepoint callback ensures that the virtual mappings are synchronized within each process page tables, thus ensuring that no page fault will be triggered by the callback.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> --- kernel/tracepoint.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 73956eaff8a9..82191a89c72e 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -14,6 +14,7 @@ #include <linux/sched/signal.h> #include <linux/sched/task.h> #include <linux/static_key.h> +#include <linux/vmalloc.h> extern tracepoint_ptr_t __start___tracepoints_ptrs[]; extern tracepoint_ptr_t __stop___tracepoints_ptrs[]; @@ -308,6 +309,7 @@ int tracepoint_probe_register_prio(struct tracepoint *tp, void *probe, struct tracepoint_func tp_func; int ret; + vmalloc_sync_mappings(); mutex_lock(&tracepoints_mutex); tp_func.func = probe; tp_func.data = data; -- 2.17.1
| |