summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-11-29 12:24:19 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-11-29 12:24:19 +0000
commit83368008eb99b7d2d9cb6f221de83c9af517b654 (patch)
tree0a2dbd431fbc167b1d69b949392ff3f47e6a82ef /sys/arch
parente83961e1eb1bda3be0177245339cfd8037ed4c4a (diff)
Kernel stack can be swapped. This means that stuff that's on the stack
should never be referenced outside the context of the process to which this stack belongs unless we do the PHOLD/PRELE dance. Loads of code doesn't follow the rules here. Instead of trying to track down all offenders and fix this hairy situation, it makes much more sense to not swap kernel stacks. From art@, tested by many some time ago.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/pmap.c7
-rw-r--r--sys/arch/amd64/amd64/fpu.c3
-rw-r--r--sys/arch/arm/arm/db_trace.c6
-rw-r--r--sys/arch/sparc/dev/fd.c4
-rw-r--r--sys/arch/sparc64/dev/fd.c4
-rw-r--r--sys/arch/sparc64/sparc64/db_trace.c6
6 files changed, 8 insertions, 22 deletions
diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c
index bd49bee76d3..f39ff355ac1 100644
--- a/sys/arch/alpha/alpha/pmap.c
+++ b/sys/arch/alpha/alpha/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.47 2006/04/13 14:41:08 brad Exp $ */
+/* $OpenBSD: pmap.c,v 1.48 2006/11/29 12:24:15 miod Exp $ */
/* $NetBSD: pmap.c,v 1.154 2000/12/07 22:18:55 thorpej Exp $ */
/*-
@@ -2867,9 +2867,8 @@ pmap_emulate_reference(struct proc *p, vaddr_t v, int user, int type)
panic("pmap_emulate_reference: invalid pte");
#if 0
/*
- * Can't do these, because cpu_fork and cpu_swapin call
- * pmap_emulate_reference(), and the bits aren't guaranteed,
- * for them...
+ * Can't do these, because cpu_fork call pmap_emulate_reference(),
+ * and the bits aren't guaranteed, for them...
*/
if (type == ALPHA_MMCSR_FOW) {
if (!(*pte & (user ? PG_UWE : PG_UWE | PG_KWE)))
diff --git a/sys/arch/amd64/amd64/fpu.c b/sys/arch/amd64/amd64/fpu.c
index e2dd39a2d31..cc19b095f2d 100644
--- a/sys/arch/amd64/amd64/fpu.c
+++ b/sys/arch/amd64/amd64/fpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu.c,v 1.11 2006/04/19 15:51:22 mickey Exp $ */
+/* $OpenBSD: fpu.c,v 1.12 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: fpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
@@ -301,7 +301,6 @@ fpusave_proc(struct proc *p, int save)
struct cpu_info *oci;
KDASSERT(p->p_addr != NULL);
- KDASSERT(p->p_flag & P_INMEM);
oci = p->p_addr->u_pcb.pcb_fpcpu;
if (oci == NULL)
diff --git a/sys/arch/arm/arm/db_trace.c b/sys/arch/arm/arm/db_trace.c
index 00206ef7efc..1f82b9420f8 100644
--- a/sys/arch/arm/arm/db_trace.c
+++ b/sys/arch/arm/arm/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.2 2004/05/19 03:17:07 drahn Exp $ */
+/* $OpenBSD: db_trace.c,v 1.3 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: db_trace.c,v 1.8 2003/01/17 22:28:48 thorpej Exp $ */
/*
@@ -113,10 +113,6 @@ db_stack_trace_print(addr, have_addr, count, modif, pr)
(*pr)("not found\n");
return;
}
- if (!(p->p_flag & P_INMEM)) {
- (*pr)("swapped out\n");
- return;
- }
u = p->p_addr;
#ifdef acorn26
frame = (u_int32_t *)(u->u_pcb.pcb_sf->sf_r11);
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index 3642726a299..9f1977266a1 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.45 2006/09/26 23:33:04 krw Exp $ */
+/* $OpenBSD: fd.c,v 1.46 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -1895,7 +1895,6 @@ fdformat(dev, finfo, p)
if (bp == 0)
return (ENOBUFS);
- PHOLD(p);
bzero((void *)bp, sizeof(struct buf));
bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
bp->b_proc = p;
@@ -1942,7 +1941,6 @@ fdformat(dev, finfo, p)
/* ...and wait for it to complete */
rv = biowait(bp);
- PRELE(p);
free(bp, M_TEMP);
return (rv);
}
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c
index 04f71364c2c..2aaa9286441 100644
--- a/sys/arch/sparc64/dev/fd.c
+++ b/sys/arch/sparc64/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.7 2006/09/26 23:33:04 krw Exp $ */
+/* $OpenBSD: fd.c,v 1.8 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */
/*-
@@ -1944,7 +1944,6 @@ fdformat(dev, finfo, p)
if (bp == NULL)
return (ENOBUFS);
- PHOLD(p);
bzero((void *)bp, sizeof(struct buf));
bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
bp->b_proc = p;
@@ -1991,7 +1990,6 @@ fdformat(dev, finfo, p)
/* ...and wait for it to complete */
rv = biowait(bp);
- PRELE(p);
free(bp, M_TEMP);
return (rv);
}
diff --git a/sys/arch/sparc64/sparc64/db_trace.c b/sys/arch/sparc64/sparc64/db_trace.c
index dd25eee69f2..2bb07cffee2 100644
--- a/sys/arch/sparc64/sparc64/db_trace.c
+++ b/sys/arch/sparc64/sparc64/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.7 2002/10/09 21:10:48 deraadt Exp $ */
+/* $OpenBSD: db_trace.c,v 1.8 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: db_trace.c,v 1.23 2001/07/10 06:06:16 eeh Exp $ */
/*
@@ -87,10 +87,6 @@ db_stack_trace_print(addr, have_addr, count, modif, pr)
(*pr)("not found\n");
return;
}
- if ((p->p_flag & P_INMEM) == 0) {
- (*pr)("swapped out\n");
- return;
- }
u = p->p_addr;
frame = (vaddr_t)u->u_pcb.pcb_sp;
(*pr)("at %p\n", frame);