summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2002-03-20 21:09:09 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2002-03-20 21:09:09 +0000
commitf25fcd64b81a50180b944849a8b97fe613f2db63 (patch)
treec0aa5a835f69a0ccf83503fd8b1f6284161207b7
parentc1a513c951a93df463405b2972430c6f3beb8b63 (diff)
Notes
-rw-r--r--sys/alpha/alpha/trap.c31
-rw-r--r--sys/amd64/amd64/trap.c31
-rw-r--r--sys/i386/i386/trap.c31
-rw-r--r--sys/ia64/ia64/trap.c31
-rw-r--r--sys/powerpc/aim/trap.c16
-rw-r--r--sys/powerpc/powerpc/trap.c16
-rw-r--r--sys/sparc64/sparc64/trap.c31
-rw-r--r--sys/sys/proc.h5
8 files changed, 36 insertions, 156 deletions
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c
index bbd1d5a82e2f..9c2ea34f7f7e 100644
--- a/sys/alpha/alpha/trap.c
+++ b/sys/alpha/alpha/trap.c
@@ -297,13 +297,6 @@ trap(a0, a1, a2, entry, framep)
if (user) {
sticks = td->td_kse->ke_sticks;
td->td_frame = framep;
-#ifdef DIAGNOSTIC
- /* see the comment in ast() */
- if (td->td_ucred != NULL)
- panic("trap(): thread got a ucred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
} else {
@@ -631,12 +624,9 @@ out:
framep->tf_regs[FRAME_SP] = alpha_pal_rdusp();
userret(td, framep, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap: thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
}
return;
@@ -705,12 +695,6 @@ syscall(code, framep)
td->td_frame = framep;
opc = framep->tf_regs[FRAME_PC] - 4;
sticks = td->td_kse->ke_sticks;
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred)
- panic("syscall:thread got a cred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif /* DIAGNOSTIC */
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
@@ -833,12 +817,9 @@ syscall(code, framep)
*/
STOPEVENT(p, S_SCX, code);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("syscall:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
#ifdef WITNESS
if (witness_list(td)) {
panic("system call %s returning with mutex(s) held\n",
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 57d1dea71c5d..751d5f575160 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -257,13 +257,6 @@ trap(frame)
sticks = td->td_kse->ke_sticks;
td->td_frame = &frame;
-#ifdef DIAGNOSTIC
- /* see the comment in ast() */
- if (td->td_ucred != NULL)
- panic("trap(): thread got a ucred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
@@ -651,12 +644,9 @@ user:
userret(td, &frame, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
userout:
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
out:
return;
}
@@ -964,12 +954,6 @@ syscall(frame)
sticks = td->td_kse->ke_sticks;
td->td_frame = &frame;
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred)
- panic("trap:thread got a cred while userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif /* DIAGNOSTIC */
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
params = (caddr_t)frame.tf_esp + sizeof(int);
@@ -1114,12 +1098,9 @@ bad:
*/
STOPEVENT(p, S_SCX, code);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("syscall:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
#ifdef WITNESS
if (witness_list(td)) {
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 57d1dea71c5d..751d5f575160 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -257,13 +257,6 @@ trap(frame)
sticks = td->td_kse->ke_sticks;
td->td_frame = &frame;
-#ifdef DIAGNOSTIC
- /* see the comment in ast() */
- if (td->td_ucred != NULL)
- panic("trap(): thread got a ucred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
@@ -651,12 +644,9 @@ user:
userret(td, &frame, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
userout:
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
out:
return;
}
@@ -964,12 +954,6 @@ syscall(frame)
sticks = td->td_kse->ke_sticks;
td->td_frame = &frame;
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred)
- panic("trap:thread got a cred while userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif /* DIAGNOSTIC */
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
params = (caddr_t)frame.tf_esp + sizeof(int);
@@ -1114,12 +1098,9 @@ bad:
*/
STOPEVENT(p, S_SCX, code);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("syscall:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
#ifdef WITNESS
if (witness_list(td)) {
diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c
index 18204351fa1a..060dcb5a3b5c 100644
--- a/sys/ia64/ia64/trap.c
+++ b/sys/ia64/ia64/trap.c
@@ -323,13 +323,6 @@ trap(int vector, int imm, struct trapframe *framep)
if (user) {
sticks = td->td_kse->ke_sticks;
td->td_frame = framep;
-#ifdef DIAGNOSTIC
- /* see the comment in ast() */
- if (td->td_ucred != NULL)
- panic("trap(): thread got a ucred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
} else {
@@ -714,12 +707,9 @@ out:
if (user) {
userret(td, framep, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
}
return;
@@ -764,12 +754,6 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
td->td_frame = framep;
sticks = td->td_kse->ke_sticks;
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred)
- panic("trap:thread got a cred while userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif /* DIAGNOSTIC */
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
@@ -876,12 +860,9 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
*/
STOPEVENT(p, S_SCX, code);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
#ifdef WITNESS
if (witness_list(td)) {
panic("system call %s returning with mutex(s) held\n",
diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c
index 16ab7ae5717f..6c122e69e665 100644
--- a/sys/powerpc/aim/trap.c
+++ b/sys/powerpc/aim/trap.c
@@ -226,13 +226,6 @@ trap(struct trapframe *frame)
if (user) {
sticks = td->td_kse->ke_sticks;
td->td_frame = frame;
-#ifdef DIAGNOSTIC
- /* see the comment in ast() */
- if (td->td_ucred != NULL)
- panic("trap(): thread got a ucred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
@@ -303,12 +296,9 @@ trap(struct trapframe *frame)
}
userret(td, frame, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
}
void
diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c
index 16ab7ae5717f..6c122e69e665 100644
--- a/sys/powerpc/powerpc/trap.c
+++ b/sys/powerpc/powerpc/trap.c
@@ -226,13 +226,6 @@ trap(struct trapframe *frame)
if (user) {
sticks = td->td_kse->ke_sticks;
td->td_frame = frame;
-#ifdef DIAGNOSTIC
- /* see the comment in ast() */
- if (td->td_ucred != NULL)
- panic("trap(): thread got a ucred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
@@ -303,12 +296,9 @@ trap(struct trapframe *frame)
}
userret(td, frame, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
}
void
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index 481cdab7692f..f2eeaa6ae093 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -177,13 +177,6 @@ trap(struct trapframe *tf)
if ((type & T_KERNEL) == 0) {
sticks = td->td_kse->ke_sticks;
td->td_frame = tf;
-#ifdef DIAGNOSTIC
- /* see the comment in ast() */
- if (td->td_ucred != NULL)
- panic("trap(): thread got a ucred while in userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
} else {
@@ -387,12 +380,9 @@ trapsig:
user:
userret(td, tf, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("trap:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
out:
CTR1(KTR_TRAP, "trap: td=%p return", td);
return;
@@ -548,12 +538,6 @@ syscall(struct trapframe *tf)
sticks = td->td_kse->ke_sticks;
td->td_frame = tf;
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred)
- panic("syscall:thread got a cred while userspace");
- td->td_ucred = td->td_ucred_cache;
- td->td_ucred_cache = NULL;
-#endif /* DIAGNOSTIC */
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
code = tf->tf_global[1];
@@ -690,12 +674,9 @@ bad:
*/
STOPEVENT(p, S_SCX, code);
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- if (td->td_ucred_cache)
- panic("syscall:thread already has cached ucred");
- td->td_ucred_cache = td->td_ucred;
- td->td_ucred = NULL;
-#endif /* DIAGNOSTIC */
+#ifdef DIAGNOSTIC
+ cred_free_thread(td);
+#endif
#ifdef WITNESS
if (witness_list(td)) {
panic("system call %s returning with mutex(s) held\n",
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 58940f16e1b0..72656e8ddf1c 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -289,11 +289,6 @@ struct thread {
#define td_endcopy td_pcb
struct ucred *td_ucred; /* (k) Reference to credentials. */
-#ifdef DIAGNOSTIC /* see the comment in ast() */
- struct ucred *td_ucred_cache; /* (k) hide cred here for DIAGNOSTIC */
-#else
- void *td_dontuse; /* keep the size the same if not DIAG */
-#endif
struct pcb *td_pcb; /* (k) Kernel VA of pcb and kstack. */
struct callout td_slpcallout; /* (h) Callout for sleep. */
struct trapframe *td_frame; /* (k) */