From: Earl Chew <echew@ixiacom.com>
To: <linux-kernel@vger.kernel.org>
Subject: Null clone CLONE_VM conundrum
Date: Mon, 17 May 2010 07:29:09 -0700 [thread overview]
Message-ID: <4BF152B5.2060000@ixiacom.com> (raw)
I'm looking for some advice to focus my investigation.
I'm using 2.6.31 kernel on PowerPC with glibc version 2.7.
I've been looking into some anomalous behaviour with a program
that uses clone(2).
I've narrowed down the problem to interaction between
the program and the following null clone:
int nullClone(void*)
{
return 0;
}
...
pid_t childPid = clone(nullClone, stackPointer,
CLONE_VM | SIGCHLD,
0, 0, 0, 0);
waitpid(childPid, &childStatus);
As you can see, the null clone is essentially a nop.
Commenting /* CLONE_VM | */, leaving only SIGCHLD (aka null fork(2))
makes the following problem to go away.
The problem I see is that subsequent to the clone(2):
pthread_mutex_lock(parentMutex);
...
pthread_mutex_unlock(parentMutex);
/* Null clone here */
pthread_mutex_lock(parentMutex);
...
pthread_mutex_unlock(parentMutex); <---- Gets stuck here.
The mutex in question is created with PTHREAD_PRIO_INHERIT.
There are a few more details regarding null threads which
I won't get into just yet. I need to try to distill the
problem into a smaller program.
I'm suspicious because I believe the null clone should not
have any effect on the caller -- but obviously does, and in
a way I don't understand.
Do you have suggestions as to where I should look next to explain
this anomalous behaviour ?
What effects might the null clone have on the mutex implementation
that I am not accounting for ?
Earl
reply other threads:[~2010-05-17 14:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BF152B5.2060000@ixiacom.com \
--to=echew@ixiacom.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome