[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161220172955.GA7776@redhat.com>
Date: Tue, 20 Dec 2016 18:29:56 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Aleksa Sarai <asarai@...e.de>
Cc: viro@...iv.linux.org.uk, ebiederm@...ssion.com,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
cyphar@...har.com, dev@...ncontainers.org
Subject: Re: [PATCH] fs: exec: apply CLOEXEC before changing dumpable task
flags
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.
Powered by blists - more mailing lists