From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: sashiko-bot@kernel.org
Cc: Kyle Zeng <kylebot@openai.com>, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing/filters: Check perf permissions before resolving .function
Date: Wed, 07 Oct 2026 03:59:09 +0000 [thread overview]
Message-ID: <20261007035912.401641F0089B@smtp.kernel.org> (raw)
In-Reply-To: <sashiko-outbox-162502@kernel.org>
On Tue, 06 Oct 2026 23:06:23 +0000, sashiko-bot@kernel.org <sashiko-bot@kernel.org> wrote:
> [Severity: High]
> This successfully prevents KASLR bypass via the .function suffix, but does
> it leave a similar memory disclosure oracle open for standard string matches
> on pointer fields?
>
> Later in parse_pred(), if the field is a pointer and the user omits the
> .ustring suffix, the predicate is assigned FILTER_PRED_FN_PCHAR without
> checking perf_allow_tracepoint():
>
> kernel/trace/trace_events_filter.c:parse_pred() {
> ...
> if (ustring)
> pred->fn_num = FILTER_PRED_FN_PCHAR_USER;
> else
> pred->fn_num = FILTER_PRED_FN_PCHAR;
> ...
> }
>
> Could an unprivileged user create a counting perf event without
> PERF_SAMPLE_RAW on a syscall tracepoint like sys_enter_openat (which is
> allowed because syscall tracepoints have the TRACE_EVENT_FL_CAP_ANY flag)?
>
> If they set a string wildcard filter (e.g., ~ "secret*") on a pointer field
> like filename, wouldn't the filter engine read from the user-controlled
> kernel_addr when evaluating FILTER_PRED_FN_PCHAR?
>
> kernel/trace/trace_events_filter.c:test_string() {
> ...
> /* For safety, do not trust the string pointer */
> if (strncpy_from_kernel_nofault(kstr, str, USTRING_BUF_SIZE) < 0)
> return NULL;
> ...
> }
>
> If the kernel memory successfully matches the wildcard, the perf counter
> increments, which could allow an attacker to extract arbitrary kernel memory
> byte-by-byte.
>
> Should perf_allow_tracepoint() also be checked before assigning
> FILTER_PRED_FN_PCHAR to prevent this disclosure?
Ah, indeed. Kyle, can you update the patch according to this comment?
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2026-10-07 3:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 22:51 [PATCH] tracing/filters: Check perf permissions before resolving .function Kyle Zeng
2026-10-06 23:06 ` sashiko-bot
2026-10-07 3:59 ` Masami Hiramatsu [this message]
2026-10-07 3:44 ` Masami Hiramatsu
2026-10-07 3:47 ` Kyle Zeng
2026-10-07 5:52 ` Masami Hiramatsu
2026-10-07 5:56 ` Kyle Zeng
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=20261007035912.401641F0089B@smtp.kernel.org \
--to=mhiramat@kernel.org \
--cc=kylebot@openai.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-bot@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.