Skip to content

Commit 7a8c6bb

Browse files
committed
s390/mm: Fix VM_FAULT_HWPOISON handling in do_exception()
JIRA: https://issues.redhat.com/browse/RHEL-74362 Tested: by me Conflicts: due b20c821 patchset not being backported commit df39038 Author: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Date: Mon Jul 15 20:04:16 2024 +0200 s390/mm: Fix VM_FAULT_HWPOISON handling in do_exception() There is no support for HWPOISON, MEMORY_FAILURE, or ARCH_HAS_COPY_MC on s390. Therefore we do not expect to see VM_FAULT_HWPOISON in do_exception(). However, since commit af19487 ("mm: make PTE_MARKER_SWAPIN_ERROR more general"), it is possible to see VM_FAULT_HWPOISON in combination with PTE_MARKER_POISONED, even on architectures that do not support HWPOISON otherwise. In this case, we will end up on the BUG() in do_exception(). Fix this by treating VM_FAULT_HWPOISON the same as VM_FAULT_SIGBUS, similar to x86 when MEMORY_FAILURE is not configured. Also print unexpected fault flags, for easier debugging. Note that VM_FAULT_HWPOISON_LARGE is not expected, because s390 cannot support swap entries on other levels than PTE level. Cc: stable@vger.kernel.org # 6.6+ Fixes: af19487 ("mm: make PTE_MARKER_SWAPIN_ERROR more general") Reported-by: Yunseong Kim <yskelg@gmail.com> Tested-by: Yunseong Kim <yskelg@gmail.com> Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Message-ID: <20240715180416.3632453-1-gerald.schaefer@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
1 parent b2cf20d commit 7a8c6bb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/s390/mm/fault.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,14 @@ static void do_fault_error(struct pt_regs *regs, vm_fault_t fault)
307307
do_no_context(regs);
308308
else
309309
do_sigsegv(regs, SEGV_MAPERR);
310-
} else if (fault & VM_FAULT_SIGBUS) {
310+
} else if (fault & (VM_FAULT_SIGBUS | VM_FAULT_HWPOISON)) {
311311
/* Kernel mode? Handle exceptions or die */
312312
if (!user_mode(regs))
313313
do_no_context(regs);
314314
else
315315
do_sigbus(regs);
316316
} else {
317+
pr_emerg("Unexpected fault flags: %08x\n", fault);
317318
BUG();
318319
}
319320
break;

0 commit comments

Comments
 (0)