Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146109194
D15048.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D15048.id.diff
View Options
Index: head/sys/kern/kern_jail.c
===================================================================
--- head/sys/kern/kern_jail.c
+++ head/sys/kern/kern_jail.c
@@ -51,6 +51,7 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/racct.h>
+#include <sys/rctl.h>
#include <sys/refcount.h>
#include <sys/sx.h>
#include <sys/sysent.h>
@@ -2401,10 +2402,15 @@
newcred->cr_prison = pr;
proc_set_cred(p, newcred);
setsugid(p);
- PROC_UNLOCK(p);
#ifdef RACCT
racct_proc_ucred_changed(p, oldcred, newcred);
+ crhold(newcred);
#endif
+ PROC_UNLOCK(p);
+#ifdef RCTL
+ rctl_proc_ucred_changed(p, newcred);
+ crfree(newcred);
+#endif
prison_deref(oldcred->cr_prison, PD_DEREF | PD_DEUREF);
crfree(oldcred);
return (0);
@@ -3960,6 +3966,7 @@
*/
racct_move(pr->pr_prison_racct->prr_racct, oldprr->prr_racct);
+#ifdef RCTL
/*
* Force rctl to reattach rules to processes.
*/
@@ -3967,9 +3974,10 @@
PROC_LOCK(p);
cred = crhold(p->p_ucred);
PROC_UNLOCK(p);
- racct_proc_ucred_changed(p, cred, cred);
+ rctl_proc_ucred_changed(p, cred);
crfree(cred);
}
+#endif
sx_sunlock(&allproc_lock);
prison_racct_free_locked(oldprr);
Index: head/sys/kern/kern_loginclass.c
===================================================================
--- head/sys/kern/kern_loginclass.c
+++ head/sys/kern/kern_loginclass.c
@@ -58,6 +58,7 @@
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/racct.h>
+#include <sys/rctl.h>
#include <sys/refcount.h>
#include <sys/rwlock.h>
#include <sys/sysproto.h>
@@ -230,9 +231,14 @@
oldcred = crcopysafe(p, newcred);
newcred->cr_loginclass = newlc;
proc_set_cred(p, newcred);
- PROC_UNLOCK(p);
#ifdef RACCT
racct_proc_ucred_changed(p, oldcred, newcred);
+ crhold(newcred);
+#endif
+ PROC_UNLOCK(p);
+#ifdef RCTL
+ rctl_proc_ucred_changed(p, newcred);
+ crfree(newcred);
#endif
loginclass_free(oldcred->cr_loginclass);
crfree(oldcred);
Index: head/sys/kern/kern_prot.c
===================================================================
--- head/sys/kern/kern_prot.c
+++ head/sys/kern/kern_prot.c
@@ -66,6 +66,7 @@
#include <sys/jail.h>
#include <sys/pioctl.h>
#include <sys/racct.h>
+#include <sys/rctl.h>
#include <sys/resourcevar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@@ -575,10 +576,15 @@
setsugid(p);
}
proc_set_cred(p, newcred);
- PROC_UNLOCK(p);
#ifdef RACCT
racct_proc_ucred_changed(p, oldcred, newcred);
+ crhold(newcred);
#endif
+ PROC_UNLOCK(p);
+#ifdef RCTL
+ rctl_proc_ucred_changed(p, newcred);
+ crfree(newcred);
+#endif
uifree(uip);
crfree(oldcred);
return (0);
@@ -923,10 +929,15 @@
setsugid(p);
}
proc_set_cred(p, newcred);
- PROC_UNLOCK(p);
#ifdef RACCT
racct_proc_ucred_changed(p, oldcred, newcred);
+ crhold(newcred);
#endif
+ PROC_UNLOCK(p);
+#ifdef RCTL
+ rctl_proc_ucred_changed(p, newcred);
+ crfree(newcred);
+#endif
uifree(ruip);
uifree(euip);
crfree(oldcred);
@@ -1064,9 +1075,14 @@
setsugid(p);
}
proc_set_cred(p, newcred);
- PROC_UNLOCK(p);
#ifdef RACCT
racct_proc_ucred_changed(p, oldcred, newcred);
+ crhold(newcred);
+#endif
+ PROC_UNLOCK(p);
+#ifdef RCTL
+ rctl_proc_ucred_changed(p, newcred);
+ crfree(newcred);
#endif
uifree(ruip);
uifree(euip);
Index: head/sys/kern/kern_racct.c
===================================================================
--- head/sys/kern/kern_racct.c
+++ head/sys/kern/kern_racct.c
@@ -1046,7 +1046,7 @@
if (!racct_enable)
return;
- PROC_LOCK_ASSERT(p, MA_NOTOWNED);
+ PROC_LOCK_ASSERT(p, MA_OWNED);
newuip = newcred->cr_ruidinfo;
olduip = oldcred->cr_ruidinfo;
@@ -1073,10 +1073,6 @@
p->p_racct);
}
RACCT_UNLOCK();
-
-#ifdef RCTL
- rctl_proc_ucred_changed(p, newcred);
-#endif
}
void
Index: head/sys/kern/kern_rctl.c
===================================================================
--- head/sys/kern/kern_rctl.c
+++ head/sys/kern/kern_rctl.c
@@ -1956,12 +1956,15 @@
struct prison_racct *newprr;
int rulecnt, i;
- ASSERT_RACCT_ENABLED();
+ if (!racct_enable)
+ return;
+ PROC_LOCK_ASSERT(p, MA_NOTOWNED);
+
newuip = newcred->cr_ruidinfo;
newlc = newcred->cr_loginclass;
newprr = newcred->cr_prison->pr_prison_racct;
-
+
LIST_INIT(&newrules);
again:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 28, 9:43 PM (12 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29083553
Default Alt Text
D15048.id.diff (4 KB)
Attached To
Mode
D15048: call racct_proc_ucred_changed() under the proc lock
Attached
Detach File
Event Timeline
Log In to Comment