On 3/2/23 6:23 PM, Alexei Starovoitov wrote: > On Thu, Mar 2, 2023 at 3:19 PM Dave Marchevsky <davemarchevsky@xxxxxx> wrote: >> >> --- a/tools/testing/selftests/bpf/progs/rbtree_fail.c >> +++ b/tools/testing/selftests/bpf/progs/rbtree_fail.c >> @@ -232,8 +232,9 @@ long rbtree_api_first_release_unlock_escape(void *ctx) >> >> bpf_spin_lock(&glock); >> res = bpf_rbtree_first(&groot); >> - if (res) >> - n = container_of(res, struct node_data, node); >> + if (!res) >> + return -1; > > The verifier cannot be ok with this return... I hope... > FWIW it's because the test expects verification failure and the branch taken by verifier produces the expected message before evaluating other branch and complaining about retval: 0: R1=ctx(off=0,imm=0) R10=fp0 ; bpf_spin_lock(&glock); 0: (18) r1 = 0xffff888103c70320 ; R1_w=map_value(off=16,ks=4,vs=40,imm=0) 2: (85) call bpf_spin_lock#93 ; ; res = bpf_rbtree_first(&groot); 3: (18) r1 = 0xffff888103c70310 ; R1_w=map_value(off=0,ks=4,vs=40,imm=0) 5: (85) call bpf_rbtree_first#121960 6: (bf) r6 = r0 ; R0_w=ptr_or_null_node_data(id=1,non_own_ref,off=16,imm=0) R6_w=ptr_or_null_node_data(id=1,non_own_ref,off=16,imm=0) 7: (b7) r0 = -1 ; R0_w=-1 ; if (!res) 8: (15) if r6 == 0x0 goto pc+14 ; R6_w=ptr_node_data(non_own_ref,off=16,imm=0) ; bpf_spin_unlock(&glock); 9: (18) r1 = 0xffff888103c70320 ; R1_w=map_value(off=16,ks=4,vs=40,imm=0) 11: (85) call bpf_spin_unlock#94 ; ; bpf_spin_lock(&glock); 12: (18) r1 = 0xffff888103c70320 ; R1_w=map_value(off=16,ks=4,vs=40,imm=0) 14: (85) call bpf_spin_lock#93 ; ; bpf_rbtree_remove(&groot, &n->node); 15: (18) r1 = 0xffff888103c70310 ; R1_w=map_value(off=0,ks=4,vs=40,imm=0) 17: (bf) r2 = r6 ; R2_w=scalar(id=2) R6=scalar(id=2) 18: (85) call bpf_rbtree_remove#121964 rbtree_remove node input must be non-owning ref Regardless, fixed in v2 >> + n = container_of(res, struct node_data, node); >> bpf_spin_unlock(&glock);