diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2023-10-12 09:40:48 +0200 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2023-10-23 18:21:22 +0200 |
commit | 0f1a14e0348eb48e93e139af569944349b725f3f (patch) | |
tree | e76242c33e4f818976ddd4048b777b495fb66e6e /arch/s390 | |
parent | 64ea33fb09f8fdcc9eb9f253906886a5801bb48a (diff) | |
download | linux-0f1a14e0348eb48e93e139af569944349b725f3f.tar.gz linux-0f1a14e0348eb48e93e139af569944349b725f3f.tar.bz2 linux-0f1a14e0348eb48e93e139af569944349b725f3f.zip |
s390/mm,fault: simplify kfence fault handling
do_no_context() can be simplified by removing its fault parameter,
which is only used to decide if kfence_handle_page_fault() should be
called.
If the fault happened within the kernel space it is ok to always check
if this happened on a page which was unmapped because of the kfence
feature. Limiting the check to the VM_FAULT_BADCONTEXT case doesn't
add any value.
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/mm/fault.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 9ed979690665..e0dbc231828c 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -234,7 +234,7 @@ static void do_sigsegv(struct pt_regs *regs, int si_code) force_sig_fault(SIGSEGV, si_code, (void __user *)get_fault_address(regs)); } -static void do_no_context(struct pt_regs *regs, vm_fault_t fault) +static void do_no_context(struct pt_regs *regs) { enum fault_type fault_type; unsigned long address; @@ -243,7 +243,7 @@ static void do_no_context(struct pt_regs *regs, vm_fault_t fault) if (fixup_exception(regs)) return; fault_type = get_fault_type(regs); - if ((fault_type == KERNEL_FAULT) && (fault == VM_FAULT_BADCONTEXT)) { + if (fault_type == KERNEL_FAULT) { address = get_fault_address(regs); is_write = fault_is_write(regs); if (kfence_handle_page_fault(address, is_write, regs)) @@ -279,28 +279,28 @@ static void do_fault_error(struct pt_regs *regs, vm_fault_t fault) } fallthrough; case VM_FAULT_BADCONTEXT: - do_no_context(regs, fault); + do_no_context(regs); break; case VM_FAULT_SIGNAL: if (!user_mode(regs)) - do_no_context(regs, fault); + do_no_context(regs); break; default: /* fault & VM_FAULT_ERROR */ if (fault & VM_FAULT_OOM) { if (!user_mode(regs)) - do_no_context(regs, fault); + do_no_context(regs); else pagefault_out_of_memory(); } else if (fault & VM_FAULT_SIGSEGV) { /* Kernel mode? Handle exceptions or die */ if (!user_mode(regs)) - do_no_context(regs, fault); + do_no_context(regs); else do_sigsegv(regs, SEGV_MAPERR); } else if (fault & VM_FAULT_SIGBUS) { /* Kernel mode? Handle exceptions or die */ if (!user_mode(regs)) - do_no_context(regs, fault); + do_no_context(regs); else do_sigbus(regs); } else { @@ -497,7 +497,7 @@ void do_protection_exception(struct pt_regs *regs) * Low-address protection in kernel mode means * NULL pointer write access in kernel mode. */ - return do_no_context(regs, VM_FAULT_BADACCESS); + return do_no_context(regs); } if (unlikely(MACHINE_HAS_NX && teid.b56)) { regs->int_parm_long = (teid.addr * PAGE_SIZE) | (regs->psw.addr & PAGE_MASK); |