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:   Sat, 17 Mar 2018 11:43:28 -0400
From:   Jeff Layton <jlayton@...nel.org>
To:     Al Viro <viro@...IV.linux.org.uk>
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        "J. Bruce Fields" <bfields@...ldses.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Daniel P ." Berrangé <berrange@...hat.com>,
        Kate Stewart <kstewart@...uxfoundation.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Philippe Ombredanne <pombredanne@...b.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] locks: change POSIX lock ownership on execve when
 files_struct is displaced

On Sat, 2018-03-17 at 15:05 +0000, Al Viro wrote:
> On Sat, Mar 17, 2018 at 10:25:20AM -0400, Jeff Layton wrote:
> > From: Jeff Layton <jlayton@...hat.com>
> > 
> > POSIX mandates that open fds and their associated file locks should be
> > preserved across an execve. This works, unless the process is
> > multithreaded at the time that execve is called.
> > 
> > In that case, we'll end up unsharing the files_struct but the locks will
> > still have their fl_owner set to the address of the old one. Eventually,
> > when the other threads die and the last reference to the old
> > files_struct is put, any POSIX locks get torn down since it looks like
> > a close occurred on them.
> > 
> > The result is that all of your open files will be intact with none of
> > the locks you held before execve. The simple answer to this is "use OFD
> > locks", but this is a nasty surprise and it violates the spec.
> > 
> > On a successful execve, change ownership of any POSIX file_locks
> > associated with the old files_struct to the new one, if we ended up
> > swapping it out.
> 
> TBH, I don't like the way you implement that.  Why not simply use
> iterate_fd()?

Ahh, I wasn't aware of it. I copied the loop in change_lock_owners from
close_files. I'll have a look at iterate_fd().

Thanks,
-- 
Jeff Layton <jlayton@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ