Subject: Re: [PATCH bpf] bpf: sockmap, fix skb refcnt race after locking changes

From: Jiri Olsa <[email-masked]>
Date: Sat, 2 Sep 2023 19:28:28 +0200

On Sat, Sep 02, 2023 at 12:24:01AM +0300, Eduard Zingerman wrote:

SNIP

> > >  static void sk_psock_skb_state(struct sk_psock *psock,
> > > @@ -685,9 +691,7 @@ static void sk_psock_backlog(struct work_struct *work)
> > >  		} while (len);
> > >  
> > >  		skb = skb_dequeue(&psock->ingress_skb);
> > > -		if (!ingress) {
> > > -			kfree_skb(skb);
> > > -		}
> > > +		kfree_skb(skb);
> > >  	}
> > >  end:
> > >  	mutex_unlock(&psock->work_mutex);
> > > -- 
> > > 2.33.0
> > > 
> > 
> > there's no crash wit with fix, but I noticed I occasionally get FAIL
> > 
> 
> Please note this patch:
> https://lore.kernel.org/bpf/[email-masked]/
> Which should fix the test in question.

ah right it does, thanks

Tested-by: Jiri Olsa <[email-masked]>

jirka

> 
> > #212/78  sockmap_listen/sockmap Unix test_unix_redir:OK
> > ./test_progs:vsock_unix_redir_connectible:1501: ingress: write: Transport endpoint is not connected
> > vsock_unix_redir_connectible:FAIL:1501
> > ./test_progs:vsock_unix_redir_connectible:1501: egress: write: Transport endpoint is not connected
> > vsock_unix_redir_connectible:FAIL:1501
> > #212/79  sockmap_listen/sockmap VSOCK test_vsock_redir:FAIL
> > #212/80  sockmap_listen/sockhash IPv4 TCP test_insert_invalid:OK
> > 
> > no idea if it's related
> > 
> > jirka
>