summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-09-02 14:04:13 +0000
committertrasz <trasz@FreeBSD.org>2015-09-02 14:04:13 +0000
commite6a94eac4ed0f66202a3f8a5113f7cc4dfe56b1a (patch)
treef9a5793536a77ae2a3d18d60a4973d0fc00c4665 /sys/compat
parent45daa1528349896e8e6baa64048525a342cd8955 (diff)
downloadFreeBSD-src-e6a94eac4ed0f66202a3f8a5113f7cc4dfe56b1a.zip
FreeBSD-src-e6a94eac4ed0f66202a3f8a5113f7cc4dfe56b1a.tar.gz
Fixes a panic triggered by threaded Linux applications when running
with RACCT/RCTL enabled. Reviewed by: ngie@, ed@ Tested by: Larry Rosenman <ler@lerctr.org> MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3470
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_fork.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
index a8bf720..dd3b894 100644
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -285,10 +285,20 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args)
p = td->td_proc;
+#ifdef RACCT
+ if (racct_enable) {
+ PROC_LOCK(p);
+ error = racct_add(p, RACCT_NTHR, 1);
+ PROC_UNLOCK(p);
+ if (error != 0)
+ return (EPROCLIM);
+ }
+#endif
+
/* Initialize our td */
error = kern_thr_alloc(p, 0, &newtd);
if (error)
- return (error);
+ goto fail;
cpu_set_upcall(newtd, td);
@@ -369,6 +379,16 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args)
td->td_retval[0] = newtd->td_tid;
return (0);
+
+fail:
+#ifdef RACCT
+ if (racct_enable) {
+ PROC_LOCK(p);
+ racct_sub(p, RACCT_NTHR, 1);
+ PROC_UNLOCK(p);
+ }
+#endif
+ return (error);
}
int
OpenPOWER on IntegriCloud