Skip to content

Commit df39038

Browse files
gerald-schaeferVasily Gorbik
authored andcommitted
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: [email protected] # 6.6+ Fixes: af19487 ("mm: make PTE_MARKER_SWAPIN_ERROR more general") Reported-by: Yunseong Kim <[email protected]> Tested-by: Yunseong Kim <[email protected]> Acked-by: Alexander Gordeev <[email protected]> Signed-off-by: Gerald Schaefer <[email protected]> Message-ID: <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 275d05c commit df39038

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
@@ -433,12 +433,13 @@ static void do_exception(struct pt_regs *regs, int access)
433433
handle_fault_error_nolock(regs, 0);
434434
else
435435
do_sigsegv(regs, SEGV_MAPERR);
436-
} else if (fault & VM_FAULT_SIGBUS) {
436+
} else if (fault & (VM_FAULT_SIGBUS | VM_FAULT_HWPOISON)) {
437437
if (!user_mode(regs))
438438
handle_fault_error_nolock(regs, 0);
439439
else
440440
do_sigbus(regs);
441441
} else {
442+
pr_emerg("Unexpected fault flags: %08x\n", fault);
442443
BUG();
443444
}
444445
}

0 commit comments

Comments
 (0)