svn commit: r293607 - stable/10/sys/compat/linux

Dmitry Chagin dchagin at FreeBSD.org
Sat Jan 9 18:24:55 UTC 2016


Author: dchagin
Date: Sat Jan  9 18:24:53 2016
New Revision: 293607
URL: https://svnweb.freebsd.org/changeset/base/293607

Log:
  MFC r287395 (by trasz):
  
  Fixes a panic triggered by threaded Linux applications when running
  with RACCT/RCTL enabled.

Modified:
  stable/10/sys/compat/linux/linux_fork.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_fork.c
==============================================================================
--- stable/10/sys/compat/linux/linux_fork.c	Sat Jan  9 18:23:34 2016	(r293606)
+++ stable/10/sys/compat/linux/linux_fork.c	Sat Jan  9 18:24:53 2016	(r293607)
@@ -286,10 +286,20 @@ linux_clone_thread(struct thread *td, st
 
 	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);
 
@@ -370,6 +380,16 @@ linux_clone_thread(struct thread *td, st
 	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


More information about the svn-src-all mailing list