user_events: Add trace event call as root for low permission cases
authorBeau Belgrave <beaub@linux.microsoft.com>
Tue, 8 Mar 2022 22:28:07 +0000 (14:28 -0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 15 Mar 2022 18:33:20 +0000 (14:33 -0400)
commit089331d47325d3f55016ed3d1f79ffd2754fb19e
treebe7460b7e6171017a3a0806cf0d46510d33f0e3f
parentbc47ee4844d6b7d7351536cd99d35848c4449689
user_events: Add trace event call as root for low permission cases

Tracefs by default is locked down heavily. System operators can open up
some files, such as user_events to a broader set of users. These users
do not have access within tracefs beyond just the user_event files. Due
to this restriction the trace_add_event_call/remove calls will silently
fail since the caller does not have permissions to create directories.

To fix this trace_add_event_call/remove calls will be issued with
override creds of the global root UID. Creds are reverted immediately
afterward.

Link: https://lkml.kernel.org/r/20220308222807.2040-1-beaub@linux.microsoft.com
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_events_user.c