linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Aleksa Sarai <asarai@suse.de>
Cc: viro@zeniv.linux.org.uk, ebiederm@xmission.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	cyphar@cyphar.com, dev@opencontainers.org
Subject: Re: [PATCH] fs: exec: apply CLOEXEC before changing dumpable task flags
Date: Tue, 20 Dec 2016 18:29:56 +0100	[thread overview]
Message-ID: <20161220172955.GA7776@redhat.com> (raw)
In-Reply-To: <20161220110457.22254-1-asarai@suse.de>

On 12/20, Aleksa Sarai wrote:
>
> @@ -1287,6 +1287,13 @@ void setup_new_exec(struct linux_binprm * bprm)
>  	/* This is the point of no return */
>  	current->sas_ss_sp = current->sas_ss_size = 0;
>  
> +	/*
> +	 * We have to apply CLOEXEC before we change whether the process is
> +	 * dumpable to avoid a race with a process in userspace trying to access
> +	 * the should-be-closed file descriptors of a process undergoing exec(2).
> +	 */
> +	do_close_on_exec(current->files);

Cosmetic, but perhaps this should go into flush_old_exec() then?

But I am fine either way, up to you.

Oleg.

  reply	other threads:[~2016-12-20 17:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 11:04 [PATCH] fs: exec: apply CLOEXEC before changing dumpable task flags Aleksa Sarai
2016-12-20 17:29 ` Oleg Nesterov [this message]
2016-12-21  5:04   ` Aleksa Sarai

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=20161220172955.GA7776@redhat.com \
    --to=oleg@redhat.com \
    --cc=asarai@suse.de \
    --cc=cyphar@cyphar.com \
    --cc=dev@opencontainers.org \
    --cc=ebiederm@xmission.com \
    --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;
as well as URLs for NNTP newsgroup(s).