mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
Revert removal of cred_free_thread(): It is used to ensure that a thread's
credentials are not improperly borrowed when the thread is not current in the kernel. Requested by: jhb, alfred
This commit is contained in:
parent
74496412c4
commit
aaa1c7715b
3 changed files with 19 additions and 0 deletions
|
|
@ -875,6 +875,9 @@ fork_exit(callout, arg, frame)
|
|||
kthread_exit(0);
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
#ifdef DIAGNOSTIC
|
||||
cred_free_thread(td);
|
||||
#endif
|
||||
mtx_assert(&Giant, MA_NOTOWNED);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1765,6 +1765,19 @@ crdup(struct ucred *cr)
|
|||
return (newcr);
|
||||
}
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
void
|
||||
cred_free_thread(struct thread *td)
|
||||
{
|
||||
struct ucred *cred;
|
||||
|
||||
cred = td->td_ucred;
|
||||
td->td_ucred = NULL;
|
||||
if (cred != NULL)
|
||||
crfree(cred);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fill in a struct xucred based on a struct ucred.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -236,5 +236,8 @@ ast(struct trapframe *framep)
|
|||
}
|
||||
|
||||
userret(td, framep, sticks);
|
||||
#ifdef DIAGNOSTIC
|
||||
cred_free_thread(td);
|
||||
#endif
|
||||
mtx_assert(&Giant, MA_NOTOWNED);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue