Date: Wed, 25 Aug 2010 21:49:05 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 182912 for review Message-ID: <201008252149.o7PLn5qm051657@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@182912?ac=10 Change 182912 by trasz@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); } /*-
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008252149.o7PLn5qm051657>