Re: [PATCH bpf-next] bpf: add BPF_F_SEALED flag to seal BPF links at creation

Leon Hwang <[email protected]> Mon, 3 Aug 2026 10:44:04 +0800
Newsgroups org.kernel.vger.bpf
Message-ID <[email protected]>
On 3/8/26 10:16, David Windsor wrote:
> Introduce a new BPF_F_SEALED flag for BPF_LINK_CREATE that creates the
> link permanently sealed. A sealed link can never have its program
> replaced via BPF_LINK_UPDATE, can never be detached via BPF_LINK_DETACH,
> and holds an extra self-reference that is never released, so the link and
> its program attachment persist until the machine reboots, even after user
> space closes every fd referring to it. There is no way to unseal a link.
> 
> The sealed state is tracked by a new bool field on struct bpf_link.


Why do you want BPF_F_SEALED? What's your case for it?

I think 'sealed' should be set before allocating the FD to avoid the
race issues reported by Sashiko.

Thanks,
Leon

> [...]