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:	Wed, 20 Apr 2016 18:34:31 +0300
From:	Konstantin Khlebnikov <koct9i@...il.com>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>, security@...ian.org,
	"security@...nel.org" <security@...nel.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	"security@...ntu.com >> security" <security@...ntu.com>,
	Peter Hurley <peter@...leysoftware.com>,
	Serge Hallyn <serge.hallyn@...ntu.com>,
	Willy Tarreau <w@....eu>,
	Aurelien Jarno <aurelien@...el32.net>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
	Jann Horn <jann@...jh.net>, Greg KH <greg@...ah.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Jiri Slaby <jslaby@...e.com>, Florian Weimer <fw@...eb.enyo.de>
Subject: Re: [PATCH] devpts: Make each mount of devpts an independent filesystem.

On Wed, Apr 20, 2016 at 5:55 PM, Eric W. Biederman
<ebiederm@...ssion.com> wrote:
> Linus Torvalds <torvalds@...ux-foundation.org> writes:
>
>> On Tue, Apr 19, 2016 at 9:36 PM, Konstantin Khlebnikov <koct9i@...il.com> wrote:
>>> On Wed, Apr 20, 2016 at 6:04 AM, Eric W. Biederman
>>>>
>>>> The kernel.pty.reserve sysctl is neutered with no way currently
>>>> implemented to be able to use the reserved ptys.
>>>
>>> I think we could convert this into reserve for init user namespace,
>>> ssh in host will work even if containers eaten all ptys.
>>
>> Yes. That's basically how it effectively worked before (ie everything
>> but the initial non-newinstance devpts mount would be limited to the
>> non-reserved numbers).
>>
>> We required the non-init namespaces to do a newinstance mount, so the
>> whole test for "newinstance" was effectively the same thing as just
>> checking for the init namespace from a security standpoint.
>>
>> And in fact, rewriting it in that form (ie checking for init_ns) would
>> just make it much more obvious what the intent it.
>
> How does this sound.
>
> When mounting a devpts filesystem.  We look at the caller (aka current)
> and if we are in the initial mount namespace set a flag in fsi that
> allows that instance of devpts to draw into the reserve pool.

Maybe just check current user namespace when task opens /dev/ptmx?

IIRR now check looks like: count < limit - (newinstance ? reserved : 0).
So, it will be count < limit - (current_in_init_userns ? 0 : newinstance).

>
> That will still allow crazy pieces of code like xen-create-instance run
> by root that mount a devpts filesystem in a chroot environment to draw
> into the reserved pool, but any sane users that set up their own mount
> namespace won't be able to user the reserve pool.
>
> I believe that will give an almost identical policy to what we have
> today, and it certainly makes a good default test for a container.  Just
> for cleanliness containers (of anyone's definition) almost always use
> mount namespaces instead of chroots.
>
> Sigh one last past through all of the distros, to confirm that this
> works in practice.
>
> Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ