From: Andrew Morton <akpm@linux-foundation.org>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: viro@ftp.linux.org.uk, kamezawa.hiroyu@jp.fujitsu.com,
linux-kernel@vger.kernel.org, sam@ravnborg.org,
netdev@vger.kernel.org, Pavel Emelyanov <xemul@openvz.org>,
Sukadev Bhattiprolu <sukadev@us.ibm.com>,
Oleg Nesterov <oleg@tv-sign.ru>, Paul Menage <menage@google.com>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: 2.6.23-mm1 thread exit_group issue
Date: Fri, 12 Oct 2007 18:03:49 -0700 [thread overview]
Message-ID: <20071012180349.b4b4c2c3.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071012194759.GA31733@Krystal>
On Fri, 12 Oct 2007 15:47:59 -0400
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> Hi Andrew,
>
> I noticed a regression between 2.6.23-rc8-mm2 and 2.6.23-mm1 (with your
> hotfixes). User space threads seems to receive a ERESTART_RESTARTBLOCK
> as soon as a thread does a pthread_join on them. The previous behavior
> was to wait for them to exit by taking a futex.
>
> I provide a toy program that shows the problem. On 2.6.23-rc8-mm2, it
> loops forever (as it should). On 2.6.23-mm1, it exits after 10 seconds.
>
> Any idea on what may cause this problem ?
Bisection shows that this problem is caused by these two patches:
pid-namespaces-allow-cloning-of-new-namespace.patch
pid-namespaces-allow-cloning-of-new-namespace-fix-check-for-return-value-of-create_pid_namespace.patch
> (I also provide complete ptrace -f of a correct and buggy run and my
> kernel config. Tests were done on i386.)
>
> Mathieu
>
>
> /*
> * Thread testing
> *
> * build with gcc -lpthread -o pthread pthread.c
> *
> * Mathieu Desnoyers
> * License: GPL
> */
>
> #include <stdio.h>
> #include <pthread.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <sys/wait.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <signal.h>
>
> static int __thread test = 0;
>
> /* signal handler */
> void handler(int signo)
> {
> printf("Sig handler : TID %lu, pid : %lu\n", pthread_self(), getpid());
> }
>
> void *thr1(void *arg)
> {
> test = 1;
>
> while(1) {
> printf("thread 1, thread id : %lu, pid %lu, test %d\n",
> pthread_self(), getpid(), test);
> sleep(2);
> }
> return ((void*)1);
>
> }
>
> void *thr2(void *arg)
> {
> while(1) {
> printf("thread 2, thread id : %lu, pid %lu, test %d\n",
> pthread_self(), getpid(), test);
> sleep(2);
> }
> return ((void*)2);
> }
>
> int main()
> {
> int err;
> pthread_t tid1, tid2;
> void *tret;
> static struct sigaction act;
>
> act.sa_handler = handler;
> sigemptyset(&(act.sa_mask));
> sigaddset(&(act.sa_mask), SIGUSR1);
> sigaction(SIGUSR1, &act, NULL);
>
> err = pthread_create(&tid1, NULL, thr1, NULL);
> if (err != 0)
> exit(1);
>
> err = pthread_create(&tid2, NULL, thr2, NULL);
> if (err != 0)
> exit(1);
>
> sleep(10);
>
> err = pthread_join(tid1, &tret);
> if (err != 0)
> exit(1);
>
> err = pthread_join(tid2, &tret);
> if (err != 0)
> exit(1);
>
> return 0;
> }
>
next prev parent reply other threads:[~2007-10-13 1:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071011213126.cf92efb7.akpm@linux-foundation.org>
[not found] ` <20071012140328.f82af8e8.kamezawa.hiroyu@jp.fujitsu.com>
[not found] ` <20071011234202.2f15bb76.akpm@linux-foundation.org>
[not found] ` <20071012064658.GA8181@ftp.linux.org.uk>
2007-10-12 7:13 ` 2.6.23-mm1 Andrew Morton
2007-10-12 18:06 ` [PATCH net-2.6] uml: hard_header fix Stephen Hemminger
2007-10-12 19:04 ` 2.6.23-mm1 Al Viro
2007-10-12 19:47 ` 2.6.23-mm1 thread exit_group issue Mathieu Desnoyers
2007-10-12 20:01 ` Andrew Morton
2007-10-13 1:03 ` Andrew Morton [this message]
2007-10-13 11:48 ` Oleg Nesterov
2007-10-13 12:02 ` Oleg Nesterov
2007-10-13 17:49 ` Andrew Morton
2007-10-14 4:04 ` Mathieu Desnoyers
2007-10-22 18:40 ` kernel panic when running tcpdump Mariusz Kozlowski
2007-10-22 19:03 ` Andrew Morton
2007-10-22 21:16 ` Mariusz Kozlowski
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=20071012180349.b4b4c2c3.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=menage@google.com \
--cc=netdev@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=sam@ravnborg.org \
--cc=sukadev@us.ibm.com \
--cc=viro@ftp.linux.org.uk \
--cc=xemul@openvz.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;
as well as URLs for NNTP newsgroup(s).