diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2020-10-01 21:27:57 -0400 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-10-02 21:18:25 +0200 |
commit | 547305a64632813286700cb6d768bfe773df7d19 (patch) | |
tree | 5794b5f95a015645070022512939a324b8a84100 /tools | |
parent | de394e7568ce2cdb4643ed230169f484f25f9442 (diff) | |
download | linux-stable-547305a64632813286700cb6d768bfe773df7d19.tar.gz linux-stable-547305a64632813286700cb6d768bfe773df7d19.tar.bz2 linux-stable-547305a64632813286700cb6d768bfe773df7d19.zip |
tracepoint: Fix out of sync data passing by static caller
Naresh reported a bug that appears to be a side effect of the static
calls. It happens when going from more than one tracepoint callback to
a single one, and removing the first callback on the list. The list of
tracepoint callbacks holds data and a function to call with the
parameters of that tracepoint and a handler to the associated data.
old_list:
0: func = foo; data = NULL;
1: func = bar; data = &bar_struct;
new_list:
0: func = bar; data = &bar_struct;
CPU 0 CPU 1
----- -----
tp_funcs = old_list;
tp_static_caller = tp_interator
__DO_TRACE()
data = tp_funcs[0].data = NULL;
tp_funcs = new_list;
tracepoint_update_call()
tp_static_caller = tp_funcs[0] = bar;
tp_static_caller(data)
bar(data)
x = data->item = NULL->item
BOOM!
To solve this, add a tracepoint_synchronize_unregister() between
changing tp_funcs and updating the static tracepoint, that does both a
synchronize_rcu() and synchronize_srcu(). This will ensure that when
the static call is updated to the single callback that it will be
receiving the data that it registered with.
Fixes: d25e37d89dd2f ("tracepoint: Optimize using static_call()")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/linux-next/CA+G9fYvPXVRO0NV7yL=FxCmFEMYkCwdz7R=9W+_votpT824YJA@mail.gmail.com
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions