um: defer killing userspace on page table update failures
authorJohannes Berg <johannes.berg@intel.com>
Wed, 13 Jan 2021 21:08:03 +0000 (22:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:42 +0000 (11:38 +0100)
commit833f5208b142f52584e7eaec3081533edcbc3ddf
tree413d7b3e80a2f66906406ff642fc1150e33bb938
parent63a069b81d40b7684e959f1073cf5eae2f812c5a
um: defer killing userspace on page table update failures

commit a7d48886cacf8b426e0079bca9639d2657cf2d38 upstream.

In some cases we can get to fix_range_common() with mmap_sem held,
and in others we get there without it being held. For example, we
get there with it held from sys_mprotect(), and without it held
from fork_handler().

Avoid any issues in this and simply defer killing the task until
it runs the next time. Do it on the mm so that another task that
shares the same mm can't continue running afterwards.

Cc: stable@vger.kernel.org
Fixes: 468f65976a8d ("um: Fix hung task in fix_range_common()")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/um/include/shared/skas/mm_id.h
arch/um/kernel/tlb.c
arch/um/os-Linux/skas/process.c