* Oleg Nesterov <o...@redhat.com> wrote:

> > I reviewed the ->cred_guard_mutex code, and the mutex is held across all
> > of exec() - and we always did this.
> 
> Yes, and this was always wrong. For example, this test-case hangs:
> 
>       #include <unistd.h>
>       #include <signal.h>
>       #include <sys/ptrace.h>
>       #include <pthread.h>
> 
>       void *thread(void *arg)
>       {
>               ptrace(PTRACE_TRACEME, 0,0,0);
>               return NULL;
>       }
> 
>       int main(void)
>       {
>               int pid = fork();
> 
>               if (!pid) {
>                       pthread_t pt;
>                       pthread_create(&pt, NULL, thread, NULL);
>                       pthread_join(pt, NULL);
>                       execlp("echo", "echo", "passed", NULL);
>               }
> 
>               sleep(1);
>               // or anything else which needs ->cred_guard_mutex,
>               // say open(/proc/$pid/mem)
>               ptrace(PTRACE_ATTACH, pid, 0,0);
>               kill(pid, SIGCONT);
> 
>               return 0;
>       }
> 
> we really need to narrow the (huge) scope of ->cred_guard_mutex in exec paths.
> 
> my attempt to fix this was nacked, and nobody suggested a better solution so 
> far.

Any link to your patch and the NAK?

Thanks,

        Ingo

Reply via email to