linux-kernel.vger.kernel.org archive mirror
 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>,
	Tom Zanussi <zanussi@kernel.org>,
	stable@vger.kernel.org, Masami Hiramatsu <mhiramat@kernel.org>
Subject: [for-linus][PATCH 4/9] tracing/kprobes: Reject new event if loc is NULL
Date: Thu, 07 May 2020 13:39:08 -0400	[thread overview]
Message-ID: <20200507173928.816083926@goodmis.org> (raw)
In-Reply-To: 20200507173904.729935165@goodmis.org

From: Masami Hiramatsu <mhiramat@kernel.org>

Reject the new event which has NULL location for kprobes.
For kprobes, user must specify at least the location.

Link: http://lkml.kernel.org/r/158779376597.6082.1411212055469099461.stgit@devnote2

Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 2a588dd1d5d6 ("tracing: Add kprobe event command generation functions")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_kprobe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 0d9300c3b084..35989383ae11 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -940,6 +940,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
  * complete command or only the first part of it; in the latter case,
  * kprobe_event_add_fields() can be used to add more fields following this.
  *
+ * Unlikely the synth_event_gen_cmd_start(), @loc must be specified. This
+ * returns -EINVAL if @loc == NULL.
+ *
  * Return: 0 if successful, error otherwise.
  */
 int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe,
@@ -953,6 +956,9 @@ int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe,
 	if (cmd->type != DYNEVENT_TYPE_KPROBE)
 		return -EINVAL;
 
+	if (!loc)
+		return -EINVAL;
+
 	if (kretprobe)
 		snprintf(buf, MAX_EVENT_NAME_LEN, "r:kprobes/%s", name);
 	else
-- 
2.26.2



  parent reply	other threads:[~2020-05-07 17:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 17:39 [for-linus][PATCH 0/9] tracing: Fixes for 5.7 Steven Rostedt
2020-05-07 17:39 ` [for-linus][PATCH 1/9] bootconfig: Fix to remove bootconfig data from initrd while boot Steven Rostedt
2020-05-07 17:39 ` [for-linus][PATCH 2/9] tracing/kprobes: Fix a double initialization typo Steven Rostedt
2020-05-07 17:39 ` [for-linus][PATCH 3/9] tracing/boottime: Fix kprobe event API usage Steven Rostedt
2020-05-07 17:39 ` Steven Rostedt [this message]
2020-05-07 17:39 ` [for-linus][PATCH 5/9] tracing: Wait for preempt irq delay thread to finish Steven Rostedt
2020-05-07 17:39 ` [for-linus][PATCH 6/9] tracing: Add a vmalloc_sync_mappings() for safe measure Steven Rostedt
2020-05-07 17:39 ` [for-linus][PATCH 7/9] gpu/trace: Minor comment updates for gpu_mem_total tracepoint Steven Rostedt
2020-05-07 17:39 ` [for-linus][PATCH 8/9] tracing: Fix doc mistakes in trace sample Steven Rostedt
2020-05-07 17:39 ` [for-linus][PATCH 9/9] tracing: Make tracing_snapshot_instance_cond() static Steven Rostedt
2020-05-07 18:22 ` [for-linus][PATCH 10/9] tools/bootconfig: Fix resource leak in apply_xbc() Steven Rostedt

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=20200507173928.816083926@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zanussi@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;
as well as URLs for NNTP newsgroup(s).