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: <110296A8-1CC9-456C-B126-50C90D4E3E17@xmission.com>
Date:	Tue, 12 May 2015 03:55:19 -0500
From:	"Eric W. Biederman" <ebiederm@...ssion.com>
To:	David Laight <David.Laight@...LAB.COM>,
	"davem@...emloft.net" <davem@...emloft.net>
CC:	Ying Xue <ying.xue@...driver.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"cwang@...pensource.com" <cwang@...pensource.com>,
	"xemul@...nvz.org" <xemul@...nvz.org>,
	"eric.dumazet@...il.com" <eric.dumazet@...il.com>,
	"maxk@....qualcomm.com" <maxk@....qualcomm.com>,
	"stephen@...workplumber.org" <stephen@...workplumber.org>,
	"tgraf@...g.ch" <tgraf@...g.ch>,
	"nicolas.dichtel@...nd.com" <nicolas.dichtel@...nd.com>,
	"tom@...bertland.com" <tom@...bertland.com>,
	"jchapman@...alix.com" <jchapman@...alix.com>,
	"erik.hugne@...csson.com" <erik.hugne@...csson.com>,
	"jon.maloy@...csson.com" <jon.maloy@...csson.com>,
	"horms@...ge.net.au" <horms@...ge.net.au>,
	Herbert Xu <herbert@...dor.apana.org.au>
Subject: RE: [PATCH 2/6] net: Add a struct net parameter to sock_create_kern



On May 12, 2015 3:24:11 AM CDT, David Laight <David.Laight@...LAB.COM> wrote:
>From: Eric W. Biederman
>> Sent: 09 May 2015 03:08
>>
>> This is long overdue, and is part of cleaning up how we allocate
>kernel
>> sockets that don't reference count struct net.
>...
>> diff --git a/net/socket.c b/net/socket.c
>> index b5f1f43ed8f4..9963a0b53a64 100644
>> --- a/net/socket.c
>> +++ b/net/socket.c
>> @@ -1210,9 +1210,9 @@ int sock_create(int family, int type, int
>protocol, struct socket **res)
>>  }
>>  EXPORT_SYMBOL(sock_create);
>> 
>> -int sock_create_kern(int family, int type, int protocol, struct
>socket **res)
>> +int sock_create_kern(struct net *net, int family, int type, int
>protocol, struct socket **res)
>>  {
>> -	return __sock_create(&init_net, family, type, protocol, res, 1);
>> +	return __sock_create(net, family, type, protocol, res, 1);
>>  }
>>  EXPORT_SYMBOL(sock_create_kern);
>
>Wouldn't it involve far less churn to add a new function that uses a
>non-default
>namespace?

The goal is comprehensible and maintainable kernel code.

Which network namespace your socket is in, is an important property and something you probably care about if you are creating kernel sockets.

Having a second function is more maintenance and results in harder to understand code.  A major fraction of the callers even before this change wanted to be outside the initial network namespace.

This change should have been made years ago, but unfortunately it was not.

>Changing the function prototype will a PITA for anyone doing back-ports
>of fixes.
>(And more so for anyone trying to get a driver to build against kernels
>that might have this change back-ported.)

Yep dealing with backports sucks, my sympathies.

Eric

 
--
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