All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: <bot+bpf-ci@kernel.org>, <florent.revest@linux.dev>,
	<bpf@vger.kernel.org>, <daniel@iogearbox.net>,
	<andrii@kernel.org>
Cc: <martin.lau@linux.dev>, <eddyz87@gmail.com>, <memxor@gmail.com>,
	<song@kernel.org>, <yonghong.song@linux.dev>, <jolsa@kernel.org>,
	<kpsingh@kernel.org>, <john.fastabend@gmail.com>,
	<leon.hwang@linux.dev>, <zirajs7@gmail.com>,
	<rhkrqnwk98@gmail.com>, <puranjay@kernel.org>,
	<xukuohai@huaweicloud.com>, <iii@linux.ibm.com>,
	<hbathini@linux.ibm.com>, <chleroy@kernel.org>,
	<naveen@kernel.org>, <bjorn@kernel.org>, <pulehui@huawei.com>,
	<yangtiezhu@loongson.cn>, <hengqi.chen@gmail.com>,
	<linux-kernel@vger.kernel.org>, <martin.lau@kernel.org>,
	<mason@kernel.org>, <ihor.solodrai@linux.dev>
Subject: Re: [PATCH bpf v4 2/3] bpf: Skip detached progs in trampoline images that are still in use
Date: Sat, 26 Sep 2026 08:44:13 +0000	[thread overview]
Message-ID: <DLP46AE97EYD.1I2HDPGBR8GME@gmail.com> (raw)
In-Reply-To: <6a6d43e6bada7a1433cd525c9ec31780ed9b2401c8834894defdf671601b2f1d@mail.kernel.org>

On Fri, Sep 25, 2026 at 10:47 AM bot+bpf-ci@kernel.org <bot+bpf-ci@kernel.org> wrote:
>> +	/* nops for move_imm+jirl, patched to skip this prog when it is detached */
>> +	for (i = 0; i < LOONGARCH_LONG_JUMP_NINSNS; i++)
>> +		emit_insn(ctx, nop);
>
> Can a task preempted inside the skip sled resume into half of the new jump
> sequence and jump to a garbage address?

[...]

> Could the LoongArch skip site use a single instruction instead? For
> example, a 'b' to the skip target, which is always within the +/-128MB
> range of the same image, patched from nop to 'b'. The rest of the sled
> would then be unnecessary.

Seems like a real bug. Same issue on riscv.

ip_after_call was patched in bpf_tramp_image_put() when the image was
already unreachable. Now bpf_trampoline_remove_prog() patches cur_image
before bpf_trampoline_update() replaces it, so every call of the traced
function goes through the sled while it is rewritten. stop_machine
doesn't help the task that it preempted in the middle of the sled.

Pls fix and respin.
Everything else looks good.

pw-bot: cr


  reply	other threads:[~2026-09-26  8:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 10:03 [PATCH bpf v4 0/3] bpf: Fix use-after-free of progs detached from busy trampolines Florent Revest (Anthropic)
2026-09-25 10:03 ` [PATCH bpf v4 1/3] bpf: Wait for an RCU tasks grace period before freeing trampoline progs Florent Revest (Anthropic)
2026-09-25 10:47   ` bot+bpf-ci
2026-09-26 13:54     ` Florent Revest
2026-09-25 10:03 ` [PATCH bpf v4 2/3] bpf: Skip detached progs in trampoline images that are still in use Florent Revest (Anthropic)
2026-09-25 10:47   ` bot+bpf-ci
2026-09-26  8:44     ` Alexei Starovoitov [this message]
2026-09-26 13:52       ` Florent Revest
2026-09-26 13:54     ` Florent Revest
2026-09-25 10:03 ` [PATCH bpf v4 3/3] selftests/bpf: Detach a trampoline prog while a task sleeps before it Florent Revest (Anthropic)

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=DLP46AE97EYD.1I2HDPGBR8GME@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chleroy@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=florent.revest@linux.dev \
    --cc=hbathini@linux.ibm.com \
    --cc=hengqi.chen@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=iii@linux.ibm.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=leon.hwang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=naveen@kernel.org \
    --cc=pulehui@huawei.com \
    --cc=puranjay@kernel.org \
    --cc=rhkrqnwk98@gmail.com \
    --cc=song@kernel.org \
    --cc=xukuohai@huaweicloud.com \
    --cc=yangtiezhu@loongson.cn \
    --cc=yonghong.song@linux.dev \
    --cc=zirajs7@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 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.