BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: memxor@gmail.com, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 4/6] bpf: Rewrite any fault prone load out of a mem or btf_id pointer
Date: Sun, 16 Aug 2026 13:06:07 -0700	[thread overview]
Message-ID: <6ac1a64834adae3eda18cf3b261bcb88fefae3e9.camel@gmail.com> (raw)
In-Reply-To: <20260814215301.709827-4-daniel@iogearbox.net>

On Fri, 2026-08-14 at 23:52 +0200, Daniel Borkmann wrote:
> bpf_convert_ctx_accesses() turns a BPF_LDX into a BPF_PROBE_MEM one by
> matching the type recorded for the insn against a list of exact pointer
> types. The list cannot keep up with the flag combinations the verifier
> produces, and a type which is missing from it ends up as a plain load
> without an exception table entry, so a bad address panics the kernel
> instead of being handled.
> 
> Two such types exist today and are reachable:
> 
>   - PTR_TO_BTF_ID | PTR_UNTRUSTED | MEM_ALLOC | NON_OWN_REF
>   - PTR_TO_BTF_ID | PTR_UNTRUSTED | MEM_RCU
> 
> Rather than adding the two, just drop the list and state the property
> itself in the default case of the switch. This is a superset of what
> the list matched, the untrusted PTR_TO_MEM does not have to carry
> MEM_RDONLY for it anymore, and it stays in sync with the verifier side
> which uses the same match in save_aux_ptr_type() and reg_type_mismatch_ok().
> 
> Assert that a fault prone type which does not get the rewrite for whatever
> reason is rejected at load time rather than left to fault at runtime to
> catch any future cases.
> 
> Fixes: 1b12171533a9 ("bpf: Mark direct ld of stashed bpf_{rb,list}_node as non-owning ref")
> Fixes: 6fcd486b3a0a ("bpf: Refactor RCU enforcement in the verifier.")
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> ---
>  v1 -> v2:
>    - new patch, don't match on full types (Eduard)

Acked-by: Eduard Zingerman <eddyz87@gmail.com>

  reply	other threads:[~2026-08-16 20:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 21:52 [PATCH bpf-next v2 1/6] bpf: Keep fault protection when merging pointer types Daniel Borkmann
2026-08-14 21:52 ` [PATCH bpf-next v2 2/6] bpf: Treat a fault prone PTR_TO_MEM as a pointer type mismatch Daniel Borkmann
2026-08-16 19:44   ` Eduard Zingerman
2026-08-14 21:52 ` [PATCH bpf-next v2 3/6] bpf: Reject a store through a fault prone pointer Daniel Borkmann
2026-08-14 22:40   ` bot+bpf-ci
2026-08-14 23:26     ` Daniel Borkmann
2026-08-16 19:54   ` Eduard Zingerman
2026-08-16 20:02     ` Eduard Zingerman
2026-08-14 21:52 ` [PATCH bpf-next v2 4/6] bpf: Rewrite any fault prone load out of a mem or btf_id pointer Daniel Borkmann
2026-08-16 20:06   ` Eduard Zingerman [this message]
2026-08-14 21:52 ` [PATCH bpf-next v2 5/6] selftests/bpf: Add tests for pointer type merge at a shared load Daniel Borkmann
2026-08-14 22:56   ` bot+bpf-ci
2026-08-14 23:35     ` Daniel Borkmann
2026-08-16 22:24   ` Eduard Zingerman
2026-08-16 22:32   ` Eduard Zingerman
2026-08-14 21:53 ` [PATCH bpf-next v2 6/6] selftests/bpf: Add tests for fault prone loads out of RCU pointers Daniel Borkmann
2026-08-14 22:03   ` sashiko-bot
2026-08-14 22:28     ` Daniel Borkmann
2026-08-16 22:24   ` Eduard Zingerman
2026-08-14 22:15 ` [PATCH bpf-next v2 1/6] bpf: Keep fault protection when merging pointer types sashiko-bot
2026-08-14 22:19   ` Daniel Borkmann
2026-08-16 19:42 ` Eduard Zingerman

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=6ac1a64834adae3eda18cf3b261bcb88fefae3e9.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=memxor@gmail.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