[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19414.1559579426@warthog.procyon.org.uk>
Date: Mon, 03 Jun 2019 17:30:26 +0100
From: David Howells <dhowells@...hat.com>
To: Casey Schaufler <casey@...aufler-ca.com>
Cc: dhowells@...hat.com, Jann Horn <jannh@...gle.com>,
Al Viro <viro@...iv.linux.org.uk>, raven@...maw.net,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
linux-block@...r.kernel.org, keyrings@...r.kernel.org,
linux-security-module <linux-security-module@...r.kernel.org>,
kernel list <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH 3/7] vfs: Add a mount-notification facility
Casey Schaufler <casey@...aufler-ca.com> wrote:
> >> should be used. Someone or something caused the event. It can
> >> be important who it was.
> > The kernel's normal security model means that you should be able to
> > e.g. accept FDs that random processes send you and perform
> > read()/write() calls on them without acting as a subject in any
> > security checks; let alone close().
>
> Passed file descriptors are an anomaly in the security model
> that (in this developer's opinion) should have never been
> included. More than one of the "B" level UNIX systems disabled
> them outright.
Considering further on this, I think the only way to implement what you're
suggesting is to add a field to struct file to record the last fputter's creds
as the procedure of fputting is offloaded to a workqueue.
Note that's last fputter, not the last closer, as we don't track the number of
open fds linked to a file struct.
In the case of AF_UNIX sockets that contain in-the-process-of-being-passed fds
at the time of closure, this is further complicated by the socket fput being
achieved in the work item - thereby adding layers of indirection.
It might be possible to replace f_cred rather than adding a new field, but
that might get used somewhere after that point.
Note also that fsnotify_close() doesn't appear to use the last fputter's path
since it's not available if called from deferred fput.
David
Powered by blists - more mailing lists