summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-09-20 11:57:19 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-09-20 11:57:19 +0000
commit624e32f8c16fadf2a7b72afa6a41835e9c1268f4 (patch)
treeb1a17c46e9aeada1a7fdbf4cddb5355e5b58f87f /sys/arch
parent6404b4e0d313b4c9cadb0d718b9f53189200db76 (diff)
Be much more careful about pcb_onfault.
Should solve 2026.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/locore.s42
-rw-r--r--sys/arch/i386/i386/trap.c6
2 files changed, 27 insertions, 21 deletions
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index d1d21d7b44a..9495db81f3b 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.57 2001/08/26 17:45:00 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.58 2001/09/20 11:57:18 art Exp $ */
/* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */
/*-
@@ -862,12 +862,11 @@ ENTRY(memcpy)
ENTRY(copyout)
pushl %esi
pushl %edi
- movl _curpcb,%eax
- movl $_copy_fault,PCB_ONFAULT(%eax)
+ pushl $0
- movl 12(%esp),%esi
- movl 16(%esp),%edi
- movl 20(%esp),%eax
+ movl 16(%esp),%esi
+ movl 20(%esp),%edi
+ movl 24(%esp),%eax
/*
* We check that the end of the destination buffer is not past the end
@@ -932,7 +931,10 @@ ENTRY(copyout)
jmp _copy_fault
#endif /* I386_CPU */
-3: /* bcopy(%esi, %edi, %eax); */
+3: movl _C_LABEL(curpcb),%edx
+ movl $_C_LABEL(copy_fault),PCB_ONFAULT(%edx)
+
+ /* bcopy(%esi, %edi, %eax); */
cld
movl %eax,%ecx
shrl $2,%ecx
@@ -942,12 +944,11 @@ ENTRY(copyout)
andb $3,%cl
rep
movsb
- xorl %eax,%eax
+ popl PCB_ONFAULT(%edx)
popl %edi
popl %esi
- movl _curpcb,%edx
- movl %eax,PCB_ONFAULT(%edx)
+ xorl %eax,%eax
ret
/*
@@ -957,12 +958,13 @@ ENTRY(copyout)
ENTRY(copyin)
pushl %esi
pushl %edi
- movl _curpcb,%eax
- movl $_copy_fault,PCB_ONFAULT(%eax)
+ movl _C_LABEL(curpcb),%eax
+ pushl $0
+ movl $_C_LABEL(copy_fault),PCB_ONFAULT(%eax)
- movl 12(%esp),%esi
- movl 16(%esp),%edi
- movl 20(%esp),%eax
+ movl 16(%esp),%esi
+ movl 20(%esp),%edi
+ movl 24(%esp),%eax
/*
* We check that the end of the destination buffer is not past the end
@@ -985,19 +987,19 @@ ENTRY(copyin)
andb $3,%cl
rep
movsb
- xorl %eax,%eax
+ movl _C_LABEL(curpcb),%edx
+ popl PCB_ONFAULT(%edx)
popl %edi
popl %esi
- movl _curpcb,%edx
- movl %eax,PCB_ONFAULT(%edx)
+ xorl %eax,%eax
ret
ENTRY(copy_fault)
+ movl _C_LABEL(curpcb),%edx
+ popl PCB_ONFAULT(%edx)
popl %edi
popl %esi
- movl _curpcb,%edx
- movl $0,PCB_ONFAULT(%edx)
movl $EFAULT,%eax
ret
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 6b0a502f528..4e40a39aae1 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.42 2001/09/13 14:37:52 art Exp $ */
+/* $OpenBSD: trap.c,v 1.43 2001/09/20 11:57:18 art Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -184,6 +184,7 @@ trap(frame)
int resume;
vm_prot_t vftype, ftype;
union sigval sv;
+ caddr_t onfault;
uvmexp.traps++;
@@ -464,7 +465,10 @@ trap(frame)
}
}
+ onfault = p->p_addr->u_pcb.pcb_onfault;
+ p->p_addr->u_pcb.pcb_onfault = NULL;
rv = uvm_fault(map, va, 0, ftype);
+ p->p_addr->u_pcb.pcb_onfault = onfault;
if (rv == KERN_SUCCESS) {
if (nss > vm->vm_ssize)
vm->vm_ssize = nss;