Skip to content

Commit 5a6dff3

Browse files
committed
Include <sys/ptrace.h> early
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>.
1 parent f2bb704 commit 5a6dff3

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

process.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
# include <elf.h>
4242
#endif
4343

44-
#include "xlat/nt_descriptor_types.h"
45-
46-
#include "regs.h"
4744
#include "ptrace.h"
45+
#include "regs.h"
46+
47+
#include "xlat/nt_descriptor_types.h"
4848
#include "xlat/ptrace_cmds.h"
4949
#include "xlat/ptrace_setoptions_flags.h"
5050
#include "xlat/ptrace_peeksiginfo_flags.h"

rt_sigframe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
*/
2727

2828
#include "defs.h"
29-
#include "regs.h"
3029
#include "ptrace.h"
30+
#include "regs.h"
3131

3232
#define DEF_FUNC_GET_RT_SIGFRAME_ADDR \
3333
kernel_ulong_t get_rt_sigframe_addr(struct tcb *tcp)

sigreturn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "defs.h"
2+
#include "ptrace.h"
23
#include "nsig.h"
34
#include "regs.h"
4-
#include "ptrace.h"
55

66
#if defined HAVE_ASM_SIGCONTEXT_H && !defined HAVE_STRUCT_SIGCONTEXT
77
# include <asm/sigcontext.h>

strace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <stdarg.h>
3434
#include <limits.h>
3535
#include <fcntl.h>
36+
#include "ptrace.h"
3637
#include <signal.h>
3738
#include <sys/resource.h>
3839
#include <sys/wait.h>
@@ -52,7 +53,6 @@
5253
#include "largefile_wrappers.h"
5354
#include "number_set.h"
5455
#include "scno.h"
55-
#include "ptrace.h"
5656
#include "printsiginfo.h"
5757
#include "trace_event.h"
5858
#include "xstring.h"

syscall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#include "defs.h"
3636
#include "native_defs.h"
37+
#include "ptrace.h"
3738
#include "nsig.h"
3839
#include "number_set.h"
3940
#include <limits.h>
@@ -45,7 +46,6 @@
4546
#include <asm/unistd.h>
4647

4748
#include "regs.h"
48-
#include "ptrace.h"
4949

5050
#if defined(SPARC64)
5151
# undef PTRACE_GETREGS

tests/ptrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
#include <asm/unistd.h>
3333

3434
#include <errno.h>
35+
#include "ptrace.h"
3536
#include <signal.h>
3637
#include <stdio.h>
3738
#include <string.h>
3839
#include <sys/wait.h>
3940
#include <unistd.h>
40-
#include "ptrace.h"
4141
#include <linux/audit.h>
4242

4343
static const char *errstr;

tests/test_ucopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
#include "tests.h"
3131

3232
#include <errno.h>
33+
#include <sys/ptrace.h>
3334
#include <signal.h>
3435
#include <stdlib.h>
3536
#include <unistd.h>
36-
#include <sys/ptrace.h>
3737
#include <sys/uio.h>
3838
#include <sys/wait.h>
3939

wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
*/
3535

3636
#include "defs.h"
37+
#include "ptrace.h"
3738

3839
#include <sys/wait.h>
3940

@@ -58,7 +59,6 @@
5859
# define W_CONTINUED 0xffff
5960
#endif
6061

61-
#include "ptrace.h"
6262
#include "xlat/ptrace_events.h"
6363

6464
static int

0 commit comments

Comments
 (0)