Re: [PATCH bpf-next 2/2] selftests/bpf: Range analysis test case for JSET

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 09, 2025 at 04:09:41PM -0700, Yonghong Song wrote:
> 
> 
> On 7/9/25 3:27 PM, Paul Chaignon wrote:

[...]

> > +SEC("socket")
> > +__description("dead branch on jset, does not result in invariants violation error")
> > +__success __log_level(2)
> > +__retval(0) __flag(BPF_F_TEST_REG_INVARIANTS)
> > +__naked void jset_range_analysis(void)
> > +{
> > +	asm volatile ("						\
> > +	call %[bpf_get_netns_cookie];				\
> > +	if r0 == 0 goto l0_%=;					\
> > +	.8byte %[jset]; /* if r0 & 0xffffffff goto +0 */	\
> 
> why not just use 'if r0 & 0xffffffff goto +0'? It will be equivelant to
> BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 0xffffffff, 0).

I was having issues with some older versions of LLVM. Some didn't
recognize jset instructions, some simply crashed. That said, the CI
seems to be fine, so let me switch this back to the simpler syntax.

> 
> > +l0_%=:	r0 = 0;							\
> > +	exit;							\
> > +"	:
> > +	: __imm(bpf_get_netns_cookie),
> > +	  __imm_insn(jset, BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 0xffffffff, 0))
> > +	: __clobber_all);
> > +}
> > +
> >   char _license[] SEC("license") = "GPL";
> 




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux