diff options
author | Roland McGrath <roland@redhat.com> | 2008-07-09 05:38:07 -0400 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2008-07-16 15:15:17 -0400 |
commit | d4d67150165df8bf1cc05e532f6efca96f907cab (patch) | |
tree | 390d5951231c2a1d97d6453d70c42da7af49eeae /include/asm-x86/thread_info.h | |
parent | 64f097331928b01d704047c1dbc738bb6d2a9bf9 (diff) |
x86 ptrace: unify syscall tracing
This unifies and cleans up the syscall tracing code on i386 and x86_64.
Using a single function for entry and exit tracing on 32-bit made the
do_syscall_trace() into some terrible spaghetti. The logic is clear and
simple using separate syscall_trace_enter() and syscall_trace_leave()
functions as on 64-bit.
The unification adds PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP support
on x86_64, for 32-bit ptrace() callers and for 64-bit ptrace() callers
tracing either 32-bit or 64-bit tasks. It behaves just like 32-bit.
Changing syscall_trace_enter() to return the syscall number shortens
all the assembly paths, while adding the SYSEMU feature in a simple way.
Signed-off-by: Roland McGrath <roland@redhat.com>
Diffstat (limited to 'include/asm-x86/thread_info.h')
-rw-r--r-- | include/asm-x86/thread_info.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/include/asm-x86/thread_info.h b/include/asm-x86/thread_info.h index fb8d3cdf143e..b2702a1eeac1 100644 --- a/include/asm-x86/thread_info.h +++ b/include/asm-x86/thread_info.h | |||
@@ -75,9 +75,7 @@ struct thread_info { | |||
75 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 75 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
76 | #define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/ | 76 | #define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/ |
77 | #define TIF_IRET 5 /* force IRET */ | 77 | #define TIF_IRET 5 /* force IRET */ |
78 | #ifdef CONFIG_X86_32 | ||
79 | #define TIF_SYSCALL_EMU 6 /* syscall emulation active */ | 78 | #define TIF_SYSCALL_EMU 6 /* syscall emulation active */ |
80 | #endif | ||
81 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ | 79 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ |
82 | #define TIF_SECCOMP 8 /* secure computing */ | 80 | #define TIF_SECCOMP 8 /* secure computing */ |
83 | #define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */ | 81 | #define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */ |
@@ -100,11 +98,7 @@ struct thread_info { | |||
100 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | 98 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
101 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 99 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
102 | #define _TIF_IRET (1 << TIF_IRET) | 100 | #define _TIF_IRET (1 << TIF_IRET) |
103 | #ifdef CONFIG_X86_32 | ||
104 | #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) | 101 | #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) |
105 | #else | ||
106 | #define _TIF_SYSCALL_EMU 0 | ||
107 | #endif | ||
108 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | 102 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) |
109 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | 103 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) |
110 | #define _TIF_MCE_NOTIFY (1 << TIF_MCE_NOTIFY) | 104 | #define _TIF_MCE_NOTIFY (1 << TIF_MCE_NOTIFY) |
@@ -121,11 +115,20 @@ struct thread_info { | |||
121 | #define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR) | 115 | #define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR) |
122 | #define _TIF_BTS_TRACE_TS (1 << TIF_BTS_TRACE_TS) | 116 | #define _TIF_BTS_TRACE_TS (1 << TIF_BTS_TRACE_TS) |
123 | 117 | ||
118 | /* work to do in syscall_trace_enter() */ | ||
119 | #define _TIF_WORK_SYSCALL_ENTRY \ | ||
120 | (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \ | ||
121 | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP) | ||
122 | |||
123 | /* work to do in syscall_trace_leave() */ | ||
124 | #define _TIF_WORK_SYSCALL_EXIT \ | ||
125 | (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP) | ||
126 | |||
124 | /* work to do on interrupt/exception return */ | 127 | /* work to do on interrupt/exception return */ |
125 | #define _TIF_WORK_MASK \ | 128 | #define _TIF_WORK_MASK \ |
126 | (0x0000FFFF & \ | 129 | (0x0000FFFF & \ |
127 | ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT| \ | 130 | ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT| \ |
128 | _TIF_SECCOMP|_TIF_SYSCALL_EMU)) | 131 | _TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU)) |
129 | 132 | ||
130 | /* work to do on any return to user space */ | 133 | /* work to do on any return to user space */ |
131 | #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) | 134 | #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) |