public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@vger.kernel.org, Masami Ichikawa <masami256@gmail.com>
Subject: [for-linus][PATCH 5/5] tracing: Do not set trace clock if tracefs lockdown is in effect
Date: Tue, 21 Jan 2020 09:38:52 -0500	[thread overview]
Message-ID: <20200121143957.062447110@goodmis.org> (raw)
In-Reply-To: 20200121143847.609307852@goodmis.org

From: Masami Ichikawa <masami256@gmail.com>

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/20200116131236.3866925-1-masami256@gmail.com

Cc: stable@vger.kernel.org
Fixes: 17911ff38aa58 ("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 <masami256@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ddb7e7f5fe8d..5b6ee4aadc26 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -9420,6 +9420,11 @@ __init static int tracing_set_default_clock(void)
 {
 	/* sched_clock_stable() is determined in late_initcall */
 	if (!trace_boot_clock && !sched_clock_stable()) {
+		if (security_locked_down(LOCKDOWN_TRACEFS)) {
+			pr_warn("Can not set tracing clock due to lockdown\n");
+			return -EPERM;
+		}
+
 		printk(KERN_WARNING
 		       "Unstable clock detected, switching default tracing clock to \"global\"\n"
 		       "If you want to keep using the local clock, then add:\n"
-- 
2.24.1



      parent reply	other threads:[~2020-01-21 14:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 14:38 [for-linus][PATCH 0/5] tracing: Fixes for 5.5 Steven Rostedt
2020-01-21 14:38 ` [for-linus][PATCH 1/5] tracing: xen: Ordered comparison of function pointers Steven Rostedt
2020-01-21 14:38 ` [for-linus][PATCH 2/5] tracing/uprobe: Fix double perf_event linking on multiprobe uprobe Steven Rostedt
2020-01-21 14:50   ` Peter Zijlstra
2020-01-21 14:59     ` David Laight
2020-01-21 15:06       ` Peter Zijlstra
2020-01-22 22:12         ` Masami Hiramatsu
2020-01-21 14:38 ` [for-linus][PATCH 3/5] tracing: trigger: Replace unneeded RCU-list traversals Steven Rostedt
     [not found]   ` <20200122022623.20D812465A@mail.kernel.org>
2020-01-22  3:32     ` Masami Hiramatsu
2020-01-21 14:38 ` [for-linus][PATCH 4/5] tracing: Fix histogram code when expression has same var as value Steven Rostedt
2020-01-21 14:38 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200121143957.062447110@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami256@gmail.com \
    --cc=mingo@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox