[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpUvv5yMZYecaKeiThfoUqqK1Lwvn0gi8KLAeksUxDEyLA@mail.gmail.com>
Date: Tue, 30 Apr 2019 16:33:28 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: YueHaibing <yuehaibing@...wei.com>
Cc: Jason Wang <jasowang@...hat.com>,
"weiyongjun (A)" <weiyongjun1@...wei.com>,
David Miller <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
"Li,Rongqing" <lirongqing@...du.com>,
nicolas dichtel <nicolas.dichtel@...nd.com>,
Chas Williams <3chas3@...il.com>, wangli39@...du.com,
LKML <linux-kernel@...r.kernel.org>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH] tun: Fix use-after-free in tun_net_xmit
On Mon, Apr 29, 2019 at 7:44 PM YueHaibing <yuehaibing@...wei.com> wrote:
>
> With SOCK_RCU_FREE tfile is ok ,
>
> but tfile->sk is freed by sock_put in __tun_detach, it will trgger
SOCK_RCU_FREE is exactly for sock and for sock_put(),
you need to look into sock_put() path to see where SOCK_RCU_FREE
is tested.
>
> use-after-free in tun_net_xmit if tun->numqueues check passed.
Why do you believe we still have use-after-free with SOCK_RCU_FREE?
tun_net_xmit() holds RCU read lock, so with SOCK_RCU_FREE,
the sock won't be freed until tun_net_xmit() releases RCU read lock.
This is just how RCU works...
Powered by blists - more mailing lists