summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2018-11-05 18:00:43 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 09:19:49 +0100
commitdee3f77032077225a2346ffd142091c7c41fe939 (patch)
tree6d7eee851c29926feff52bd297266cd550063ecc /security
parent67547b9b46602759a4d29ee6d8655837a94e5b68 (diff)
downloadlinux-stable-dee3f77032077225a2346ffd142091c7c41fe939.tar.gz
linux-stable-dee3f77032077225a2346ffd142091c7c41fe939.tar.bz2
linux-stable-dee3f77032077225a2346ffd142091c7c41fe939.zip
tracing: Lock event_mutex before synth_event_mutex
[ Upstream commit fc800a10be26017f8f338bc8e500d48e3e6429d9 ] synthetic event is using synth_event_mutex for protecting synth_event_list, and event_trigger_write() path acquires locks as below order. event_trigger_write(event_mutex) ->trigger_process_regex(trigger_cmd_mutex) ->event_hist_trigger_func(synth_event_mutex) On the other hand, synthetic event creation and deletion paths call trace_add_event_call() and trace_remove_event_call() which acquires event_mutex. In that case, if we keep the synth_event_mutex locked while registering/unregistering synthetic events, its dependency will be inversed. To avoid this issue, current synthetic event is using a 2 phase process to create/delete events. For example, it searches existing events under synth_event_mutex to check for event-name conflicts, and unlocks synth_event_mutex, then registers a new event under event_mutex locked. Finally, it locks synth_event_mutex and tries to add the new event to the list. But it can introduce complexity and a chance for name conflicts. To solve this simpler, this introduces trace_add_event_call_nolock() and trace_remove_event_call_nolock() which don't acquire event_mutex inside. synthetic event can lock event_mutex before synth_event_mutex to solve the lock dependency issue simpler. Link: http://lkml.kernel.org/r/154140844377.17322.13781091165954002713.stgit@devbox Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions