]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
tracing: Fix race where histograms can be called before the event
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 23 Nov 2022 21:43:23 +0000 (16:43 -0500)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 13:02:51 +0000 (14:02 +0100)
commit5dfce5870e27dc9fce977cd9a219d991a6cef075
tree1e27b4a19425440abc7139a46ec1abff72e70da8
parent15d01099115f726020cb6c8519006d21b0aa02d3
tracing: Fix race where histograms can be called before the event

commit ef38c79a522b660f7f71d45dad2d6244bc741841 upstream.

commit 94eedf3dded5 ("tracing: Fix race where eprobes can be called before
the event") fixed an issue where if an event is soft disabled, and the
trigger is being added, there's a small window where the event sees that
there's a trigger but does not see that it requires reading the event yet,
and then calls the trigger with the record == NULL.

This could be solved with adding memory barriers in the hot path, or to
make sure that all the triggers requiring a record check for NULL. The
latter was chosen.

Commit 94eedf3dded5 set the eprobe trigger handle to check for NULL, but
the same needs to be done with histograms.

Link: https://lore.kernel.org/linux-trace-kernel/20221118211809.701d40c0f8a757b0df3c025a@kernel.org/
Link: https://lore.kernel.org/linux-trace-kernel/20221123164323.03450c3a@gandalf.local.home
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 7491e2c442781 ("tracing: Add a probe that attaches to trace events")
Reported-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 52fc245d150c260c978f3a352951c792a22cab40)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
kernel/trace/trace_events_hist.c