diff options
-rw-r--r-- | regress/sys/kern/ptrace/ptrace.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/copy.S | 30 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/trap.c | 4 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/trap.c | 3 |
4 files changed, 17 insertions, 24 deletions
diff --git a/regress/sys/kern/ptrace/ptrace.c b/regress/sys/kern/ptrace/ptrace.c index cb88f4e5b17..74a6d5b56d8 100644 --- a/regress/sys/kern/ptrace/ptrace.c +++ b/regress/sys/kern/ptrace/ptrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ptrace.c,v 1.4 2017/09/06 04:20:12 guenther Exp $ */ +/* $OpenBSD: ptrace.c,v 1.5 2017/09/16 02:03:40 guenther Exp $ */ /* * Copyright (c) 2005 Artur Grabowski <art@openbsd.org> * @@ -132,7 +132,7 @@ main(int argc, char **argv) if (ptrace(PT_IO, pid, (caddr_t)&piod, 0) == -1) { warn("ptrace(PT_IO)"); - if (errno == EACCES) + if (errno == EFAULT) ret = 1; else ret = -1; diff --git a/sys/arch/amd64/amd64/copy.S b/sys/arch/amd64/amd64/copy.S index c3ba96af9e1..5f7f37aa429 100644 --- a/sys/arch/amd64/amd64/copy.S +++ b/sys/arch/amd64/amd64/copy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: copy.S,v 1.10 2017/08/25 19:28:48 guenther Exp $ */ +/* $OpenBSD: copy.S,v 1.11 2017/09/16 02:03:40 guenther Exp $ */ /* $NetBSD: copy.S,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /* @@ -107,10 +107,10 @@ ENTRY(copyout) movq %rdi,%rdx addq %rax,%rdx - jc _C_LABEL(copy_efault) + jc _C_LABEL(copy_fault) movq $VM_MAXUSER_ADDRESS,%r8 cmpq %r8,%rdx - ja _C_LABEL(copy_efault) + ja _C_LABEL(copy_fault) movq CPUVAR(CURPCB),%rdx leaq _C_LABEL(copy_fault)(%rip),%r11 @@ -145,10 +145,10 @@ ENTRY(copyin) movq %rsi,%rdx addq %rax,%rdx - jc _C_LABEL(copy_efault) + jc _C_LABEL(copy_fault) movq $VM_MAXUSER_ADDRESS,%r8 cmpq %r8,%rdx - ja _C_LABEL(copy_efault) + ja _C_LABEL(copy_fault) 3: /* bcopy(%rsi, %rdi, %rax); */ movq %rax,%rcx @@ -171,13 +171,11 @@ ENTRY(copyin) xorl %eax,%eax ret -NENTRY(copy_efault) - movq $EFAULT,%rax - NENTRY(copy_fault) SMAP_CLAC movq CPUVAR(CURPCB),%rdx popq PCB_ONFAULT(%rdx) + movl $EFAULT,%eax ret ENTRY(copyoutstr) @@ -194,7 +192,7 @@ ENTRY(copyoutstr) */ movq $VM_MAXUSER_ADDRESS,%rax subq %rdi,%rax - jbe _C_LABEL(copystr_efault) /* die if CF == 1 || ZF == 1 */ + jbe _C_LABEL(copystr_fault) /* die if CF == 1 || ZF == 1 */ cmpq %rdx,%rax jae 1f movq %rax,%rdx @@ -217,8 +215,8 @@ ENTRY(copyoutstr) 2: /* rdx is zero -- return EFAULT or ENAMETOOLONG. */ movq $VM_MAXUSER_ADDRESS,%r11 cmpq %r11,%rdi - jae _C_LABEL(copystr_efault) - movq $ENAMETOOLONG,%rax + jae _C_LABEL(copystr_fault) + movl $ENAMETOOLONG,%eax jmp copystr_return ENTRY(copyinstr) @@ -236,7 +234,7 @@ ENTRY(copyinstr) */ movq $VM_MAXUSER_ADDRESS,%rax subq %rsi,%rax - jbe _C_LABEL(copystr_efault) /* die if CF == 1 || ZF == 1 */ + jbe _C_LABEL(copystr_fault) /* die if CF == 1 || ZF == 1 */ cmpq %rdx,%rax jae 1f movq %rax,%rdx @@ -259,14 +257,12 @@ ENTRY(copyinstr) 2: /* edx is zero -- return EFAULT or ENAMETOOLONG. */ movq $VM_MAXUSER_ADDRESS,%r11 cmpq %r11,%rsi - jae _C_LABEL(copystr_efault) - movq $ENAMETOOLONG,%rax + jae _C_LABEL(copystr_fault) + movl $ENAMETOOLONG,%eax jmp copystr_return -ENTRY(copystr_efault) - movl $EFAULT,%eax - ENTRY(copystr_fault) + movl $EFAULT,%eax copystr_return: SMAP_CLAC /* Set *lencopied and return %eax. */ diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index d60398dd3a3..726bea4394e 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.57 2017/08/25 19:28:48 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.58 2017/09/16 02:03:40 guenther Exp $ */ /* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */ /*- @@ -211,10 +211,8 @@ trap(struct trapframe *frame) goto we_re_toast; /* Check for copyin/copyout fault. */ if (pcb->pcb_onfault != 0) { - error = EFAULT; copyfault: frame->tf_rip = (u_int64_t)pcb->pcb_onfault; - frame->tf_rax = error; return; } diff --git a/sys/arch/arm64/arm64/trap.c b/sys/arch/arm64/arm64/trap.c index 537cd199515..5e14cfd87b5 100644 --- a/sys/arch/arm64/arm64/trap.c +++ b/sys/arch/arm64/arm64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.10 2017/08/14 21:53:34 kettenis Exp $ */ +/* $OpenBSD: trap.c,v 1.11 2017/09/16 02:03:40 guenther Exp $ */ /*- * Copyright (c) 2014 Andrew Turner * All rights reserved. @@ -210,7 +210,6 @@ data_abort(struct trapframe *frame, uint64_t esr, int lower, int exe) } else { if (curcpu()->ci_idepth == 0 && pcb->pcb_onfault != 0) { - frame->tf_x[0] = error; frame->tf_elr = (register_t)pcb->pcb_onfault; return; } |