Re: [PATCH 3/6] exec: Stop open coding mutex_lock_killable of cred_guard_mutex

From: Kees Cook
Date: Sat May 09 2020 - 01:08:41 EST


On Fri, May 08, 2020 at 01:45:25PM -0500, Eric W. Biederman wrote:
>
> Oleg modified the code that did
> "mutex_lock_interruptible(&current->cred_guard_mutex)" to return
> -ERESTARTNOINTR instead of -EINTR, so that userspace will never see a
> failure to grab the mutex.
>
> Slightly earlier Liam R. Howlett defined mutex_lock_killable for
> exactly the same situation but it does it a little more cleanly.
>
> Switch the code to mutex_lock_killable so that it is clearer what the
> code is doing.
>
> Ref: ad776537cc6b ("Add mutex_lock_killable")
> Ref: 793285fcafce ("cred_guard_mutex: do not return -EINTR to user-space")
> Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook