BPF List
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Andy Lutomirski" <luto@kernel.org>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	<bpf@vger.kernel.org>
Cc: "Puranjay Mohan" <puranjay@kernel.org>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>, <kkd@meta.com>,
	<kernel-team@meta.com>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v1 1/3] x86/mm: Resolve BPF exception fixups for user address faults under SMAP
Date: Fri, 27 Nov 2026 00:18:37 +0000	[thread overview]
Message-ID: <DN5K8Y9824AE.3GPOE0WP9ELFN@gmail.com> (raw)
In-Reply-To: <03275761-8de2-41be-92fd-8e3012a87eeb@app.fastmail.com>

On Thu, Nov 26, 2026 at 09:30 AM Andy Lutomirski <luto@kernel.org> wrote:
> Okay.  So maybe there should be a nice patch set to *fix* it.

In a perfect world, yes, it would be nice to fix, but no one stumbled
on it since the probe_read_kernel appeared in 2009, so it's worth
fixing only if it doesn't kill tracing as a feature.
Kernel observability is a mandatory feature.
Looking at 3 options:

> 1. Walking a little list or table to validate the address (which may require some sort of synchronization and obviously needs to be NMI-safe -- for systems that use TLB-flush IPIs, blocking interrupts could probably do most of the hard work, and otherwise a little flag set while a read is in progress that can block the change of an address from safe to unsafe would do it.

walk and the synchronization makes it unusable due to NMI,
but we we can give uncached ioremap() a different range vs vmalloc()
then it might be practical with a single range check.

> 2. Allocate a PKS key for the purpose and use it.  (Only works on systems that have PKS.)

My research showed that the effort to get PKS into the kernel stalled years ago,
and it's intel only feature.

> 3. Use an entire mm for the purpose and treat it as a user access.  This is probably the cleanest solution but it will be slooooooooow.

You mean like use_temporary_mm() with direct cr3 writes ?
If every read needs mm switch that might expose intel HW bugs.
I remember div bug and I bet there are more lurking in the hw.
I'd rather not push the hw limits.

As a summary I don't see a practical improvement for probe_read_kernel.
Maybe there is an option 4 and 5.

The main point that it's orgonal to this patchset.

btw I'm planning to explore PKU for other bpf needs
if writes to PKRU register are fast enough.


  reply	other threads:[~2026-11-27  0:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  2:49 [PATCH bpf-next v1 0/3] bpf, x86: Drop the PROBE_MEM address range check under SMAP Kumar Kartikeya Dwivedi
2026-10-09  2:49 ` [PATCH bpf-next v1 1/3] x86/mm: Resolve BPF exception fixups for user address faults " Kumar Kartikeya Dwivedi
2026-10-09  3:03   ` sashiko-bot
2026-10-09  4:13   ` Borislav Petkov
2026-10-09 15:23     ` Kumar Kartikeya Dwivedi
2026-11-22 20:08       ` Borislav Petkov
2026-11-22 21:59         ` Kumar Kartikeya Dwivedi
2026-11-23  0:30           ` Borislav Petkov
2026-11-23  0:59             ` Kumar Kartikeya Dwivedi
2026-11-23  2:55               ` Borislav Petkov
2026-11-23  3:56                 ` Kumar Kartikeya Dwivedi
2026-11-23  4:34                   ` Borislav Petkov
2026-11-23  6:58                   ` Alexei Starovoitov
2026-11-23 17:27                     ` Kumar Kartikeya Dwivedi
2026-11-23 18:51                     ` Borislav Petkov
2026-11-24  6:25                       ` Alexei Starovoitov
2026-11-25  2:17                         ` Borislav Petkov
2026-11-25  3:27                           ` Alexei Starovoitov
2026-11-23 15:36       ` Dave Hansen
2026-11-23 17:23         ` Kumar Kartikeya Dwivedi
2026-11-24 15:25           ` Dave Hansen
2026-11-24 20:17             ` Alexei Starovoitov
2026-11-25  4:22   ` Andy Lutomirski
2026-11-25  6:45     ` Alexei Starovoitov
2026-11-26  5:38       ` Andy Lutomirski
2026-11-26  6:18         ` Alexei Starovoitov
2026-11-26 17:30           ` Andy Lutomirski
2026-11-27  0:18             ` Alexei Starovoitov [this message]
2026-10-09  2:49 ` [PATCH bpf-next v1 2/3] bpf, x86: Skip the PROBE_MEM address range check " Kumar Kartikeya Dwivedi
2026-10-09  3:42   ` bot+bpf-ci
2026-10-09  2:49 ` [PATCH bpf-next v1 3/3] selftests/bpf: Test PROBE_MEM loads from invalid addresses Kumar Kartikeya Dwivedi
2026-10-09  2:56   ` sashiko-bot

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=DN5K8Y9824AE.3GPOE0WP9ELFN@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=memxor@gmail.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=puranjay@kernel.org \
    --cc=tglx@kernel.org \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox