Re: [PATCH v2 01/24] exec: Move unshare_files to fix posix file locking during exec

From: Al Viro
Date: Mon Dec 07 2020 - 18:36:47 EST


On Mon, Dec 07, 2020 at 05:07:55PM -0600, Eric W. Biederman wrote:

> My mistake. I missed that the actual code was highly optimized and only
> safe in the presence of an unshared files struct.

That's a polite way to spell "overoptimized for no good reason" ;-)

> What I saw and what I thought the comment was talking about was that the
> result of the test isn't guaranteed to be stable without having an
> exclusive access to the files. I figured and if something changes later
> and it becomes safe to pass the file name to a script later we don't
> really care.
>
> In any event thank you for the review. I will queue up a follow on
> patch that makes this use get_close_on_exec.

I would rather put that switch to get_close_on_exec() first in the queue
(or fold it into this patch)...