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: <8783c94cb802ade8a45cdf4233fe3b7341cca5c9.camel@decadent.org.uk>
Date:   Fri, 24 Apr 2020 16:13:22 +0100
From:   Ben Hutchings <ben@...adent.org.uk>
To:     Solar Designer <solar@...nwall.com>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Al Viro <viro@...iv.linux.org.uk>,
        Kees Cook <keescook@...omium.org>,
        Salvatore Mesoraca <s.mesoraca16@...il.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 3.16 208/245] namei: allow restricted O_CREAT of FIFOs
 and regular files

On Fri, 2020-04-24 at 15:52 +0200, Solar Designer wrote:
> On Fri, Apr 24, 2020 at 12:07:15AM +0100, Ben Hutchings wrote:
> > 3.16.83-rc1 review patch.  If anyone has any objections, please let me know.
> 
> I do.  This patch is currently known-buggy, see this thread:
> 
> https://www.openwall.com/lists/oss-security/2020/01/28/2
> 
> It is (partially) fixed with these newer commits in 5.5 and 5.5.2:
> 
> commit d0cb50185ae942b03c4327be322055d622dc79f6
> Author: Al Viro <viro@...iv.linux.org.uk>
> Date:   Sun Jan 26 09:29:34 2020 -0500
> 
>     do_last(): fetch directory ->i_mode and ->i_uid before it's too late
>     
>     may_create_in_sticky() call is done when we already have dropped the
>     reference to dir.
>     
>     Fixes: 30aba6656f61e (namei: allow restricted O_CREAT of FIFOs and regular files)
>     Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> 
> commit d76341d93dedbcf6ed5a08dfc8bce82d3e9a772b
> Author: Al Viro <viro@...iv.linux.org.uk>
> Date:   Sat Feb 1 16:26:45 2020 +0000
> 
>     vfs: fix do_last() regression
>     
>     commit 6404674acd596de41fd3ad5f267b4525494a891a upstream.
[...]
> At least inclusion of the above fixes is mandatory for any backports.

I know, and those are the next 2 patches in the series.

> Also, I think no one has fixed the logic of may_create_in_sticky() so
> that it wouldn't unintentionally apply the "protection" when the file
> is neither a FIFO nor a regular file (something I found and mentioned in
> the oss-security posting above).
[...]
> I think the implementation of may_create_in_sticky() should be rewritten
> such that it'd directly correspond to the textual description in the
> comment above.  As we've seen, trying to write the code "more optimally"
> resulted in its logic actually being different from the description.
> 
> Meanwhile, I think backporting known-so-buggy code is a bad idea.

I can see that it's not quite right, but does it matter in practice? 
Directories and symlinks are handled separately; sockets can't be
opened anyway; block and character devices wonn't normally appear in a
sticky directory.

Ben.

-- 
Ben Hutchings
Knowledge is power.  France is bacon.



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