]> git.baikalelectronics.ru Git - kernel.git/commit
s390/kvm: fix deadlock when killed by oom
authorClaudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Mon, 16 Jul 2018 08:38:57 +0000 (10:38 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 16 Jul 2018 13:45:46 +0000 (15:45 +0200)
commit5097fea292e56566f89feecf3a190c31093d0958
treee34652294fbd68c5ce5bc935bff8b4915e83adb6
parent31d9c48ba153e8698782cdc51dd44696354adc5c
s390/kvm: fix deadlock when killed by oom

When the oom killer kills a userspace process in the page fault handler
while in guest context, the fault handler fails to release the mm_sem
if the FAULT_FLAG_RETRY_NOWAIT option is set. This leads to a deadlock
when tearing down the mm when the process terminates. This bug can only
happen when pfault is enabled, so only KVM clients are affected.

The problem arises in the rare cases in which handle_mm_fault does not
release the mm_sem. This patch fixes the issue by manually releasing
the mm_sem when needed.

Fixes: d6f1ea10d5f94 ("KVM: s390: Add FAULT_FLAG_RETRY_NOWAIT for guest fault")
Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/mm/fault.c