From: Eduard Zingerman <eddyz87@gmail.com>
To: Feng Yang <yangfeng59949@163.com>
Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
daniel@iogearbox.net, haoluo@google.com,
john.fastabend@gmail.com, jolsa@kernel.org, kpsingh@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
llvm@lists.linux.dev, martin.lau@linux.dev, sdf@fomichev.me,
song@kernel.org, yonghong.song@linux.dev
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix the invalid operand for instruction issue
Date: Wed, 27 Aug 2025 03:21:54 -0700 [thread overview]
Message-ID: <79d0e1894ffbfe4945ccf6aff7aa6564334e2600.camel@gmail.com> (raw)
In-Reply-To: <20250827082452.1381181-1-yangfeng59949@163.com>
On Wed, 2025-08-27 at 16:24 +0800, Feng Yang wrote:
[...]
> I don't know much about assembly language. Could you tell me if the following changes are correct?
Looks correct, should be similar to verifier_search_pruning.c:short_loop1().
Unfortunately, I'm afraid that the best source for assembly syntax doc
are llvm backend tests and sources, e.g.:
- https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/BPF/assembler-disassembler.s
- https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/BPF/assembler-disassembler-v4.s
- https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/BPF/BPFInstrInfo.td
The directives should gas compatible (subset supported by llvm):
- https://sourceware.org/binutils/docs/as/8byte.html
> diff --git a/tools/testing/selftests/bpf/progs/compute_live_registers.c b/tools/testing/selftests/bpf/progs/compute_live_registers.c
> index 6884ab99a421..01d73ad76faf 100644
> --- a/tools/testing/selftests/bpf/progs/compute_live_registers.c
> +++ b/tools/testing/selftests/bpf/progs/compute_live_registers.c
> @@ -249,11 +249,13 @@ __naked void if3_jset_bug(void)
> asm volatile (
> "r0 = 1;"
> "r2 = 2;"
> - "if r1 & 0x7 goto +1;"
> + ".8byte %[jset];" /* same as 'if r1 & 0x7 goto +1;' */
> "exit;"
> "r0 = r2;"
> "exit;"
> - ::: __clobber_all);
> + :
> + : __imm_insn(jset, BPF_JMP_IMM(BPF_JSET, BPF_REG_1, 0x7, 1))
> + : __clobber_all);
> }
>
prev parent reply other threads:[~2025-08-27 10:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 3:15 [PATCH bpf-next] selftests/bpf: Fix the invalid operand for instruction issue Feng Yang
2025-08-27 4:03 ` Alexei Starovoitov
2025-08-27 4:48 ` Eduard Zingerman
2025-08-27 8:24 ` Feng Yang
2025-08-27 10:21 ` Eduard Zingerman [this message]
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=79d0e1894ffbfe4945ccf6aff7aa6564334e2600.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yangfeng59949@163.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 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.