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:   Thu, 25 Apr 2019 01:38:06 +1000
From:   Aleksa Sarai <cyphar@...har.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Andy Lutomirski <luto@...nel.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        Jeff Layton <jlayton@...nel.org>,
        "J. Bruce Fields" <bfields@...ldses.org>,
        Arnd Bergmann <arnd@...db.de>,
        David Howells <dhowells@...hat.com>,
        Eric Biederman <ebiederm@...ssion.com>,
        Jann Horn <jannh@...gle.com>,
        Christian Brauner <christian@...uner.io>,
        David Drysdale <drysdale@...gle.com>,
        Tycho Andersen <tycho@...ho.ws>,
        Linux Containers <containers@...ts.linux-foundation.org>,
        Linux FS Devel <linux-fsdevel@...r.kernel.org>,
        Linux API <linux-api@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Chanho Min <chanho.min@....com>,
        Oleg Nesterov <oleg@...hat.com>, Aleksa Sarai <asarai@...e.de>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [PATCH RESEND v5 0/5] namei: vfs flags to restrict path
 resolution

On 2019-04-23, Kees Cook <keescook@...omium.org> wrote:
> On Mon, Mar 25, 2019 at 6:05 AM Aleksa Sarai <cyphar@...har.com> wrote:
> > On 2019-03-21, Andy Lutomirski <luto@...nel.org> wrote:
> > > On Wed, Mar 20, 2019 at 7:38 AM Aleksa Sarai <cyphar@...har.com> wrote:
> > > > Now that the holiday break is over, it's time to re-send this patch
> > > > series (with a few additions, due to new information we got from
> > > > CVE-2019-5736 -- which this patchset mostly protected against but had
> > > > some holes with regards to #!-style scripts).
> > >
> > > I generally like this, but, as Linus pointed out, it will be
> > > unfortunate if application authors see this as just another
> > > non-portable weird Linux API and don't use it.  Would it be worthwhile
> > > to put some thought into making it an API that other OSes might be
> > > willing to implement?  As it stands, the openat(2) flags are getting
> > > rather crazy in this patch set.
> 
> I think many of the issues are specific to Linux (and Linux containers
> especially), so I'm not sure this should get blocked because we want
> something more portable.

I agree these issues are quite Linux-specific (*especially* the ability
to re-open fds through /proc and the existence of "magic links").

However, I feel there are a few more good reasons for resolveat(2):

 * openat(2) ignores unknown flags, meaning that old kernels will ignore
   new programs trying to use O_THISROOT and might end up causing
   security issues. Yes, it'd be trivial to check whether the new O_*
   flags are supported at start-up, but I think a security feature
   shouldn't have a foot-gun associated with it. In fact, I didn't know
   openat(2) ignored unknown flags until I wrote this patchset -- I
   doubt many other userspace developers do either.

 * resolveat(2) allows for improvement to the O_PATH interface, which I
   think might be necessary (completely separately to this patchset).
   I've been working on a patchset which would make nd_jump_link()
   transitions in trailing_symlink() depend on the mode of the magic
   link being traversed through (this would allow us to block a
   read-only fd being re-opened as a read-write fd or similar such
   nonsense). One aspect of this could be to allow userspace to enable
   certain re-opening operations by passing a "link mode" to
   resolveat(2).

 * I would argue that O_PATH should've been a separate syscall from the
   beginning, given how different its semantics are to other openat(2)
   flags (not to mention how O_PATH is incompatible with and thus
   ignores so many other openat(2) flags).

 * If we end up needing a resolveat(2) for any of the above reasons,
   then we will have wasted quite a few openat(2) flag slots for naught.
   (Then again, there are plenty of flag slots still left.)

All of that aside, what I'd really like to know is what I should do to
get this patchset reviewed and merged. It's been largely radio-silence
for the last few revisions.

A simple resolveat(2) is fairly trivial (I have a version of it lying
around somewhere), but it doesn't make sense to polish it if there's no
chance Al is interested in it.

> This series provides solutions to so many different race and confusion
> issues, I'd really like to see it land. What's the next step here? Is
> this planned to go directly to Linus for v5.2, or is it going to live
> in -mm for a while? I'd really like to see this moving forward.

Given some of the security requirements of this interface, I think
getting it to live in -mm wouldn't be a bad idea so folks can shake the
bugs out before it's depended on by container runtimes.

-- 
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ