From: sashiko-bot@kernel.org
To: "JunYoung Lee" <ljyoung04@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf/core: Don't expose kernel page sizes to exclude_kernel events
Date: Wed, 02 Dec 2026 06:50:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-245000@kernel.org> (raw)
In-Reply-To: <20261202063433.279947-1-ljyoung04@gmail.com>
> PERF_SAMPLE_CODE_PAGE_SIZE and PERF_SAMPLE_DATA_PAGE_SIZE make
> perf_prepare_sample() call perf_get_page_size() on data->ip and
> data->addr. perf_get_page_size() walks the page tables of the current mm
> (or init_mm) and returns the leaf size (0, 4K, 2M or 1G) of the mapping.
> The address comes from the sample and is not range checked.
>
> With the default perf_event_paranoid=2, a user without CAP_PERFMON has
> to set exclude_kernel, because perf_event_open() calls
> perf_allow_kernel() whenever exclude_kernel is clear. The overflow path
> then drops a sample only if exclude_kernel is set and user_mode(regs) is
> false, so it checks the mode of the sampled frame, not the sampled
> address. A user-mode frame can still carry a kernel address: a hardware
> data breakpoint on the memory operand of an indirect "jmp *mem" traps
> after the jump, so the user-mode trap frame already holds the kernel
> jump target in RIP. data->ip is then a kernel address and its page size
> [ ... ]
> Fixes: 8d97e71811aa ("perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE")
> Fixes: 995f088efebe ("perf/core: Add support for PERF_SAMPLE_CODE_PAGE_SIZE")
> Fixes: a92cbb82c8d3 ("perf/core: allow pte_offset_map() to fail")
> Cc: stable@vger.kernel.org
> Signed-off-by: JunYoung Lee <ljyoung04@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202063433.279947-1-ljyoung04@gmail.com?part=1
prev parent reply other threads:[~2026-12-02 6:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 6:34 [PATCH] perf/core: Don't expose kernel page sizes to exclude_kernel events JunYoung Lee
2026-12-02 6:50 ` sashiko-bot [this message]
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=sashiko-outbox-245000@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=ljyoung04@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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