BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Florent Revest (Anthropic)" <florent.revest@linux.dev>
Cc: linux-s390@vger.kernel.org,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	bpf@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH bpf v5 3/3] selftests/bpf: Detach a trampoline prog while a task sleeps before it
Date: Sat, 26 Sep 2026 14:01:47 +0000	[thread overview]
Message-ID: <20260926140147.E77C11F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260926135605.1217928-4-florent.revest@linux.dev>

> Add a test for the use-after-free fixed by the previous commit. A
> sleepable prog on bpf_fentry_test1() blocks a task on a userfaultfd
> page, like bpf_mod_race does, while the two progs that run after it in
> the same trampoline are detached and freed one after the other, which
> the test knows from their .bss maps going away. After the first detach
> the task is in an image that isn't the trampoline's current one
> anymore. The task is then released and must not call into the freed
> progs. This is done with fentry progs, with fexit progs, where the task
> is already past the original function, and with a task sleeping in a
> fentry prog while fexit progs are detached, where the original function
> must still be called. bpf_mod_race's userfaultfd helper moves to
> testing_helpers.c so that both tests can use it.
> 
> Without the fix, on a kernel with KASAN:
> 
>   BUG: KASAN: vmalloc-out-of-bounds in __bpf_prog_enter_recur+0xed/0x1e0
>   Read of size 8 at addr ffa0000000144040 by task test_progs/171
>   CPU: 6 UID: 0 PID: 171 Comm: test_progs Tainted: G           OE       7.2.0+ #1 PREEMPT(full)
>   Call Trace:
>    <TASK>
>    __bpf_prog_enter_recur+0xed/0x1e0
>    bpf_trampoline_6442545468+0x72/0xe3
>    bpf_fentry_test1+0x9/0x20
>    bpf_prog_test_run_tracing+0x183/0x3e0
>    __sys_bpf+0xd3f/0x38f0
>    ...
> 
> Assisted-by: Claude:unspecified
> Signed-off-by: Florent Revest (Anthropic) <florent.revest@linux.dev>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260926135605.1217928-1-florent.revest@linux.dev?part=3


  reply	other threads:[~2026-09-26 14:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26 13:55 [PATCH bpf v5 0/3] bpf: Fix use-after-free of progs detached from busy trampolines Florent Revest (Anthropic)
2026-09-26 13:55 ` [PATCH bpf v5 1/3] bpf: Wait for an RCU tasks grace period before freeing trampoline progs Florent Revest (Anthropic)
2026-09-26 14:07   ` sashiko-bot
2026-09-27 20:41   ` bot+bpf-ci
2026-09-28  8:50     ` Florent Revest
2026-09-26 13:55 ` [PATCH bpf v5 2/3] bpf: Skip detached progs in trampoline images that are still in use Florent Revest (Anthropic)
2026-09-26 14:09   ` sashiko-bot
2026-09-26 13:56 ` [PATCH bpf v5 3/3] selftests/bpf: Detach a trampoline prog while a task sleeps before it Florent Revest (Anthropic)
2026-09-26 14:01   ` sashiko-bot [this message]
2026-09-29  6:20 ` [PATCH bpf v5 0/3] bpf: Fix use-after-free of progs detached from busy trampolines patchwork-bot+netdevbpf

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=20260926140147.E77C11F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=florent.revest@linux.dev \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox