public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Anton Protopopov <a.s.protopopov@gmail.com>
To: Xu Kuohai <xukuohai@huaweicloud.com>
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Yonghong Song <yonghong.song@linux.dev>,
	Puranjay Mohan <puranjay@kernel.org>
Subject: Re: [PATCH bpf-next v4 1/4] bpf: Fix an off-by-one error in check_indirect_jump
Date: Wed, 14 Jan 2026 10:29:44 +0000	[thread overview]
Message-ID: <aWdwGKLsL7G7IQ3z@mail.gmail.com> (raw)
In-Reply-To: <20260114093914.2403982-2-xukuohai@huaweicloud.com>

On 26/01/14 05:39PM, Xu Kuohai wrote:
> From: Xu Kuohai <xukuohai@huawei.com>
> 
> Fix an off-by-one error in check_indirect_jump() that skips the last
> element returned by copy_insn_array_uniq().
> 
> Fixes: 493d9e0d6083 ("bpf, x86: add support for indirect jumps")
> Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
> ---
>  kernel/bpf/verifier.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index faa1ecc1fe9d..22605d9e0ffa 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -20336,7 +20336,7 @@ static int check_indirect_jump(struct bpf_verifier_env *env, struct bpf_insn *in
>  		return -EINVAL;
>  	}
>  
> -	for (i = 0; i < n - 1; i++) {
> +	for (i = 0; i < n; i++) {
>  		other_branch = push_stack(env, env->gotox_tmp_buf->items[i],
>  					  env->insn_idx, env->cur_state->speculative);
>  		if (IS_ERR(other_branch))
> -- 
> 2.47.3

Nack, the last state doesn't require a push_stack() call, it is
verified directly under this loop. Instead of this patch, just
add another call to mark_indirect_target().


  reply	other threads:[~2026-01-14 10:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14  9:39 [PATCH bpf-next v4 0/4] emit ENDBR/BTI instructions for indirect jump targets Xu Kuohai
2026-01-14  9:39 ` [PATCH bpf-next v4 1/4] bpf: Fix an off-by-one error in check_indirect_jump Xu Kuohai
2026-01-14 10:29   ` Anton Protopopov [this message]
2026-01-15  7:31     ` Xu Kuohai
2026-01-14  9:39 ` [PATCH bpf-next v4 2/4] bpf: Add helper to detect indirect jump targets Xu Kuohai
2026-01-14 11:00   ` Anton Protopopov
2026-01-15  7:37     ` Xu Kuohai
2026-01-14 20:46   ` Eduard Zingerman
2026-01-15  7:47     ` Xu Kuohai
2026-01-18 17:20       ` Alexei Starovoitov
2026-01-18 23:22         ` Kumar Kartikeya Dwivedi
2026-01-19  2:35         ` Xu Kuohai
2026-01-14  9:39 ` [PATCH bpf-next v4 3/4] bpf, x86: Emit ENDBR for " Xu Kuohai
2026-01-14 16:46   ` kernel test robot
2026-01-14  9:39 ` [PATCH bpf-next v4 4/4] bpf, arm64: Emit BTI for indirect jump target Xu Kuohai

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=aWdwGKLsL7G7IQ3z@mail.gmail.com \
    --to=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=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=puranjay@kernel.org \
    --cc=xukuohai@huaweicloud.com \
    --cc=yonghong.song@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