netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	YueHaibing <yuehaibing@huawei.com>,
	"weiyongjun (A)" <weiyongjun1@huawei.com>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH net V2] tuntap: synchronize through tfiles array instead of tun->numqueues
Date: Thu, 9 May 2019 20:55:28 +0800	[thread overview]
Message-ID: <79cefeef-f7b9-e97f-2e81-cdb2c73b5767@redhat.com> (raw)
In-Reply-To: <CAM_iQpV+FMvXQDO8o9=x90ybT87OWrSthaxt6soJ_Mhug=vSzA@mail.gmail.com>


On 2019/5/9 下午1:34, Cong Wang wrote:
> On Tue, May 7, 2019 at 7:54 PM Jason Wang <jasowang@redhat.com> wrote:
>> This is only true if you can make sure tfile[tun->numqueues] is not
>> freed. Either my patch or SOCK_RCU_FREE can solve this, but for
>> SOCK_RCU_FREE we need do extra careful audit to make sure it doesn't
>> break someting. So synchronize through pointers in tfiles[] which is
>> already protected by RCU is much more easier. It can make sure no
>> dereference from xmit path after synchornize_net(). And this matches the
>> assumptions of the codes after synchronize_net().
>>
> It is hard to tell which sock_put() matches with this synchronize_net()
> given the call path is complicated.
>
> With SOCK_RCU_FREE, no such a problem, all sock_put() will be safe.
> So to me SOCK_RCU_FREE is much easier to understand and audit.


The problem is not tfile itself but the data structure associated. As I 
mentioned earlier, the xdp_rxq_info_unreg() looks racy if tun_net_xmit() 
can read stale value of numqueues. It's just one example, we may meet 
similar issues in the future when adding more features.

Thanks


>
> Thanks.

  reply	other threads:[~2019-05-09 12:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07  4:03 [PATCH net V2] tuntap: synchronize through tfiles array instead of tun->numqueues Jason Wang
2019-05-07  4:54 ` Cong Wang
2019-05-07  6:19   ` Jason Wang
2019-05-07 14:41     ` Cong Wang
2019-05-08  2:54       ` Jason Wang
2019-05-09  5:34         ` Cong Wang
2019-05-09 12:55           ` Jason Wang [this message]
2019-05-08  4:16 ` Michael S. Tsirkin
2019-05-08  4:30   ` Jason Wang
2019-05-08 17:36 ` David Miller
2019-05-09  3:16   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79cefeef-f7b9-e97f-2e81-cdb2c73b5767@redhat.com \
    --to=jasowang@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=weiyongjun1@huawei.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).