]> git.baikalelectronics.ru Git - kernel.git/commit
tracepoint: Fix race between tracing and removing tracepoint
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Tue, 2 Feb 2021 07:23:26 +0000 (18:23 +1100)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 2 Feb 2021 14:32:02 +0000 (09:32 -0500)
commitc3966d0f36d7985ec488d2151f373189e408e55d
tree80a96646eed83f2690c2d8ac596b04d009b69ace
parent771f81c8bc89311ce151e52e5cbcfa7e733e1f54
tracepoint: Fix race between tracing and removing tracepoint

When executing a tracepoint, the tracepoint's func is dereferenced twice -
in __DO_TRACE() (where the returned pointer is checked) and later on in
__traceiter_##_name where the returned pointer is dereferenced without
checking which leads to races against tracepoint_removal_sync() and
crashes.

This adds a check before referencing the pointer in tracepoint_ptr_deref.

Link: https://lkml.kernel.org/r/20210202072326.120557-1-aik@ozlabs.ru
Cc: stable@vger.kernel.org
Fixes: e2c8be132a808 ("tracepoint: Optimize using static_call()")
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/linux/tracepoint.h