Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 For cpu_jump_onfault() in data_abor...



details:   https://anonhg.NetBSD.org/src/rev/3e9588237db1
branches:  trunk
changeset: 955889:3e9588237db1
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Oct 15 22:30:34 2020 +0000

description:
For cpu_jump_onfault() in data_abort_handler(), stop returning
hard-coded EFAULT and use return value from uvm_fault() instead.

There are some paths that do not call uvm_fault():

(1) For fatalabort case, use EFAULT as before.
(2) When va range is invalid, use EFAULT instead of EINVAL.

These change fixes bytes_transfer_eof_* tests in
sys/lib/libc/sys/t_ptrace_wait*.

Note that without (2) above, some tests like
sys/lib/libc/sys/t_wait:write_error become newly failing.

I've confirmed that there's no new regression in full ATF run.

OK ryo

diffstat:

 sys/arch/aarch64/aarch64/fault.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r e4719fe2516d -r 3e9588237db1 sys/arch/aarch64/aarch64/fault.c
--- a/sys/arch/aarch64/aarch64/fault.c  Thu Oct 15 22:15:08 2020 +0000
+++ b/sys/arch/aarch64/aarch64/fault.c  Thu Oct 15 22:30:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fault.c,v 1.19 2020/08/09 07:26:20 skrll Exp $ */
+/*     $NetBSD: fault.c,v 1.20 2020/10/15 22:30:34 rin Exp $   */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.19 2020/08/09 07:26:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.20 2020/10/15 22:30:34 rin Exp $");
 
 #include "opt_compat_netbsd32.h"
 #include "opt_ddb.h"
@@ -134,7 +134,7 @@
        vaddr_t va;
        uint32_t esr, fsc, rw;
        vm_prot_t ftype;
-       int error = 0, len;
+       int error = EFAULT, len;
        const bool user = IS_SPSR_USER(tf->tf_spsr) ? true : false;
        bool is_pan_trap = false;
 
@@ -169,10 +169,8 @@
                map = &p->p_vmspace->vm_map;
                UVMHIST_LOG(pmaphist, "use user vm_map %p (kernel_map=%p)",
                   map, kernel_map, 0, 0);
-       } else {
-               error = EINVAL;
+       } else
                goto do_fault;
-       }
 
        if ((eclass == ESR_EC_INSN_ABT_EL0) || (eclass == ESR_EC_INSN_ABT_EL1))
                ftype = VM_PROT_EXECUTE;
@@ -223,7 +221,7 @@
        if (curcpu()->ci_intr_depth == 0) {
                fb = cpu_disable_onfault();
                if (fb != NULL) {
-                       cpu_jump_onfault(tf, fb, EFAULT);
+                       cpu_jump_onfault(tf, fb, error);
                        return;
                }
        }



Home | Main Index | Thread Index | Old Index