regd. thread ucred update in kern_accessat()

Vijay Singh vijju.singh at gmail.com
Fri Nov 1 18:31:07 UTC 2013


Hi hackers. In kern_accessat() [I'm looking at 8.2 code], for the case
where flags doesn't have AT_EACCESS set, we make a local copy of the thread
ucred. This is then passed in to vn_access(). My question is why we update
 td->td_ucred with this temporary ucred?

                tmpcred = crdup(cred);
                tmpcred->cr_uid = cred->cr_ruid;
                tmpcred->cr_groups[0] = cred->cr_rgid;
==>          td->td_ucred = tmpcred;

At this point p->p_ucred != td->td_ucred. Couldn't this cause issues?
Wouldn't it just suffice to use the tempcred as an argument to vn_access()
and leave the thread's ucred intact?

-vijay


More information about the freebsd-hackers mailing list