lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <79d0e1894ffbfe4945ccf6aff7aa6564334e2600.camel@gmail.com>
Date: Wed, 27 Aug 2025 03:21:54 -0700
From: Eduard Zingerman <eddyz87@...il.com>
To: Feng Yang <yangfeng59949@....com>
Cc: andrii@...nel.org, ast@...nel.org, bpf@...r.kernel.org,
 daniel@...earbox.net, 	haoluo@...gle.com, john.fastabend@...il.com,
 jolsa@...nel.org, kpsingh@...nel.org, 	linux-kernel@...r.kernel.org,
 linux-kselftest@...r.kernel.org, 	llvm@...ts.linux.dev,
 martin.lau@...ux.dev, sdf@...ichev.me, song@...nel.org, 
	yonghong.song@...ux.dev
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix the invalid operand for
 instruction issue

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);
>  }
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ