signal/sh: Use force_sig(SIGKILL) instead of do_group_exit(SIGKILL)
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 20 Oct 2021 17:43:52 +0000 (12:43 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 13:04:24 +0000 (14:04 +0100)
commita4cbf00e5ab8022f45ffc93c10feced1b2334892
tree7ef1db162c95eefb79177131f3ccb1af547c8d43
parentb04c17acf42ad96ade2c34d7892a6b0bd034b37f
signal/sh: Use force_sig(SIGKILL) instead of do_group_exit(SIGKILL)

[ Upstream commit ce0ee4e6ac99606f3945f4d47775544edc3f7985 ]

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@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Fixes: 0ea820cf9bf5 ("sh: Move over to dynamically allocated FPU context.")
Link: https://lkml.kernel.org/r/20211020174406.17889-6-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/sh/kernel/cpu/fpu.c