All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>, <bpf@vger.kernel.org>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Nicholas Carlini" <npc@anthropic.com>, <kkd@meta.com>,
	<kernel-team@meta.com>
Subject: Re: [PATCH bpf-next v1 1/3] bpf: Validate graph ownership with a bounded walk
Date: Sat, 05 Sep 2026 14:29:38 -0700	[thread overview]
Message-ID: <DL7PAW1GJ5EE.3A8VB5PA5K3H2@gmail.com> (raw)
In-Reply-To: <20260905090750.4064411-2-memxor@gmail.com>

On Sat Sep 5, 2026 at 2:07 AM PDT, Kumar Kartikeya Dwivedi wrote:
> btf_check_and_fixup_fields() prevents graph ownership cycles with a
> one-hop restriction: a type that contains both a graph root and node cannot
> own another root type. This limits graph ownership chains to three types,
> but also rejects longer acyclic relationships.
>
> All struct metadata is available once field fixups finish. Move ownership
> validation out of the per-record fixup helper and walk graph-root type
> relationships directly at BTF load time. Reject cycles and chains deeper
> than eight record-bearing types, which keeps recursive destruction bounded
> while permitting safe acyclic layouts.
>
> Keep the depth limit independent of MAX_CALL_FRAMES because graph teardown
> can run beneath a BPF call chain. btf_check_and_fixup_fields() continues to
> initialize graph_root.value_rec, including for the separately allocated map
> record. The ownership relationship itself belongs to the immutable BTF and
> therefore only needs validation once during BTF load.
>
> Update the graph BTF tests to accept the two acyclic relationships that the
> old approximation rejected.

Are you saying old approximation was not correct?
Pls explain how it missed it.

Probably better to merge patch 1 and 2. I don't see why they're split like that
and patch 2 immediately fixes patch 1.

pw-bot: cr

  reply	other threads:[~2026-09-05 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05  9:07 [PATCH bpf-next v1 0/3] Fix acyclic ownership checks Kumar Kartikeya Dwivedi
2026-09-05  9:07 ` [PATCH bpf-next v1 1/3] bpf: Validate graph ownership with a bounded walk Kumar Kartikeya Dwivedi
2026-09-05 21:29   ` Alexei Starovoitov [this message]
2026-09-05  9:07 ` [PATCH bpf-next v1 2/3] bpf: Bound local kptr ownership depth Kumar Kartikeya Dwivedi
2026-09-05  9:07 ` [PATCH bpf-next v1 3/3] selftests/bpf: Check local object " 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=DL7PAW1GJ5EE.3A8VB5PA5K3H2@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=memxor@gmail.com \
    --cc=npc@anthropic.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 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.