Re: racct crash/Linux Emulation

From: Edward Tomasz Napierała <trasz_at_FreeBSD.org>
Date: Mon, 24 Aug 2015 10:37:00 +0200
On 0823T2028, Larry Rosenman wrote:
> got the below panio, on a linux (world community grid) process exit.
> 
> 
> borg.lerctr.org dumped core - see /var/crash/vmcore.5
> 
> Sun Aug 23 20:14:24 CDT 2015
> 
> FreeBSD borg.lerctr.org 11.0-CURRENT FreeBSD 11.0-CURRENT #46 r287028: Sat Aug 22 18:34:59 CDT 2015     root_at_borg.lerctr.org:/usr/obj/usr/src/sys/VT-LER  amd64
> 
> panic: racct_sub: freeing 1 of resource 11, which is more than allocated 0 for wcgrid_fahv_vina_pr (pid 1140)

Could you try the patch below?

Index: sys/compat/linux/linux_fork.c
===================================================================
--- sys/compat/linux/linux_fork.c	(revision 287034)
+++ sys/compat/linux/linux_fork.c	(working copy)
_at__at_ -285,10 +285,20 _at__at_ linux_clone_thread(struct thread *td, struct linux
 
 	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);
 
_at__at_ -369,6 +379,16 _at__at_ linux_clone_thread(struct thread *td, struct linux
 	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
Received on Mon Aug 24 2015 - 06:58:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:59 UTC