]> granicus.if.org Git - strace/commitdiff
Include <sys/ptrace.h> early
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 11 Feb 2018 00:26:09 +0000 (00:26 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 11 Feb 2018 00:26:09 +0000 (00:26 +0000)
Include "ptrace.h" before any header that can include <signal.h>
because on some architectures the latter may include <asm/sigcontext.h>
which in turn may include <asm/ptrace.h> with potentially devastating
effect on <sys/ptrace.h>.

* process.c: Include "ptrace.h" before "regs.h".
* rt_sigframe.c: Likewise.
* sigreturn.c: Include "ptrace.h" before "nsig.h".
* syscall.c: Likewise.
* wait.c: Include "ptrace.h" before <sys/wait.h>.
* strace.c: Include "ptrace.h" before <signal.h>.
* tests/ptrace.c: Likewise.
* tests/test_ucopy.c: Include <sys/ptrace.h> before <signal.h>.

process.c
rt_sigframe.c
sigreturn.c
strace.c
syscall.c
tests/ptrace.c
tests/test_ucopy.c
wait.c

index b36cd4bc83ca43fcc2392713ac7c6ec851af877a..5690e13e2824dd11f9cb74bcc8cd04880cdc0c06 100644 (file)
--- a/process.c
+++ b/process.c
 # include <elf.h>
 #endif
 
-#include "xlat/nt_descriptor_types.h"
-
-#include "regs.h"
 #include "ptrace.h"
+#include "regs.h"
+
+#include "xlat/nt_descriptor_types.h"
 #include "xlat/ptrace_cmds.h"
 #include "xlat/ptrace_setoptions_flags.h"
 #include "xlat/ptrace_peeksiginfo_flags.h"
index d9bcb4ffa24b7faedb230a35e28f525c7afd14c1..6093043bc02c631cb04d84583230d42b4a7ee80c 100644 (file)
@@ -26,8 +26,8 @@
  */
 
 #include "defs.h"
-#include "regs.h"
 #include "ptrace.h"
+#include "regs.h"
 
 #define        DEF_FUNC_GET_RT_SIGFRAME_ADDR   \
                kernel_ulong_t get_rt_sigframe_addr(struct tcb *tcp)
index b2eeb7a4a103154688df4dd3737eb659f9929b34..bfc6f17bbf42e0ae2c94a6b1cec05919e8acdc67 100644 (file)
@@ -1,7 +1,7 @@
 #include "defs.h"
+#include "ptrace.h"
 #include "nsig.h"
 #include "regs.h"
-#include "ptrace.h"
 
 #if defined HAVE_ASM_SIGCONTEXT_H && !defined HAVE_STRUCT_SIGCONTEXT
 # include <asm/sigcontext.h>
index 042c2eeaf3d558422698947e3f8a33a9fcf0f201..d2a1bca5bc491693b3626d15f756df1583b4b6ee 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -33,6 +33,7 @@
 #include <stdarg.h>
 #include <limits.h>
 #include <fcntl.h>
+#include "ptrace.h"
 #include <signal.h>
 #include <sys/resource.h>
 #include <sys/wait.h>
@@ -52,7 +53,6 @@
 #include "largefile_wrappers.h"
 #include "number_set.h"
 #include "scno.h"
-#include "ptrace.h"
 #include "printsiginfo.h"
 #include "trace_event.h"
 #include "xstring.h"
index df169259227fd19c270b0b22af9a5cd083aebdc5..e5963f9416bb2ef210c8b9b8e534e0ca3e109b1c 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -34,6 +34,7 @@
 
 #include "defs.h"
 #include "native_defs.h"
+#include "ptrace.h"
 #include "nsig.h"
 #include "number_set.h"
 #include <limits.h>
@@ -45,7 +46,6 @@
 #include <asm/unistd.h>
 
 #include "regs.h"
-#include "ptrace.h"
 
 #if defined(SPARC64)
 # undef PTRACE_GETREGS
index d776dcdd23384147f57c27c29e64d0fd139f3933..0f008d937f55787b5ef7fa6ac98fb4966ebfc8a8 100644 (file)
 #include <asm/unistd.h>
 
 #include <errno.h>
+#include "ptrace.h"
 #include <signal.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include "ptrace.h"
 #include <linux/audit.h>
 
 static const char *errstr;
index 9ddffbca41b74f9437a00f82d55a2dab798ac871..f4507e9a25152e62beb6093b59f89408b350bcaf 100644 (file)
 #include "tests.h"
 
 #include <errno.h>
+#include <sys/ptrace.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <sys/ptrace.h>
 #include <sys/uio.h>
 #include <sys/wait.h>
 
diff --git a/wait.c b/wait.c
index 0f1aa00133d31c33cb45d9a57bf104d023f135c4..b117390fd0e954a44d49a731afdee9a372909dd1 100644 (file)
--- a/wait.c
+++ b/wait.c
@@ -34,6 +34,7 @@
  */
 
 #include "defs.h"
+#include "ptrace.h"
 
 #include <sys/wait.h>
 
@@ -58,7 +59,6 @@
 # define W_CONTINUED 0xffff
 #endif
 
-#include "ptrace.h"
 #include "xlat/ptrace_events.h"
 
 static int