RE: sock_create_kern() and (lack of) get_net()

2017-05-04 Thread David Laight
From: Cong Wang > Sent: 03 May 2017 17:33 > On Wed, May 3, 2017 at 4:39 AM, David Laight wrote: > > I suspect that many of the sockets created with 'kern=1' are not 'special' > > and should hold a reference to the namespace. > > They are special if they are created in

Re: sock_create_kern() and (lack of) get_net()

2017-05-03 Thread Cong Wang
On Wed, May 3, 2017 at 4:39 AM, David Laight wrote: > I suspect that many of the sockets created with 'kern=1' are not 'special' > and should hold a reference to the namespace. They are special if they are created in net init, which means they have the same life-time

sock_create_kern() and (lack of) get_net()

2017-05-03 Thread David Laight
sock_create_kern() passes 'kern=1' to __sock_create(). sock_create() passes 'kern=0' and uses current->nsproxy->ns_net. The 'kern' parameter is passed to security_socket_create() and security_socket_post_create() - I think this is just checking whether the call is allowed. The 'kern' parameter