[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20071012180349.b4b4c2c3.akpm@linux-foundation.org>
Date: Fri, 12 Oct 2007 18:03:49 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
Cc: viro@....linux.org.uk, kamezawa.hiroyu@...fujitsu.com,
linux-kernel@...r.kernel.org, sam@...nborg.org,
netdev@...r.kernel.org, Pavel Emelyanov <xemul@...nvz.org>,
Sukadev Bhattiprolu <sukadev@...ibm.com>,
Oleg Nesterov <oleg@...sign.ru>,
Paul Menage <menage@...gle.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: 2.6.23-mm1 thread exit_group issue
On Fri, 12 Oct 2007 15:47:59 -0400
Mathieu Desnoyers <mathieu.desnoyers@...ymtl.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;
> }
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists