[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180917152817.GB25173@redhat.com>
Date: Mon, 17 Sep 2018 17:28:17 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Jeff Layton <jlayton@...nel.org>, viro@...iv.linux.org.uk,
berrange@...hat.com, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v3 3/3] exec: do unshare_files after de_thread
On 09/16, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@...hat.com> writes:
>
> > IOW. Lets ignore do_close_on_exec(), lets ignore the fact that unshare_fd()
> > can fail and thus it makes sense to call it before point-of-no-return.
> >
> > Any other reason why we can't simply call unshare_files() at the end of
> > __do_execve_file() on success?
>
> The reason we call we call unshare_files is in case the files are shared
> with another process. AKA old style linux threads, or someone being
> clever. In that case we need a private copy of files for close on exec
> because we should not close the files of the other process that has not
> called exec.
This is clear,
> The only reason for calling unshare_files before the point of no return
> is so that we can get a good error message to the calling process if
> unshare_files fails.
OK, so you too think there are no other reasons.
> AKA it would be reasonable to move unshare_files to just above
> do_close_on_exec in flush_old_exec. We could further make the
> unshare_files not return displaced and just drop it.
Yes, this is exactly what I had in mind.
Oleg.
Powered by blists - more mailing lists