PERFORCE change 113675 for review
Roman Divacky
rdivacky at FreeBSD.org
Mon Jan 29 21:13:22 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=113675
Change 113675 by rdivacky at 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
More information about the p4-projects
mailing list