From: Pu Lehui <pulehui@huawei.com>
To: Pu Lehui <pulehui@huaweicloud.com>, <rostedt@goodmis.org>,
<mhiramat@kernel.org>, <mathieu.desnoyers@efficios.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: Fix missing errno when zero parser->idx in trace_pid_write
Date: Thu, 28 Aug 2025 10:02:54 +0800 [thread overview]
Message-ID: <d759c163-9673-48e5-bd6b-49446511b7e0@huawei.com> (raw)
In-Reply-To: <20250821071721.3609109-1-pulehui@huaweicloud.com>
On 2025/8/21 15:17, Pu Lehui wrote:
> From: Pu Lehui <pulehui@huawei.com>
>
> When trace_get_user in trace_pid_write parses an only space, the
> !trace_parser_loaded branch will break with no errno, causing
> tr->filtered_pids to still be assigned with pid_list, which may trigger
> potential problems.
Gentle ping~
Hi all, Is this commit looks proper?
>
> This patch will also silence the fault injection syzkaller warning in
> tracepoint_add_func [0]. We can reproduce the warning by following the
> steps below:
> 1. echo 8 >> set_event_notrace_pid. Let tr->filtered_pids owns one pid
> and register sched_switch tracepoint.
> 2. echo ' ' >> set_event_pid, and perform fault injection during chunk
> allocation of trace_pid_list_alloc. Let pid_list with no pid and
> assign to tr->filtered_pids.
> 3. echo ' ' >> set_event_pid. Let pid_list is NULL and assign to
> tr->filtered_pids.
> 4. echo 9 >> set_event_pid, will trigger the double register
> sched_switch tracepoint warning.
>
> Link: https://lore.kernel.org/all/67cb890e.050a0220.d8275.022e.GAE@google.com [0]
> Fixes: b27f266f74fb ("tracing: Fix return value of trace_pid_write()")
> Signed-off-by: Pu Lehui <pulehui@huawei.com>
> ---
> kernel/trace/trace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 8d8935ed416d..feeb7eb71318 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -853,10 +853,10 @@ int trace_pid_write(struct trace_pid_list *filtered_pids,
> ubuf += ret;
> cnt -= ret;
>
> + ret = -EINVAL;
> if (!trace_parser_loaded(&parser))
> break;
>
> - ret = -EINVAL;
> if (kstrtoul(parser.buffer, 0, &val))
> break;
>
next prev parent reply other threads:[~2025-08-28 2:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 7:17 Pu Lehui
2025-08-28 2:02 ` Pu Lehui [this message]
2025-08-28 2:58 ` Steven Rostedt
2025-09-02 15:09 ` kernel test robot
2025-09-05 19:03 ` Steven Rostedt
2025-09-11 8:23 ` Oliver Sang
2025-09-11 14:04 ` Steven Rostedt
2025-09-03 4:15 ` Pu Lehui
2025-09-05 19:39 ` Steven Rostedt
2025-09-08 2:47 ` Pu Lehui
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=d759c163-9673-48e5-bd6b-49446511b7e0@huawei.com \
--to=pulehui@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=pulehui@huaweicloud.com \
--cc=rostedt@goodmis.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®