Skip to content

Commit bf24daa

Browse files
masami256rostedt
authored andcommitted
tracing: Do not set trace clock if tracefs lockdown is in effect
When trace_clock option is not set and unstable clcok detected, tracing_set_default_clock() sets trace_clock(ThinkPad A285 is one of case). In that case, if lockdown is in effect, null pointer dereference error happens in ring_buffer_set_clock(). Link: http://lkml.kernel.org/r/[email protected] Cc: [email protected] Fixes: 17911ff ("tracing: Add locked_down checks to the open calls of files created for tracefs") Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1788488 Signed-off-by: Masami Ichikawa <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 8bcebc7 commit bf24daa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/trace/trace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9420,6 +9420,11 @@ __init static int tracing_set_default_clock(void)
94209420
{
94219421
/* sched_clock_stable() is determined in late_initcall */
94229422
if (!trace_boot_clock && !sched_clock_stable()) {
9423+
if (security_locked_down(LOCKDOWN_TRACEFS)) {
9424+
pr_warn("Can not set tracing clock due to lockdown\n");
9425+
return -EPERM;
9426+
}
9427+
94239428
printk(KERN_WARNING
94249429
"Unstable clock detected, switching default tracing clock to \"global\"\n"
94259430
"If you want to keep using the local clock, then add:\n"

0 commit comments

Comments
 (0)