Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2006 15:15:22 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 101770 for review
Message-ID:  <200607171515.k6HFFMuq003087@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101770

Change 101770 by rdivacky@rdivacky_witten on 2006/07/17 15:15:00

	Several small things I have in queue:
	
	o		template for SETTLS in clone
	o		change set_thread_area() debug print to be even more sane
	o		change get_thread() to always read segment 3 (reading
			segment 6 is bogus)
	o		dont leak emuldata in a case when linux binary execs to fbsd one

Affected files ...

.. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#16 edit

Differences ...

==== //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#16 (text+ko) ====

@@ -368,6 +368,7 @@
 #define CLONE_SIGHAND	0x800
 #define CLONE_PID	0x1000
 #define CLONE_THREAD	0x10000
+#define CLONE_SETTLS    0x80000
 #define CLONE_CHILD_CLEARTID	0x00200000
 #define CLONE_CHILD_SETTID   	0x01000000
 #define CLONE_PARENT_SETTID	0x00100000
@@ -457,6 +458,10 @@
 	   	em->child_set_tid = NULL;
 	EMUL_RUNLOCK(&emul_lock);
 
+	if (args->flags & CLONE_SETTLS) {
+		/* XXX: set the TLS */
+	} 
+
 	PROC_LOCK(p2);
 	p2->p_sigparent = exit_signal;
 	PROC_UNLOCK(p2);
@@ -948,7 +953,7 @@
 
 #ifdef DEBUG
 	if (ldebug(set_thread_area))
-	   	printf(ARGS(set_thread_area, "%i, %i, %i, %i, %i, %i, %i, %i, %i\n"),
+	   	printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, %i, %i, %i\n"),
 		      info.entry_number,
       		      info.base_addr,
       		      info.limit,
@@ -1045,6 +1050,8 @@
 	if (idx != 6 && idx != 3)
 		return (EINVAL);
 
+	idx = 3;
+
 	memset(&info, 0, sizeof(info));
 
 	sd = PCPU_GET(fsgs_gdt)[1];
@@ -1197,6 +1204,20 @@
    	if (__predict_false(imgp->sysent == &elf_linux_sysvec 
 		 && p->p_sysent == &elf32_freebsd_sysvec))
 	   	linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid);
+	if (__predict_false(imgp->sysent == &elf32_freebsd_sysvec
+		 && p->p_sysent == &elf_linux_sysvec)) {
+	   	struct linux_emuldata *em;
+
+		em = em_find(p->p_pid, EMUL_UNLOCKED);
+
+		if (em == NULL) {
+#ifdef 	DEBUG
+		   	printf(LMSG("we didnt find emuldata for the execing process.\n"));
+#endif
+			return;			
+		}
+		FREE(em, M_LINUX);
+	}
 }
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607171515.k6HFFMuq003087>