PERFORCE change 182912 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Wed Aug 25 21:49:06 UTC 2010
http://p4web.freebsd.org/@@182912?ac=10
Change 182912 by trasz at trasz_victim on 2010/08/25 21:48:51
There is a problem with change_ruid() - it updates process counts
(calls chgproccnt()), which doesn't make sense in cases where it operates
on credentials not assigned to the process. There is exactly one such
situation in the tree - in the unionfs code. Since we already need
change_cred() routine, we can fix the problem moving messing with
chgproccnt() from change_ruid() into change_cred().
Affected files ...
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_prot.c#28 edit
Differences ...
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_prot.c#28 (text+ko) ====
@@ -2126,6 +2126,11 @@
{
PROC_LOCK_ASSERT(p, MA_OWNED);
+ if (p->p_ucred->cr_ruidinfo != newcred->cr_ruidinfo) {
+ chgproccnt(p->p_ucred->cr_ruidinfo, -1, 0);
+ chgproccnt(newcred->cr_ruidinfo, 1, 0);
+ }
+
#ifdef HRL
hrl_proc_ucred_changing(p, newcred);
#endif
@@ -2173,12 +2178,10 @@
change_ruid(struct ucred *newcred, struct uidinfo *ruip)
{
- (void)chgproccnt(newcred->cr_ruidinfo, -1, 0);
newcred->cr_ruid = ruip->ui_uid;
uihold(ruip);
uifree(newcred->cr_ruidinfo);
newcred->cr_ruidinfo = ruip;
- (void)chgproccnt(newcred->cr_ruidinfo, 1, 0);
}
/*-
More information about the p4-projects
mailing list