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] [thread-next>] [day] [month] [year] [list]
Message-ID: <6AADFAC011213A4C87B956458587ADB4021FE16C@dggeml532-mbs.china.huawei.com>
Date:   Tue, 30 Apr 2019 05:11:45 +0000
From:   "weiyongjun (A)" <weiyongjun1@...wei.com>
To:     Cong Wang <xiyou.wangcong@...il.com>,
        "Michael S. Tsirkin" <mst@...hat.com>
CC:     yuehaibing <yuehaibing@...wei.com>,
        David Miller <davem@...emloft.net>,
        Jason Wang <jasowang@...hat.com>,
        Eric Dumazet <edumazet@...gle.com>,
        "Jesper Dangaard Brouer" <brouer@...hat.com>,
        "Li,Rongqing" <lirongqing@...du.com>,
        Nicolas Dichtel <nicolas.dichtel@...nd.com>,
        Chas Williams <3chas3@...il.com>,
        "wangli39@...du.com" <wangli39@...du.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: RE: [PATCH] tun: Fix use-after-free in tun_net_xmit

> Network Developers <netdev@...r.kernel.org>
> Subject: Re: [PATCH] tun: Fix use-after-free in tun_net_xmit
> 
> On Mon, Apr 29, 2019 at 7:55 AM Michael S. Tsirkin <mst@...hat.com>
> wrote:
> > The problem seems real enough, but an extra synchronize_net on
> tun_attach
> > might be a problem, slowing guest startup significantly.
> > Better ideas?
> 
> Yes, I proposed the following patch in the other thread.
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index e9ca1c088d0b..31c3210288cb 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -3431,6 +3431,7 @@ static int tun_chr_open(struct inode *inode,
> struct file * file)
>         file->private_data = tfile;
>         INIT_LIST_HEAD(&tfile->next);
> 
> +       sock_set_flag(&tfile->sk, SOCK_RCU_FREE);
>         sock_set_flag(&tfile->sk, SOCK_ZEROCOPY);
> 
>         return 0;


This patch should not work. The key point is that when detach the queue
with index is equal to tun->numqueues - 1, we do not clear the point
in tun->tfiles:

static void __tun_detach(...)
{
...
        **** if index == tun->numqueues - 1, nothing changed ****
        rcu_assign_pointer(tun->tfiles[index],
                                                tun->tfiles[tun->numqueues - 1]);
....
}

And after tfile free, xmit have change to get and use the freed file point.

Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ