Re: [PATCH 06/20] signal/sh: Use force_sig(SIGKILL) instead of do_group_exit(SIGKILL)

From: Kees Cook
Date: Thu Oct 21 2021 - 12:09:02 EST


On Wed, Oct 20, 2021 at 12:43:52PM -0500, Eric W. Biederman wrote:
> Today the sh code allocates memory the first time a process uses
> the fpu. If that memory allocation fails, kill the affected task
> with force_sig(SIGKILL) rather than do_group_exit(SIGKILL).
>
> Calling do_group_exit from an exception handler can potentially lead
> to dead locks as do_group_exit is not designed to be called from
> interrupt context. Instead use force_sig(SIGKILL) to kill the
> userspace process. Sending signals in general and force_sig in
> particular has been tested from interrupt context so there should be
> no problems.
>
> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>
> Cc: Rich Felker <dalias@xxxxxxxx>
> Cc: linux-sh@xxxxxxxxxxxxxxx
> Fixes: 0ea820cf9bf5 ("sh: Move over to dynamically allocated FPU context.")
> Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>

Looks sane; there should be no observable changes.

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook