Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2013 11:31:05 -0700
From:      Vijay Singh <vijju.singh@gmail.com>
To:        hackers@freebsd.org
Subject:   regd. thread ucred update in kern_accessat()
Message-ID:  <CALCNsJREYyv=PQ0wAL-cibg5-y-dq_TFw7tEM4PheSd-h09Asg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALCNsJREYyv=PQ0wAL-cibg5-y-dq_TFw7tEM4PheSd-h09Asg>