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]
Date:   Thu, 9 Mar 2023 12:26:02 +0000
From:   Angus Chen <angus.chen@...uarmicro.com>
To:     Yunsheng Lin <linyunsheng@...wei.com>,
        "mst@...hat.com" <mst@...hat.com>,
        "jasowang@...hat.com" <jasowang@...hat.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "hawk@...nel.org" <hawk@...nel.org>,
        "john.fastabend@...il.com" <john.fastabend@...il.com>
CC:     "virtualization@...ts.linux-foundation.org" 
        <virtualization@...ts.linux-foundation.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Subject: RE: [PATCH] virtio_net: Use NETDEV_TX_BUSY when has no buf to send

Hi 

> -----Original Message-----
> From: Yunsheng Lin <linyunsheng@...wei.com>
> Sent: Thursday, March 9, 2023 6:53 PM
> To: Angus Chen <angus.chen@...uarmicro.com>; mst@...hat.com;
> jasowang@...hat.com; davem@...emloft.net; edumazet@...gle.com;
> kuba@...nel.org; pabeni@...hat.com; ast@...nel.org; daniel@...earbox.net;
> hawk@...nel.org; john.fastabend@...il.com
> Cc: virtualization@...ts.linux-foundation.org; netdev@...r.kernel.org;
> linux-kernel@...r.kernel.org; bpf@...r.kernel.org; Xuan Zhuo
> <xuanzhuo@...ux.alibaba.com>
> Subject: Re: [PATCH] virtio_net: Use NETDEV_TX_BUSY when has no buf to send
> 
> On 2023/3/9 15:49, Angus Chen wrote:
> > Don't consume skb if virtqueue_add return -ENOSPC.
> 
> Is this fixing the same out of space problem caused by
> xdp xmit as Xuan Zhuo is fixing, or it is fixing a different
> case?
Yes, the same print info.
> 
> https://lore.kernel.org/netdev/20230308071921-mutt-send-email-mst@kernel.
> org/T/#mc4c5766a59fb8be988bb6a4dfa48f49e58df3ea6
> 
En,I haven't noticed this patch before.
> >
> > Signed-off-by: Angus Chen <angus.chen@...uarmicro.com>
> > ---
> >  drivers/net/virtio_net.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index fb5e68ed3ec2..4096ea3d2eb6 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -1980,7 +1980,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb,
> struct net_device *dev)
> >  				 qnum, err);
> >  		dev->stats.tx_dropped++;
> >  		dev_kfree_skb_any(skb);
> 
> Returning NETDEV_TX_BUSY will caused stack to requeue the skb
> and send it again when space is available, but you have freed the skb here,
> isn't this cause use-after-free problem?
Yes,you are right, would be crash after I tested more times .I will drop it,thank you.
> 
> > -		return NETDEV_TX_OK;
> > +		return (err == -ENOSPC) ? NETDEV_TX_BUSY : NETDEV_TX_OK;
> >  	}
> >
> >  	/* Don't wait up for transmitted skbs to be freed. */
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ