From: Steven Rostedt <rostedt@goodmis.org>
To: Runping Lai <runpinglai@google.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Wattson CI <wattson-external@google.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
Luo Gengkun <luogengkun@huaweicloud.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v1] Revert "tracing: Fix tracing_marker may trigger page fault during preempt_disable"
Date: Mon, 6 Oct 2025 22:10:43 -0400 [thread overview]
Message-ID: <20251006221043.07cdb0fd@gandalf.local.home> (raw)
In-Reply-To: <20251007003417.3470979-2-runpinglai@google.com>
On Tue, 7 Oct 2025 00:34:17 +0000
Runping Lai <runpinglai@google.com> wrote:
> This reverts commit 3d62ab32df065e4a7797204a918f6489ddb8a237.
>
> It's observed on Pixel 6 that this commit causes a severe functional
> regression: all user-space writes to trace_marker now fail. The write
> does not goes through at all. The error is observed in the shell as
> 'printf: write: Bad address'. This breaks a primary ftrace interface
> for user-space debugging and profiling. In kernel trace file, it's
> logged as 'tracing_mark_write: <faulted>'. After reverting this commit,
> functionality is restored.
This is very interesting. The copy is being done in an atomic context. If
the fault had to do anything other than update a page table, it is likely
not to do anything and return a fault.
What preemption model is Pixel 6 running in? CONFIG_PREEMPT_NONE?
The original code is buggy, but if this is causing a regression, then we
likely need to do something else, like copy in a pre-allocated buffer?
-- Steve
>
> Signed-off-by: Runping Lai <runpinglai@google.com>
> Reported-by: Wattson CI <wattson-external@google.com>
> ---
> kernel/trace/trace.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 156e7e0bf559..bb9a6284a629 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -7213,7 +7213,7 @@ static ssize_t write_marker_to_buffer(struct trace_array *tr, const char __user
> entry = ring_buffer_event_data(event);
> entry->ip = ip;
>
> - len = copy_from_user_nofault(&entry->buf, ubuf, cnt);
> + len = __copy_from_user_inatomic(&entry->buf, ubuf, cnt);
> if (len) {
> memcpy(&entry->buf, FAULTED_STR, FAULTED_SIZE);
> cnt = FAULTED_SIZE;
> @@ -7310,7 +7310,7 @@ static ssize_t write_raw_marker_to_buffer(struct trace_array *tr,
>
> entry = ring_buffer_event_data(event);
>
> - len = copy_from_user_nofault(&entry->id, ubuf, cnt);
> + len = __copy_from_user_inatomic(&entry->id, ubuf, cnt);
> if (len) {
> entry->id = -1;
> memcpy(&entry->buf, FAULTED_STR, FAULTED_SIZE);
next prev parent reply other threads:[~2025-10-07 2:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 0:34 Runping Lai
2025-10-07 2:10 ` Steven Rostedt [this message]
2025-10-07 18:19 ` Runping Lai
2025-10-07 19:43 ` Steven Rostedt
2025-10-07 20:31 ` Steven Rostedt
2025-10-07 21:42 ` Steven Rostedt
2025-10-07 23:25 ` Runping Lai
2025-10-08 0:21 ` Steven Rostedt
2025-10-08 16:32 ` Steven Rostedt
2025-10-08 17:12 ` Runping Lai
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=20251006221043.07cdb0fd@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=luogengkun@huaweicloud.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=runpinglai@google.com \
--cc=torvalds@linux-foundation.org \
--cc=wattson-external@google.com \
/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®