This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [PATCH 0/2] wait/ptrace: always assume __WALL if the child is traced
- From: Oleg Nesterov <oleg at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Andrew Morton <akpm at linux-foundation dot org>, Dmitry Vyukov <dvyukov at google dot com>, Alexander Potapenko <glider at google dot com>, Denys Vlasenko <dvlasenk at redhat dot com>, Eric Dumazet <edumazet at google dot com>, Jan Kratochvil <jan dot kratochvil at redhat dot com>, Julien Tinnes <jln at google dot com>, Kees Cook <keescook at google dot com>, Kostya Serebryany <kcc at google dot com>, Linus Torvalds <torvalds at linux-foundation dot org>, "Michael Kerrisk (man-pages)" <mtk dot manpages at gmail dot com>, Robert Swiecki <swiecki at google dot com>, Roland McGrath <roland at hack dot frob dot com>, syzkaller at googlegroups dot com, linux-kernel at vger dot kernel dot org, "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Sun, 25 Oct 2015 16:42:56 +0100
- Subject: Re: [PATCH 0/2] wait/ptrace: always assume __WALL if the child is traced
- Authentication-results: sourceware.org; auth=none
- References: <20151020171740 dot GA29290 at redhat dot com> <5628F569 dot 4070602 at redhat dot com>
On 10/22, Pedro Alves wrote:
>
> In any case, to make sure existing gdb binaries would still work
> with your kernel change, I ran GDB's testsuite with this:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
> index cbcdd95..864ba2e 100644
> --- a/gdb/nat/linux-waitpid.c
> +++ b/gdb/nat/linux-waitpid.c
> @@ -149,3 +149,17 @@ my_waitpid (int pid, int *status, int flags)
> errno = out_errno;
> return ret;
> }
> +
> +#include <dlfcn.h>
> +
> +pid_t
> +waitpid (pid_t pid, int *status, int options)
> +{
> + static pid_t (*waitpid2) (pid_t pid, int *status, int options) = NULL;
> +
> + if (waitpid2 == NULL)
> + waitpid2 = dlsym (RTLD_NEXT, "waitpid");
> +
> + options |= __WALL;
> + return waitpid2 (pid, status, options);
> +}
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks a lot Pedro!
So gdb should be fine, strace too. Perhaps we should change the kernel
this way and forget about /sbin/init fixes.
Oleg.