@@ -1,3 +1,13 @@
+2017-12-20  Martin Balao  <mbalao@redhat.com>
+
+ [BZ #22433]
+ * sysdeps/unix/sysv/linux/x86/sys/ptrace.h: New file.
+ Constants added: PTRACE_GET_THREAD_AREA,
PTRACE_SET_THREAD_AREA,
+ PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP.
+ * sysdeps/unix/sysv/linux/x86_64/sys/ptrace.h: New file.
+ Constants added: PTRACE_GET_THREAD_AREA,
PTRACE_SET_THREAD_AREA,
+ PTRACE_ARCH_PRCTL, PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP.
+
 2017-10-04  Florian Weimer  <fweimer@redhat.com>
Â
 * scripts/check-local-headers.sh: Ignore nspr4 header file
b/sysdeps/unix/sysv/linux/x86/sys/ptrace.h
new file mode 100644
@@ -0,0 +1,245 @@
+/* `ptrace' debugger support interface.  Linux/x86 version.
+Â Â Â Copyright (C) 1996-2017 Free Software Foundation, Inc.
+Â Â Â This file is part of the GNU C Library.
+
+Â Â Â The GNU C Library is free software; you can redistribute it and/or
+Â Â Â modify it under the terms of the GNU Lesser General Public
+Â Â Â License as published by the Free Software Foundation; either
+Â Â Â version 2.1 of the License, or (at your option) any later version.
+
+Â Â Â The GNU C Library is distributed in the hope that it will be
useful,
+Â Â Â but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Â Â Â Lesser General Public License for more details.
+
+Â Â Â You should have received a copy of the GNU Lesser General Public
+Â Â Â License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H 1
+
+#include <features.h>
+#include <bits/types.h>
+
+__BEGIN_DECLS
+
+/* Type of the REQUEST argument to `ptrace.'Â Â */
+enum __ptrace_request
+{
+Â Â /* Indicate that the process making this request should be traced.
+Â Â Â Â Â All signals received by this process can be intercepted by its
+     parent, and its parent can use the other `ptrace' requests.  */
+Â Â PTRACE_TRACEME = 0,
+#define PT_TRACE_ME PTRACE_TRACEME
+
+  /* Return the word in the process's text space at address ADDR.  */
+Â Â PTRACE_PEEKTEXT = 1,
+#define PT_READ_I PTRACE_PEEKTEXT
+
+  /* Return the word in the process's data space at address ADDR.  */
+Â Â PTRACE_PEEKDATA = 2,
+#define PT_READ_D PTRACE_PEEKDATA
+
+  /* Return the word in the process's user area at offset ADDR.  */
+Â Â PTRACE_PEEKUSER = 3,
+#define PT_READ_U PTRACE_PEEKUSER
+
+Â Â /* Write the word DATA into the process's text space at address
ADDR.  */
+Â Â PTRACE_POKETEXT = 4,
+#define PT_WRITE_I PTRACE_POKETEXT
+
+Â Â /* Write the word DATA into the process's data space at address
ADDR.  */
+Â Â PTRACE_POKEDATA = 5,
+#define PT_WRITE_D PTRACE_POKEDATA
+
+Â Â /* Write the word DATA into the process's user area at offset
ADDR.  */
+Â Â PTRACE_POKEUSER = 6,
+#define PT_WRITE_U PTRACE_POKEUSER
+
+  /* Continue the process.  */
+Â Â PTRACE_CONT = 7,
+#define PT_CONTINUE PTRACE_CONT
+
+  /* Kill the process.  */
+Â Â PTRACE_KILL = 8,
+#define PT_KILL PTRACE_KILL
+
+Â Â /* Single step the process.
+     This is not supported on all machines.  */
+Â Â PTRACE_SINGLESTEP = 9,
+#define PT_STEP PTRACE_SINGLESTEP
+
+Â Â /* Get all general purpose registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_GETREGS = 12,
+#define PT_GETREGS PTRACE_GETREGS
+
+Â Â /* Set all general purpose registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_SETREGS = 13,
+#define PT_SETREGS PTRACE_SETREGS
+
+Â Â /* Get all floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_GETFPREGS = 14,
+#define PT_GETFPREGS PTRACE_GETFPREGS
+
+Â Â /* Set all floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_SETFPREGS = 15,
+#define PT_SETFPREGS PTRACE_SETFPREGS
+
+Â Â /* Attach to a process that is already running. */
+Â Â PTRACE_ATTACH = 16,
+#define PT_ATTACH PTRACE_ATTACH
+
+  /* Detach from a process attached to with PTRACE_ATTACH.  */
+Â Â PTRACE_DETACH = 17,
+#define PT_DETACH PTRACE_DETACH
+
+Â Â /* Get all extended floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_GETFPXREGS = 18,
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+
+Â Â /* Set all extended floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_SETFPXREGS = 19,
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+
+  /* Continue and stop at the next (return from) syscall.  */
+Â Â PTRACE_SYSCALL = 24,
+#define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Read a TLS entry in the GDT.  */
+Â Â PTRACE_GET_THREAD_AREA = 25,
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+
+  /* Write a TLS entry in the GDT.  */
+Â Â PTRACE_SET_THREAD_AREA = 26,
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+
+  /* Continue and stop on entry to the next system call.  */
+Â Â PTRACE_SYSEMU = 31,
+#define PT_SYSEMU PTRACE_SYSEMU
+
+  /* Single-step if not entry to a system call.  */
+Â Â PTRACE_SYSEMU_SINGLESTEP = 32,
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+
+  /* Set ptrace filter options.  */
+Â Â PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+Â Â PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+Â Â PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+Â Â PTRACE_SETSIGINFO = 0x4203,
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+  /* Get register content.  */
+Â Â PTRACE_GETREGSET = 0x4204,
+#define PTRACE_GETREGSET PTRACE_GETREGSET
+
+  /* Set register content.  */
+Â Â PTRACE_SETREGSET = 0x4205,
+#define PTRACE_SETREGSET PTRACE_SETREGSET
+
+Â Â /* Like PTRACE_ATTACH, but do not force tracee to trap and do not
affect
+     signal or group stop state.  */
+Â Â PTRACE_SEIZE = 0x4206,
+#define PTRACE_SEIZE PTRACE_SEIZE
+
+  /* Trap seized tracee.  */
+Â Â PTRACE_INTERRUPT = 0x4207,
+#define PTRACE_INTERRUPT PTRACE_INTERRUPT
+
+  /* Wait for next group event.  */
+Â Â PTRACE_LISTEN = 0x4208,
+#define PTRACE_LISTEN PTRACE_LISTEN
+
+Â Â PTRACE_PEEKSIGINFO = 0x4209,
+#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
+
+Â Â PTRACE_GETSIGMASK = 0x420a,
+#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
+
+Â Â PTRACE_SETSIGMASK = 0x420b,
+#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
+
+Â Â PTRACE_SECCOMP_GET_FILTER = 0x420c
+#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
+};
+
+
+/* Flag for PTRACE_LISTEN.  */
+enum __ptrace_flags
+{
+Â Â PTRACE_SEIZE_DEVEL = 0x80000000
+};
+
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions
+{
+Â Â PTRACE_O_TRACESYSGOOD = 0x00000001,
+Â Â PTRACE_O_TRACEFORK = 0x00000002,
+Â Â PTRACE_O_TRACEVFORKÂ Â Â = 0x00000004,
+Â Â PTRACE_O_TRACECLONE = 0x00000008,
+Â Â PTRACE_O_TRACEEXEC = 0x00000010,
+Â Â PTRACE_O_TRACEVFORKDONE = 0x00000020,
+Â Â PTRACE_O_TRACEEXIT = 0x00000040,
+Â Â PTRACE_O_TRACESECCOMP = 0x00000080,
+Â Â PTRACE_O_EXITKILL = 0x00100000,
+Â Â PTRACE_O_SUSPEND_SECCOMP = 0x00200000,
+Â Â PTRACE_O_MASK = 0x003000ff
+};
+
+enum __ptrace_eventcodes
+{
+/* Wait extended result codes for the above trace options.  */
+Â Â PTRACE_EVENT_FORK = 1,
+Â Â PTRACE_EVENT_VFORK = 2,
+Â Â PTRACE_EVENT_CLONE = 3,
+Â Â PTRACE_EVENT_EXEC = 4,
+Â Â PTRACE_EVENT_VFORK_DONE = 5,
+Â Â PTRACE_EVENT_EXIT = 6,
+Â Â PTRACE_EVENT_SECCOMPÂ Â = 7,
+/* Extended result codes enabled by means other than options.  */
+Â Â PTRACE_EVENT_STOP = 128
+};
+
+/* Arguments for PTRACE_PEEKSIGINFO.  */
+struct __ptrace_peeksiginfo_args
+{
+  __uint64_t off; /* From which siginfo to start.  */
+  __uint32_t flags; /* Flags for peeksiginfo.  */
+  __int32_t nr; /* How many siginfos to take.  */
+};
+
+enum __ptrace_peeksiginfo_flags
+{
+  /* Read signals from a shared (process wide) queue.  */
+Â Â PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
+};
+
+/* Perform process tracing functions.  REQUEST is one of the values
+Â Â Â above, and determines the action to be taken.
+Â Â Â For all requests except PTRACE_TRACEME, PID specifies the process
to be
+Â Â Â traced.
+
+Â Â Â PID and the other arguments described above for the various
requests should
+Â Â Â appear (those that are used for the particular request) as:
+Â Â Â Â Â pid_t PID, void *ADDR, int DATA, void *ADDR2
+   after REQUEST.  */
+extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_PTRACE_H */
b/sysdeps/unix/sysv/linux/x86_64/sys/ptrace.h
new file mode 100644
@@ -0,0 +1,249 @@
+/* `ptrace' debugger support interface.  Linux/x86_64 version.
+Â Â Â Copyright (C) 1996-2017 Free Software Foundation, Inc.
+Â Â Â This file is part of the GNU C Library.
+
+Â Â Â The GNU C Library is free software; you can redistribute it and/or
+Â Â Â modify it under the terms of the GNU Lesser General Public
+Â Â Â License as published by the Free Software Foundation; either
+Â Â Â version 2.1 of the License, or (at your option) any later version.
+
+Â Â Â The GNU C Library is distributed in the hope that it will be
useful,
+Â Â Â but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Â Â Â Lesser General Public License for more details.
+
+Â Â Â You should have received a copy of the GNU Lesser General Public
+Â Â Â License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H 1
+
+#include <features.h>
+#include <bits/types.h>
+
+__BEGIN_DECLS
+
+/* Type of the REQUEST argument to `ptrace.'Â Â */
+enum __ptrace_request
+{
+Â Â /* Indicate that the process making this request should be traced.
+Â Â Â Â Â All signals received by this process can be intercepted by its
+     parent, and its parent can use the other `ptrace' requests.  */
+Â Â PTRACE_TRACEME = 0,
+#define PT_TRACE_ME PTRACE_TRACEME
+
+  /* Return the word in the process's text space at address ADDR.  */
+Â Â PTRACE_PEEKTEXT = 1,
+#define PT_READ_I PTRACE_PEEKTEXT
+
+  /* Return the word in the process's data space at address ADDR.  */
+Â Â PTRACE_PEEKDATA = 2,
+#define PT_READ_D PTRACE_PEEKDATA
+
+  /* Return the word in the process's user area at offset ADDR.  */
+Â Â PTRACE_PEEKUSER = 3,
+#define PT_READ_U PTRACE_PEEKUSER
+
+Â Â /* Write the word DATA into the process's text space at address
ADDR.  */
+Â Â PTRACE_POKETEXT = 4,
+#define PT_WRITE_I PTRACE_POKETEXT
+
+Â Â /* Write the word DATA into the process's data space at address
ADDR.  */
+Â Â PTRACE_POKEDATA = 5,
+#define PT_WRITE_D PTRACE_POKEDATA
+
+Â Â /* Write the word DATA into the process's user area at offset
ADDR.  */
+Â Â PTRACE_POKEUSER = 6,
+#define PT_WRITE_U PTRACE_POKEUSER
+
+  /* Continue the process.  */
+Â Â PTRACE_CONT = 7,
+#define PT_CONTINUE PTRACE_CONT
+
+  /* Kill the process.  */
+Â Â PTRACE_KILL = 8,
+#define PT_KILL PTRACE_KILL
+
+Â Â /* Single step the process.
+     This is not supported on all machines.  */
+Â Â PTRACE_SINGLESTEP = 9,
+#define PT_STEP PTRACE_SINGLESTEP
+
+Â Â /* Get all general purpose registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_GETREGS = 12,
+#define PT_GETREGS PTRACE_GETREGS
+
+Â Â /* Set all general purpose registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_SETREGS = 13,
+#define PT_SETREGS PTRACE_SETREGS
+
+Â Â /* Get all floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_GETFPREGS = 14,
+#define PT_GETFPREGS PTRACE_GETFPREGS
+
+Â Â /* Set all floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_SETFPREGS = 15,
+#define PT_SETFPREGS PTRACE_SETFPREGS
+
+Â Â /* Attach to a process that is already running. */
+Â Â PTRACE_ATTACH = 16,
+#define PT_ATTACH PTRACE_ATTACH
+
+  /* Detach from a process attached to with PTRACE_ATTACH.  */
+Â Â PTRACE_DETACH = 17,
+#define PT_DETACH PTRACE_DETACH
+
+Â Â /* Get all extended floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_GETFPXREGS = 18,
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+
+Â Â /* Set all extended floating point registers used by a processes.
+     This is not supported on all machines.  */
+Â Â Â PTRACE_SETFPXREGS = 19,
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+
+  /* Continue and stop at the next (return from) syscall.  */
+Â Â PTRACE_SYSCALL = 24,
+#define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Read a TLS entry in the GDT.  */
+Â Â PTRACE_GET_THREAD_AREA = 25,
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+
+  /* Write a TLS entry in the GDT.  */
+Â Â PTRACE_SET_THREAD_AREA = 26,
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+
+  /* Access TLS data on 64 bit processes.  */
+Â Â PTRACE_ARCH_PRCTL = 30,
+#define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
+
+  /* Continue and stop on entry to the next system call.  */
+Â Â PTRACE_SYSEMU = 31,
+#define PT_SYSEMU PTRACE_SYSEMU
+
+  /* Single-step if not entry to a system call.  */
+Â Â PTRACE_SYSEMU_SINGLESTEP = 32,
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+
+  /* Set ptrace filter options.  */
+Â Â PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+Â Â PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+Â Â PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+Â Â PTRACE_SETSIGINFO = 0x4203,
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+  /* Get register content.  */
+Â Â PTRACE_GETREGSET = 0x4204,
+#define PTRACE_GETREGSET PTRACE_GETREGSET
+
+  /* Set register content.  */
+Â Â PTRACE_SETREGSET = 0x4205,
+#define PTRACE_SETREGSET PTRACE_SETREGSET
+
+Â Â /* Like PTRACE_ATTACH, but do not force tracee to trap and do not
affect
+     signal or group stop state.  */
+Â Â PTRACE_SEIZE = 0x4206,
+#define PTRACE_SEIZE PTRACE_SEIZE
+
+  /* Trap seized tracee.  */
+Â Â PTRACE_INTERRUPT = 0x4207,
+#define PTRACE_INTERRUPT PTRACE_INTERRUPT
+
+  /* Wait for next group event.  */
+Â Â PTRACE_LISTEN = 0x4208,
+#define PTRACE_LISTEN PTRACE_LISTEN
+
+Â Â PTRACE_PEEKSIGINFO = 0x4209,
+#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
+
+Â Â PTRACE_GETSIGMASK = 0x420a,
+#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
+
+Â Â PTRACE_SETSIGMASK = 0x420b,
+#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
+
+Â Â PTRACE_SECCOMP_GET_FILTER = 0x420c
+#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
+};
+
+
+/* Flag for PTRACE_LISTEN.  */
+enum __ptrace_flags
+{
+Â Â PTRACE_SEIZE_DEVEL = 0x80000000
+};
+
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions
+{
+Â Â PTRACE_O_TRACESYSGOOD = 0x00000001,
+Â Â PTRACE_O_TRACEFORK = 0x00000002,
+Â Â PTRACE_O_TRACEVFORKÂ Â Â = 0x00000004,
+Â Â PTRACE_O_TRACECLONE = 0x00000008,
+Â Â PTRACE_O_TRACEEXEC = 0x00000010,
+Â Â PTRACE_O_TRACEVFORKDONE = 0x00000020,
+Â Â PTRACE_O_TRACEEXIT = 0x00000040,
+Â Â PTRACE_O_TRACESECCOMP = 0x00000080,
+Â Â PTRACE_O_EXITKILL = 0x00100000,
+Â Â PTRACE_O_SUSPEND_SECCOMP = 0x00200000,
+Â Â PTRACE_O_MASK = 0x003000ff
+};
+
+enum __ptrace_eventcodes
+{
+/* Wait extended result codes for the above trace options.  */
+Â Â PTRACE_EVENT_FORK = 1,
+Â Â PTRACE_EVENT_VFORK = 2,
+Â Â PTRACE_EVENT_CLONE = 3,
+Â Â PTRACE_EVENT_EXEC = 4,
+Â Â PTRACE_EVENT_VFORK_DONE = 5,
+Â Â PTRACE_EVENT_EXIT = 6,
+Â Â PTRACE_EVENT_SECCOMPÂ Â = 7,
+/* Extended result codes enabled by means other than options.  */
+Â Â PTRACE_EVENT_STOP = 128
+};
+
+/* Arguments for PTRACE_PEEKSIGINFO.  */
+struct __ptrace_peeksiginfo_args
+{
+  __uint64_t off; /* From which siginfo to start.  */
+  __uint32_t flags; /* Flags for peeksiginfo.  */
+  __int32_t nr; /* How many siginfos to take.  */
+};
+
+enum __ptrace_peeksiginfo_flags
+{
+  /* Read signals from a shared (process wide) queue.  */
+Â Â PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
+};
+
+/* Perform process tracing functions.  REQUEST is one of the values
+Â Â Â above, and determines the action to be taken.
+Â Â Â For all requests except PTRACE_TRACEME, PID specifies the process
to be
+Â Â Â traced.
+
+Â Â Â PID and the other arguments described above for the various
requests should
+Â Â Â appear (those that are used for the particular request) as: