summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2024-03-29 21:19:31 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2024-03-29 21:19:31 +0000
commit14c6412e314fe1f46f3f3a63e92d439a9f19f70c (patch)
treef949fe8adbd6ea88d362df30fdc37c196175abfb
parent2d86b85797c2baf9c2bc7114d65052c6e412e9f1 (diff)
Text faults should not invoke uvm_grow() since the fault address is not on
stack. Remove duplicated "panic if uvm_fault() fails and we are in kernel mode" blocks. ok claudio@ kettenis@
-rw-r--r--sys/arch/sparc64/sparc64/trap.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index e1648c80380..985490582e8 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.124 2024/03/29 21:17:13 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.125 2024/03/29 21:19:30 miod Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -903,28 +903,8 @@ text_access_fault(struct trapframe *tf, unsigned type, vaddr_t pc,
goto out;
error = uvm_fault(&p->p_vmspace->vm_map, va, 0, access_type);
-
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if uvm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if (error == 0) {
- uvm_grow(p, va);
+ if (error == 0)
goto out;
- }
-
- /*
- * Pagein failed. Any other page fault in kernel, die; if user
- * fault, deliver SIGSEGV.
- */
- if (tf->tf_tstate & TSTATE_PRIV) {
- (void) splhigh();
- panic("kernel text fault: pc=%llx", (unsigned long long)pc);
- /* NOTREACHED */
- }
signal = SIGSEGV;
sicode = SEGV_MAPERR;
@@ -937,10 +917,8 @@ text_access_fault(struct trapframe *tf, unsigned type, vaddr_t pc,
trapsignal(p, signal, access_type, sicode, sv);
out:
- if ((tf->tf_tstate & TSTATE_PRIV) == 0) {
- userret(p);
- share_fpu(p, tf);
- }
+ userret(p);
+ share_fpu(p, tf);
}
@@ -997,30 +975,8 @@ text_access_error(struct trapframe *tf, unsigned type, vaddr_t pc,
goto out;
error = uvm_fault(&p->p_vmspace->vm_map, va, 0, access_type);
-
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if uvm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if (error == 0) {
- uvm_grow(p, va);
+ if (error == 0)
goto out;
- }
-
- /*
- * Pagein failed. If doing copyin/out, return to onfault
- * address. Any other page fault in kernel, die; if user
- * fault, deliver SIGSEGV.
- */
- if (tf->tf_tstate & TSTATE_PRIV) {
- (void) splhigh();
- panic("kernel text error: pc=%lx sfsr=%lb", pc,
- sfsr, SFSR_BITS);
- /* NOTREACHED */
- }
signal = SIGSEGV;
sicode = SEGV_MAPERR;