Date: Mon, 29 Jan 2007 21:13:22 GMT From: Roman Divacky <rdivacky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 113675 for review Message-ID: <200701292113.l0TLDMBl028032@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113675 Change 113675 by rdivacky@rdivacky_witten on 2007/01/29 21:13:01 There is no need to lock p_em in the linux_proc_init CLONE_THREAD case because the process cannot change the address of the p_em->shared because its currently running this code path. And the p_em->shared is the reason for synchronization here. Also protect onlu refs++ with the emul_shared_lock as em is local to our function. Affected files ... .. //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#28 edit Differences ... ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#28 (text+ko) ==== @@ -114,13 +114,18 @@ if (child != 0) { if (flags & CLONE_THREAD) { /* lookup the parent */ - EMUL_SHARED_WLOCK(&emul_shared_lock); - p_em = em_find(td->td_proc, EMUL_DOLOCK); + /* + * we dont have to lock the p_em because + * its waiting for us in linux_clone so + * there is no chance of it changing the + * p_em->shared address + */ + p_em = em_find(td->td_proc, EMUL_DONTLOCK); KASSERT(p_em != NULL, ("proc_init: parent emuldata not found for CLONE_THREAD\n")); em->shared = p_em->shared; + EMUL_SHARED_WLOCK(&emul_shared_lock); em->shared->refs++; - EMUL_SHARED_WUNLOCK(&emul_shared_lock); - EMUL_UNLOCK(&emul_lock); + EMUL_SHARED_WUNLOCK(&emul_shared_lock); } else { /* * handled earlier to avoid malloc(M_WAITOK) with
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701292113.l0TLDMBl028032>