[PATCH v2 0/5] Improve ptrace-error detection

Sergio Durigan Junior
2020-03-17T15:47:27Z

Changes from v1:

- Remove "config.h" include from scoped_pipe.h.

- Remove "explicit" keyword from scoped_pipe's constructor.

- Use "GDBSUPPORT" instead of "COMMON" as a prefix for #define on
scoped_pipe.h.

- Remove errno save/restore dance from
gdbserver/utils.cc:perror_with_name.

- Implement "ptrace_attach" vs. "attach" idea (from Pedro) on
inf-ptrace.c in order to make sure we return ptrace errno when
calling "attach".

Sergio Durigan Junior (5):
Introduce scoped_pipe.h
Don't reset errno/bfd_error on 'throw_perror_with_name'
Expand 'fork_inferior' to check whether 'traceme_fun' succeeded
Extend GNU/Linux to check for ptrace error
Document Linux-specific possible ptrace restrictions

gdb/Makefile.in | 1 +
gdb/doc/gdb.texinfo | 136 +++++++++++++++
gdb/inf-ptrace.c | 34 +++-
gdb/inf-ptrace.h | 2 +
gdb/linux-nat.c | 24 +--
gdb/nat/fork-inferior.c | 231 ++++++++++++++++++++++++--
gdb/nat/fork-inferior.h | 87 ++++++++--
gdb/nat/linux-ptrace.c | 178 +++++++++++++++++++-
gdb/nat/linux-ptrace.h | 27 ++-
gdb/remote.c | 40 ++++-
gdb/unittests/scoped_pipe-selftests.c | 95 +++++++++++
gdb/utils.c | 6 -
gdbserver/linux-low.cc | 31 +++-
gdbserver/server.cc | 38 ++++-
gdbserver/thread-db.cc | 2 +-
gdbsupport/scoped_pipe.h | 63 +++++++
16 files changed, 918 insertions(+), 77 deletions(-)
create mode 100644 gdb/unittests/scoped_pipe-selftests.c
create mode 100644 gdbsupport/scoped_pipe.h

--
2.24.1