Duplicate the changes to i386 to keep creds over the user boundary.

This commit is contained in:
Julian Elischer 2002-02-19 03:16:50 +00:00
parent cc6712ea04
commit db170a83d5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90892

View File

@ -324,9 +324,8 @@ trap(int vector, int imm, struct trapframe *framep)
sticks = td->td_kse->ke_sticks;
td->td_frame = framep;
KASSERT(td->td_ucred == NULL, ("already have a ucred"));
PROC_LOCK(p);
td->td_ucred = crhold(p->p_ucred);
PROC_UNLOCK(p);
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
} else {
sticks = 0; /* XXX bogus -Wuninitialized warning */
KASSERT(cold || td->td_ucred != NULL,
@ -709,10 +708,12 @@ trap(int vector, int imm, struct trapframe *framep)
if (user) {
userret(td, framep, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
#ifdef INVARIANTS
mtx_lock(&Giant);
crfree(td->td_ucred);
mtx_unlock(&Giant);
td->td_ucred = NULL;
#endif
}
return;
@ -758,9 +759,8 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
td->td_frame = framep;
sticks = td->td_kse->ke_sticks;
KASSERT(td->td_ucred == NULL, ("already have a ucred"));
PROC_LOCK(p);
td->td_ucred = crhold(p->p_ucred);
PROC_UNLOCK(p);
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
/*
* Skip past the break instruction. Remember old address in case
@ -865,10 +865,12 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
*/
STOPEVENT(p, S_SCX, code);
#ifdef INVARIANTS
mtx_lock(&Giant);
crfree(td->td_ucred);
mtx_unlock(&Giant);
td->td_ucred = NULL;
#endif
#ifdef WITNESS
if (witness_list(td)) {
panic("system call %s returning with mutex(s) held\n",