Re: [PATCH v2 4/5] exec: Move exec_mmap right after de_thread in flush_old_exec
From: Bernd Edlinger
Date: Mon Mar 09 2020 - 15:52:45 EST
On 3/9/20 8:45 PM, Eric W. Biederman wrote:
> Bernd Edlinger <bernd.edlinger@xxxxxxxxxx> writes:
>
>> On 3/8/20 10:38 PM, Eric W. Biederman wrote:
>>>
>>> This consolidation allows the creation of a mutex to replace
>>> cred_guard_mutex that is not held of possible indefinite userspace
>>
>> can you also reword this "held of" thing here as well?
>
> Done:
>
> exec: Move exec_mmap right after de_thread in flush_old_exec
>
> I have read through the code in exec_mmap and I do not see anything
> that depends on sighand or the sighand lock, or on signals in anyway
> so this should be safe.
>
> This rearrangement of code has two siginficant benefits. It makes
watch out: sig_i_nificant
> the determination of passing the point of no return by testing bprm->mm
> accurate. All failures prior to that point in flush_old_exec are
> either truly recoverable or they are fatal.
>
> Futher this consolidates all of the possible indefinite waits for
Add some r to "Futher", please?
> userspace together at the top of flush_old_exec. The possible wait
> for a ptracer on PTRACE_EVENT_EXIT, the possible wait for a page fault
> to be resolved in clear_child_tid, and the possible wait for a page
> fault in exit_robust_list.
>
> This consolidation allows the creation of a mutex to replace
> cred_guard_mutex that is not held over possible indefinite userspace
> waits. Which will allow removing deadlock scenarios from the kernel.
>
> Reviewed-by: Bernd Edlinger <bernd.edlinger@xxxxxxxxxx>
> Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
>
> Eric
>