From: sashiko-bot@kernel.org
To: "Miguel Gazquez (Schneider Electric)" <miguel.gazquez@bootlin.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH 5.10.y] bpf: Enforce expected_attach_type for tailcall compatibility
Date: Tue, 08 Sep 2026 14:49:13 +0000 [thread overview]
Message-ID: <20260908144915.24D6C1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260908-cve-2025-40123-v1-1-be62451196fb@bootlin.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Incomplete fix for tailcall expected_attach_type bypass: BPF_PROG_TYPE_EXT programs bypass the check.
--
commit d87774423a605def68b6715a3edf5dc1feea5da7
Author: Daniel Borkmann <daniel@iogearbox.net>
bpf: Enforce expected_attach_type for tailcall compatibility
This patch aims to prevent context confusion by enforcing that programs
inserted into a tailcall map share the same expected_attach_type.
This restricts tailcalls from violating attach type constraints.
Link: https://lore.kernel.org/r/20250926171201.188490-1-daniel@iogearbox.net
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
[ ... ]
> @@ -1795,10 +1795,14 @@ bool bpf_prog_array_compatible(struct bpf_array *array,
[ ... ]
> } else {
> ret = array->aux->owner.type == fp->type &&
> array->aux->owner.jited == fp->jited;
> + if (ret &&
> + array->aux->owner.expected_attach_type != fp->expected_attach_type)
> + ret = false;
[Severity: High]
This is a pre-existing issue, but does this check effectively become 0 != 0
for all BPF_PROG_TYPE_EXT programs, allowing arbitrary mixing of EXT programs
with different underlying target contexts?
It appears that for BPF_PROG_TYPE_EXT programs, expected_attach_type is
reset to 0 at the end of verification in bpf_check().
If userspace loads two BPF_PROG_TYPE_EXT programs targeting entirely
different functions (e.g., XDP_DEVMAP vs XDP_CPUMAP) and inserts them both
into the same BPF_MAP_TYPE_PROG_ARRAY, couldn't a tailcall between them
bypass this expected_attach_type check?
Can this allow a program verified for one target context to execute in a
different context, potentially leading to out-of-bounds accesses or NULL
pointer dereferences?
> }
> spin_unlock(&array->aux->owner.lock);
> return ret;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-cve-2025-40123-v1-1-be62451196fb@bootlin.com?part=1
next prev parent reply other threads:[~2026-09-08 14:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 14:28 [PATCH 5.10.y] bpf: Enforce expected_attach_type for tailcall compatibility Miguel Gazquez (Schneider Electric)
2026-09-08 14:49 ` sashiko-bot [this message]
2026-09-09 20:26 ` Sasha Levin
2026-09-10 9:34 ` Miguel Gazquez
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=20260908144915.24D6C1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=miguel.gazquez@bootlin.com \
--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.