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: <CAHA+R7N7kF9=qACWrnfpR2N5F+nbmnZTvA9+c79x7-RFX5Aang@mail.gmail.com>
Date:	Thu, 30 Jul 2015 11:29:08 -0700
From:	Cong Wang <cwang@...pensource.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Sowmini Varadhan <sowmini.varadhan@...cle.com>,
	netdev <netdev@...r.kernel.org>,
	ajaykumar.hotchandani@...cle.com,
	"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH RFC net-next 3/3] net/core/sock.c: sk_clone_lock() should
 only do get_net() if the parent is not a kernel socket

On Thu, Jul 30, 2015 at 6:06 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> On Thu, 2015-07-30 at 04:55 -0400, Sowmini Varadhan wrote:
>> The newsk returned by sk_clone_lock should hold a get_net()
>> reference if, and only if, the parent is not a kernel socket
>> (making this similar to sk_alloc()).
>>
>> E.g,. for the SYN_RECV call path, tcp_v4_syn_recv_sock->..inet_csk_clone_lock
>> sets up the syn_recv newsk from sk_clone_lock. When the parent (listen)
>> socket is a kernel socket (defined in sk_alloc() as having
>> sk_net_refcnt == 0), then the newsk should also have a 0 sk_net_refcnt
>> and should not hold a get_net() reference.
>>
>> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@...cle.com>
>> ---
>>  net/core/sock.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/core/sock.c b/net/core/sock.c
>> index 08f16db..371d1b7 100644
>> --- a/net/core/sock.c
>> +++ b/net/core/sock.c
>> @@ -1497,7 +1497,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
>>               sock_copy(newsk, sk);
>>
>>               /* SANITY */
>> -             get_net(sock_net(newsk));
>> +             if (likely(newsk->sk_net_refcnt))
>> +                     get_net(sock_net(newsk));
>>               sk_node_init(&newsk->sk_node);
>>               sock_lock_init(newsk);
>>               bh_lock_sock(newsk);
>
> CC Eric Biederman
>
> It looks this should be submitted for 'net' tree, not 'net-next'
>

It only affects TCP kernel sockets, and we only have few use cases in tree,
and it looks like dlm does its own ->accpet(), so net-next should be fine.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ