All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Anton Protopopov <a.s.protopopov@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/2] bpf: Enforce gotox targets against subprog bounds
Date: Sun, 21 Jun 2026 08:20:33 -0700	[thread overview]
Message-ID: <2b32c86c-ec24-4fad-951c-4f915364692e@linux.dev> (raw)
In-Reply-To: <20260613-f01-02-gotox-bpf-next-v2-send-v2-1-ff980bc5a329@mails.tsinghua.edu.cn>



On 6/13/26 2:33 AM, Nuoqi Gui wrote:
> CFG construction records the modeled gotox target set in
> insn_aux_data->jt. It includes INSN_ARRAY maps based on whether the map
> target is in the current subprog. check_indirect_jump() later validates and
> follows the current PTR_TO_INSN register's actual INSN_ARRAY map. The
> verifier does not check that targets copied from that map stay inside the
> same subprog as the gotox instruction.
>
> This lets one gotox instruction observe two different INSN_ARRAY maps. CFG
> can select a map whose target is in the current subprog. Another path to
> the same gotox can carry a PTR_TO_INSN value from a map whose target points
> at a different subprog. The verifier then accepts a cross-subprog edge that
> CFG construction did not allow for this gotox instruction.
>
> On x86, gotox becomes a raw indirect jump in the JIT image. Accepting a
> target outside the gotox subprog can enter another subprog without a
> matching BPF call frame and crash when executed. Validation observed a GPF
> in bpf_test_run().
>
> Fix this by requiring every target copied from the actual PTR_TO_INSN
> map to stay within the subprog that contains the current gotox instruction.
> Reject the program before pushing verifier states for any cross-subprog
> target.
>
> Fixes: 493d9e0d6083 ("bpf, x86: add support for indirect jumps")
> Signed-off-by: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>

Acked-by: Yonghong Song <yonghong.song@linux.dev>


  reply	other threads:[~2026-06-21 15:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 15:03 [PATCH bpf-next 0/2] bpf: Fix gotox target validation against CFG Nuoqi Gui
2026-06-09 15:03 ` [PATCH bpf-next 1/2] " Nuoqi Gui
2026-06-09 15:13   ` sashiko-bot
2026-06-09 15:42   ` bot+bpf-ci
2026-06-09 15:56   ` Anton Protopopov
2026-06-09 17:27     ` Eduard Zingerman
2026-06-10 12:22     ` Nuoqi Gui
2026-06-09 15:03 ` [PATCH bpf-next 2/2] selftests/bpf: Add cross-subprog gotox target coverage Nuoqi Gui
2026-06-09 15:40   ` sashiko-bot
2026-06-09 15:42   ` bot+bpf-ci
2026-06-09 16:14   ` Anton Protopopov
2026-06-13  9:33 ` [PATCH bpf-next v2 0/2] bpf: Enforce gotox targets against subprog bounds Nuoqi Gui
2026-06-13  9:33   ` [PATCH bpf-next v2 1/2] " Nuoqi Gui
2026-06-21 15:20     ` Yonghong Song [this message]
2026-06-13  9:33   ` [PATCH bpf-next v2 2/2] selftests/bpf: Add cross-subprog gotox target coverage Nuoqi Gui
2026-06-13 10:08     ` bot+bpf-ci
2026-06-21 15:21     ` Yonghong Song

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=2b32c86c-ec24-4fad-951c-4f915364692e@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=a.s.protopopov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=gnq25@mails.tsinghua.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /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.