From: David Howells <dhowells@redhat.com>
To: Christian Brauner <christian@brauner.io>
Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] fs: make all new mount api fds cloexec by default
Date: Sat, 11 May 2019 09:40:29 +0100 [thread overview]
Message-ID: <9333.1557564029@warthog.procyon.org.uk> (raw)
In-Reply-To: <20190509155801.8369-1-christian@brauner.io>
Christian Brauner <christian@brauner.io> wrote:
> This makes all file descriptors returned from new syscalls of the new mount
> api cloexec by default.
>
> From a userspace perspective it is rarely the case that fds are supposed to
> be inherited across exec. Having them not cloexec by default forces
> userspace to remember to pass the <SPECIFIC>_CLOEXEC flag along or to
> invoke fcntl() on the fd to prevent leaking it. And leaking the fd is a
> much bigger issue than forgetting to remove the cloexec flag and failing to
> inherit the fd.
> For old fd types we can't break userspace. But for new ones we should
> whenever reasonable make them cloexec by default (Examples of this policy
> are the new seccomp notify fds and also pidfds.). If userspace wants to
> inherit fds across exec they can remove the O_CLOEXEC flag and so opt in to
> inheritance explicitly.
>
> This patch also has the advantage that we can get rid of all the special
> flags per file descriptor type for the new mount api. In total this lets us
> remove 4 flags:
> - FSMOUNT_CLOEXEC
> - FSOPEN_CLOEXEC
> - FSPICK_CLOEXEC
> - OPEN_TREE_CLOEXEC
>
> Signed-off-by: Christian Brauner <christian@brauner.io>
Fine by me.
Reviewed-by: David Howells <dhowells@redhat.com>
prev parent reply other threads:[~2019-05-11 8:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 15:58 [PATCH v2 1/2] fs: make all new mount api fds cloexec by default Christian Brauner
2019-05-09 15:58 ` [PATCH v2 2/2] fsopen: use square brackets around "fscontext" Christian Brauner
2019-05-11 8:40 ` David Howells
2019-05-11 8:40 ` David Howells [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9333.1557564029@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=christian@brauner.io \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox