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]
Date:   Tue, 14 Nov 2017 19:17:45 +0800
From:   Tonghao Zhang <xiangxia.m.yue@...il.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     张军伟(基础平台部) 
        <zhangjunweimartin@...ichuxing.com>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        张同浩(基础平台部) 
        <zhangtonghao@...ichuxing.com>
Subject: Re: [PATCH v2 net-next] socket: Move the socket inuse to namespace.

Hi cong, we increase the socket inuse in sk_allock ?

On Tue, Nov 14, 2017 at 1:58 PM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Mon, Nov 13, 2017 at 7:23 PM, 张军伟(基础平台部)
> <zhangjunweimartin@...ichuxing.com> wrote:
>>
>>> On 14 Nov 2017, at 10:09, Cong Wang <xiyou.wangcong@...il.com> wrote:
>>>
>>> On Mon, Nov 13, 2017 at 4:36 AM, Tonghao Zhang <xiangxia.m.yue@...il.com> wrote:
>>>> From: Tonghao Zhang <xiangxia.m.yue@...il.com>
>>>>
>>>> This patch add a member in struct netns_core. and this is
>>>> a counter for socket_inuse in the _net_ namespace. The patch
>>>> will add/sub counter in the sock_alloc or sock_release. In
>>>> the sock_alloc, the private data of inode saves the special
>>>> _net_. When releasing it, we can access the special _net_ and
>>>> dec the counter of socket in that namespace.
>>>>
>>>> By the way, we dont use the 'current->nsproxy->net_ns' in the
>>>> sock_release. In one case,when one task exits, the 'do_exit'
>>>> may set the current->nsproxy NULL, and then call the sock_release.
>>>> Use the private data of inode, saving few bytes.
>>>
>>> Why do you need to hold netns refcnt for socket? sock already holds
>>> it, so you can just access it by sock_net(sock->sk) ?
>> I think you suggestion is
>> replace get_net(net) ===> with sock_net(sock->sk)
>
> Not literally, but essentially yes.
>
>
>>
>> If thus, I think it could not work.
>> Because sock->sk is assigned after sock_alloc.
>> What we change is done in sock_alloc.
>
> You don't have to do it in sock_alloc().
>
>
>> By the way, sock->sk may has been released(NULL) in sock_release.
>
> My point is since sock is always paired with a sk and sk already
> holds refcnt, you don't need to hold it again, it looks unnecessary.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ