From: Eduard Zingerman <eddyz87@gmail.com>
To: Yonghong Song <yonghong.song@linux.dev>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH bpf-next v3 2/2] selftests/bpf: Add tests with stack ptr register in conditional jmp
Date: Wed, 21 May 2025 14:03:04 -0700 [thread overview]
Message-ID: <m27c29d6d3.fsf@gmail.com> (raw)
In-Reply-To: <5761ffe9-fc09-4f06-9311-0eed40a693fb@linux.dev> (Yonghong Song's message of "Wed, 21 May 2025 13:57:53 -0700")
Yonghong Song <yonghong.song@linux.dev> writes:
[...]
> It does not interact with subprogram due the patch 1. Without patch 1,
> the error will happen (see commit message of patch 1):
>
> 0: (18) r3 = 0x0 ; R3_w=0
> 2: (85) call pc+2
> caller:
> R10=fp0
> callee:
> frame1: R1=ctx() R3_w=0 R10=fp0
> 5: frame1: R1=ctx() R3_w=0 R10=fp0
> ; asm volatile (" \ @ verifier_precision.c:184
> 5: (18) r2 = 0x20202000256c6c78 ; frame1: R2_w=0x20202000256c6c78
> 7: (05) goto pc+0
> 8: (bd) if r2 <= r10 goto pc+3 ; frame1: R2_w=0x20202000256c6c78 R10=fp0
> 9: (35) if r1 >= 0xffe3fff8 goto pc+0 ; frame1: R1=ctx()
> 10: (b5) if r2 <= 0x8 goto pc+0
> mark_precise: frame1: last_idx 10 first_idx 0 subseq_idx -1
> mark_precise: frame1: regs=r2 stack= before 9: (35) if r1 >= 0xffe3fff8 goto pc+0
> mark_precise: frame1: regs=r2 stack= before 8: (bd) if r2 <= r10 goto pc+3
> mark_precise: frame1: regs=r2,r10 stack= before 7: (05) goto pc+0
> mark_precise: frame1: regs=r2,r10 stack= before 5: (18) r2 = 0x20202000256c6c78
> mark_precise: frame1: regs=r10 stack= before 2: (85) call pc+2
> BUG regs 400
I see, in that case it is a useful test case, thank you.
[...]
>> - both src and dst registers are pointers to stack
>
> I actually thought about this as well, e.g.,
> r2 = r10
> r3 = r10
> if r2 <= r3 goto +0
> if r2 <= 8 goto +0
>
> But since r2 is actually a stack pointer, then r2 does not need
> backtracking. So r2 <= r3 won't be backtracked too.
>
> But if you feel such an example still valuable, I can add it too.
Makes sense, thank you for explaining.
next prev parent reply other threads:[~2025-05-21 21:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 17:04 [PATCH bpf-next v3 1/2] bpf: Do not include stack ptr register in precision backtracking bookkeeping Yonghong Song
2025-05-21 17:04 ` [PATCH bpf-next v3 2/2] selftests/bpf: Add tests with stack ptr register in conditional jmp Yonghong Song
2025-05-21 19:02 ` Eduard Zingerman
2025-05-21 20:57 ` Yonghong Song
2025-05-21 21:03 ` Eduard Zingerman [this message]
2025-05-21 18:55 ` [PATCH bpf-next v3 1/2] bpf: Do not include stack ptr register in precision backtracking bookkeeping Eduard Zingerman
2025-05-21 20:34 ` Yonghong Song
2025-05-21 20:58 ` Eduard Zingerman
2025-05-21 21:35 ` Yonghong Song
2025-05-21 21:59 ` Eduard Zingerman
2025-05-21 22:04 ` Eduard Zingerman
2025-05-21 22:38 ` Andrii Nakryiko
2025-05-21 22:49 ` Eduard Zingerman
2025-05-22 2:53 ` Yonghong Song
2025-05-22 20:05 ` Andrii Nakryiko
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=m27c29d6d3.fsf@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--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 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.