Re: [PATCH v2 bpf-next 2/2] selftests/bpf: Add tests for BPF_NEG range tracking logic

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

 




> On Jun 24, 2025, at 3:18 PM, Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
> 
> On Tue, 2025-06-24 at 15:00 -0700, Song Liu wrote:
> 
> [...]
> 
>> +SEC("lsm.s/socket_connect")
>> +__success __log_level(2)
>> +__msg("0: (b7) r0 = 1")
>> +__msg("1: (84) w0 = -w0")
> 
> Sorry, my previous comment probably was ambiguous.
> What I meant is that you can match verifier output for "w0 = -w0 ; R0=-1",
> thus checking that inferred value for "w0".

Ah, I removed that part because I found some other __msg doesn’t have
the whole line. Let me add it back. 

Thanks,
Song

> 
>> +__msg("mark_precise: frame0: last_idx 2 first_idx 0 subseq_idx -1")
>> +__msg("mark_precise: frame0: regs=r0 stack= before 1: (84) w0 = -w0")
>> +__msg("mark_precise: frame0: regs=r0 stack= before 0: (b7) r0 = 1")
>> +__naked int bpf_neg_2(void)
>> +{
>> + /*
>> + * lsm.s/socket_connect requires a return value within [-4095, 0].
>> + * Returning -1 is allowed
>> + */
>> + asm volatile (
>> + "r0 = 1;"
>> + "w0 = -w0;"
>> + "exit;"
>> + ::: __clobber_all);
>> +}
> 
> [...]





[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