mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Chunyu Hu <chuhu@redhat.com>
Subject: [GIT PULL][PATCH] tracing: Don't display trigger file for events that can't be enabled
Date: Tue, 3 May 2016 19:24:41 -0400	[thread overview]
Message-ID: <20160503192441.1fd3cb8a@gandalf.local.home> (raw)


Linus,

Chunyu Hu noticed that if one writes into the trigger files within the
ftrace subsystem of events that it can cause an oops. This file is only
writable by root, but still is a bug that needs to be fixed.


Please pull the latest trace-fixes-v4.6-rc6 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-fixes-v4.6-rc6

Tag SHA1: 125fdb6b0df754816c8afcdf7eecb85398253bdd
Head SHA1: 854145e0a8e9a05f7366d240e2f99d9c1ca6d6dd


Chunyu Hu (1):
      tracing: Don't display trigger file for events that can't be enabled

----
 kernel/trace/trace_events.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---------------------------
commit 854145e0a8e9a05f7366d240e2f99d9c1ca6d6dd
Author: Chunyu Hu <chuhu@redhat.com>
Date:   Tue May 3 19:34:34 2016 +0800

    tracing: Don't display trigger file for events that can't be enabled
    
    Currently register functions for events will be called
    through the 'reg' field of event class directly without
    any check when seting up triggers.
    
    Triggers for events that don't support register through
    debug fs (events under events/ftrace are for trace-cmd to
    read event format, and most of them don't have a register
    function except events/ftrace/functionx) can't be enabled
    at all, and an oops will be hit when setting up trigger
    for those events, so just not creating them is an easy way
    to avoid the oops.
    
    Link: http://lkml.kernel.org/r/1462275274-3911-1-git-send-email-chuhu@redhat.com
    
    Cc: stable@vger.kernel.org # 3.14+
    Fixes: 85f2b08268c01 ("tracing: Add basic event trigger framework")
    Signed-off-by: Chunyu Hu <chuhu@redhat.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 05ddc0820771..6f965864cc02 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2095,8 +2095,13 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file)
 	trace_create_file("filter", 0644, file->dir, file,
 			  &ftrace_event_filter_fops);
 
-	trace_create_file("trigger", 0644, file->dir, file,
-			  &event_trigger_fops);
+	/*
+	 * Only event directories that can be enabled should have
+	 * triggers.
+	 */
+	if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
+		trace_create_file("trigger", 0644, file->dir, file,
+				  &event_trigger_fops);
 
 	trace_create_file("format", 0444, file->dir, call,
 			  &ftrace_event_format_fops);

                 reply	other threads:[~2016-05-03 23:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160503192441.1fd3cb8a@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=chuhu@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®