From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: <sashiko-reviews@lists.linux.dev>, <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 1/3] x86/mm: Resolve BPF exception fixups for user address faults under SMAP
Date: Sat, 28 Nov 2026 03:16:21 +0100 [thread overview]
Message-ID: <DN6HDN2N87GO.C2NVM588C2DP@gmail.com> (raw)
In-Reply-To: <sashiko-outbox-238412@kernel.org>
On Sat Nov 28, 2026 at 2:46 AM CET, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] x86/mm: SMAP does not fault on supervisor mappings below
> TASK_SIZE_MAX
> --
>
> commit 9b387754d627ac256ae9705ce7d6a4e7a2935051
> Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>
>
> x86/mm: Resolve BPF exception fixups for user address faults under SMAP
>
> This commit resolves EX_TYPE_BPF exception table entries on kernel-mode read
> faults in do_user_addr_fault() under SMAP, allowing the x86 BPF JIT to omit
> its software range check before PROBE_MEM loads.
>
>> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
>> index aa88370ce7394..9fe8705eff043 100644
>> --- a/arch/x86/mm/fault.c
>> +++ b/arch/x86/mm/fault.c
>> @@ -1263,7 +1263,16 @@ void do_user_addr_fault(struct pt_regs *regs,
>> !(error_code & X86_PF_USER) &&
>> !(regs->flags & X86_EFLAGS_AC))) {
>> /*
>> - * No extable entry here. This was a kernel access to an
>> + * The CPU refused the access. If the BPF JIT marked this load
>> + * as one that may fault, skip it and zero the destination.
>> + */
>> + if (!user_mode(regs) && !(error_code & X86_PF_WRITE) &&
>> + ex_get_fixup_type(regs->ip) == EX_TYPE_BPF &&
>> + fixup_exception(regs, X86_TRAP_PF, error_code, address))
>> + return;
>
> [Severity: Medium]
> Can relying on SMAP to refuse PROBE_MEM loads below TASK_SIZE_MAX allow reads
> from supervisor mappings in the low address range when a temporary mm such as
> efi_mm is active in CR3?
>
Which is fine, the read just goes through in that case. Bot is confused about
the semantics of the feature.
> [...]
next prev parent reply other threads:[~2026-11-28 2:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 1:28 [PATCH bpf-next v2 0/3] bpf, x86: Drop the PROBE_MEM address range check under SMAP Kumar Kartikeya Dwivedi
2026-11-28 1:28 ` [PATCH bpf-next v2 1/3] x86/mm: Resolve BPF exception fixups for user address faults " Kumar Kartikeya Dwivedi
2026-11-28 1:46 ` sashiko-bot
2026-11-28 2:16 ` Kumar Kartikeya Dwivedi [this message]
2026-11-28 1:28 ` [PATCH bpf-next v2 2/3] bpf, x86: Skip the PROBE_MEM address range check " Kumar Kartikeya Dwivedi
2026-11-28 1:41 ` sashiko-bot
2026-11-28 2:16 ` Kumar Kartikeya Dwivedi
2026-11-28 1:28 ` [PATCH bpf-next v2 3/3] selftests/bpf: Test PROBE_MEM loads from invalid addresses Kumar Kartikeya Dwivedi
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=DN6HDN2N87GO.C2NVM588C2DP@gmail.com \
--to=memxor@gmail.com \
--cc=bpf@vger.kernel.org \
--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 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.