From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Beau Belgrave <beaub@linux.microsoft.com>,
sunliming <sunliming@kylinos.cn>
Subject: [for-linus][PATCH 05/15] tracing/user_events: Fix the incorrect trace record for empty arguments events
Date: Thu, 15 Jun 2023 09:05:36 -0400 [thread overview]
Message-ID: <20230615133415.683635706@goodmis.org> (raw)
In-Reply-To: 20230615130531.200384328@goodmis.org
From: sunliming <sunliming@kylinos.cn>
The user_events support events that has empty arguments. But the trace event
is discarded and not really committed when the arguments is empty. Fix this
by not attempting to copy in zero-length data.
Link: https://lkml.kernel.org/r/20230606062027.1008398-2-sunliming@kylinos.cn
Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: sunliming <sunliming@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index afe61dc86543..49914b6cb651 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1432,7 +1432,7 @@ static void user_event_ftrace(struct user_event *user, struct iov_iter *i,
if (unlikely(!entry))
return;
- if (unlikely(!copy_nofault(entry + 1, i->count, i)))
+ if (unlikely(i->count != 0 && !copy_nofault(entry + 1, i->count, i)))
goto discard;
if (!list_empty(&user->validators) &&
@@ -1473,7 +1473,7 @@ static void user_event_perf(struct user_event *user, struct iov_iter *i,
perf_fetch_caller_regs(regs);
- if (unlikely(!copy_nofault(perf_entry + 1, i->count, i)))
+ if (unlikely(i->count != 0 && !copy_nofault(perf_entry + 1, i->count, i)))
goto discard;
if (!list_empty(&user->validators) &&
--
2.39.2
next prev parent reply other threads:[~2023-06-15 13:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 01/15] tracing/rv/rtla: Update MAINTAINERS file to point to proper mailing list Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 02/15] tracing/user_events: Prevent same name but different args event Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 03/15] tracing/user_events: Handle matching arguments that is null from dyn_events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 04/15] tracing: Modify print_fields() for fields output order Steven Rostedt
2023-06-15 13:05 ` Steven Rostedt [this message]
2023-06-15 13:05 ` [for-linus][PATCH 06/15] selftests/user_events: Add ftrace self-test for empty arguments events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 07/15] selftests/user_events: Clear the events after perf self-test Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 08/15] selftests/user_events: Add perf self-test for empty arguments events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 09/15] tracing/user_events: Remove user_ns walk for groups Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 10/15] tracing/user_events: Store register flags on events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 11/15] tracing/user_events: Track refcount consistently via put/get Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 12/15] tracing/user_events: Add auto cleanup and future persist flag Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 13/15] selftests/user_events: Ensure auto cleanup works as expected Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 14/15] selftests/user_events: Adapt dyn_test to non-persist events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 15/15] tracing/user_events: Document auto-cleanup and remove dyn_event refs 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=20230615133415.683635706@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=beaub@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=sunliming@kylinos.cn \
/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