User mode linux is the last user of the PT_DTRACE flag. Using the flag to indicate single stepping is a little confusing and worse changing tsk->ptrace without locking could potentionally cause problems. So use a thread info flag with a better name instead of flag in tsk->ptrace. Remove the definition PT_DTRACE as uml is the last user.
Unified · Split
| @@ -60,6 +60,7 @@ static inline struct thread_info *current_thread_info(void) · 59 unmodified lines | |||
| 60 | #define TIF_RESTORE_SIGMASK 7 | 60 | #define TIF_RESTORE_SIGMASK 7 |
| 61 | #define TIF_NOTIFY_RESUME 8 | 61 | #define TIF_NOTIFY_RESUME 8 |
| 62 | #define TIF_SECCOMP 9 /* secure computing */ | 62 | #define TIF_SECCOMP 9 /* secure computing */ |
| 63 | #define TIF_SINGLESTEP 10 /* single stepping userspace */ | ||
| 63 | 64 | ||
| 64 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 65 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
| 65 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 66 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
| @@ -68,5 +69,6 @@ static inline struct thread_info *current_thread_info(void) · 2 unmodified lines | |||
| 68 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) | 69 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) |
| 69 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | 70 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) |
| 70 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | 71 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) |
| 72 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | ||
| 71 | 73 | ||
| 72 | #endif | 74 | #endif |
| @@ -43,7 +43,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) · 42 unmodified lines | |||
| 43 | { | 43 | { |
| 44 | PT_REGS_IP(regs) = eip; | 44 | PT_REGS_IP(regs) = eip; |
| 45 | PT_REGS_SP(regs) = esp; | 45 | PT_REGS_SP(regs) = esp; |
| 46 | current->ptrace &= ~PT_DTRACE; | 46 | clear_thread_flag(TIF_SINGLESTEP); |
| 47 | #ifdef SUBARCH_EXECVE1 | 47 | #ifdef SUBARCH_EXECVE1 |
| 48 | SUBARCH_EXECVE1(regs->regs); | 48 | SUBARCH_EXECVE1(regs->regs); |
| 49 | #endif | 49 | #endif |
| @@ -335,7 +335,7 @@ int singlestepping(void * t) · 334 unmodified lines | |||
| 335 | { | 335 | { |
| 336 | struct task_struct *task = t ? t : current; | 336 | struct task_struct *task = t ? t : current; |
| 337 | 337 | ||
| 338 | if (!(task->ptrace & PT_DTRACE)) | 338 | if (!test_thread_flag(TIF_SINGLESTEP)) |
| 339 | return 0; | 339 | return 0; |
| 340 | 340 | ||
| 341 | if (task->thread.singlestep_syscall) | 341 | if (task->thread.singlestep_syscall) |
| @@ -11,7 +11,7 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | void user_enable_single_step(struct task_struct *child) | 12 | void user_enable_single_step(struct task_struct *child) |
| 13 | { | 13 | { |
| 14 | child->ptrace |= PT_DTRACE; | 14 | set_tsk_thread_flag(child, TIF_SINGLESTEP); |
| 15 | child->thread.singlestep_syscall = 0; | 15 | child->thread.singlestep_syscall = 0; |
| 16 | 16 | ||
| 17 | #ifdef SUBARCH_SET_SINGLESTEPPING | 17 | #ifdef SUBARCH_SET_SINGLESTEPPING |
| @@ -21,7 +21,7 @@ void user_enable_single_step(struct task_struct *child) · 3 unmodified lines | |||
| 21 | 21 | ||
| 22 | void user_disable_single_step(struct task_struct *child) | 22 | void user_disable_single_step(struct task_struct *child) |
| 23 | { | 23 | { |
| 24 | child->ptrace &= ~PT_DTRACE; | 24 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); |
| 25 | child->thread.singlestep_syscall = 0; | 25 | child->thread.singlestep_syscall = 0; |
| 26 | 26 | ||
| 27 | #ifdef SUBARCH_SET_SINGLESTEPPING | 27 | #ifdef SUBARCH_SET_SINGLESTEPPING |
| @@ -120,7 +120,7 @@ static void send_sigtrap(struct uml_pt_regs *regs, int error_code) · 92 unmodified lines | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | /* | 122 | /* |
| 123 | * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and | 123 | * XXX Check TIF_SINGLESTEP for singlestepping check and |
| 124 | * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check | 124 | * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check |
| 125 | */ | 125 | */ |
| 126 | int syscall_trace_enter(struct pt_regs *regs) | 126 | int syscall_trace_enter(struct pt_regs *regs) |
| @@ -144,7 +144,7 @@ void syscall_trace_leave(struct pt_regs *regs) · 17 unmodified lines | |||
| 144 | audit_syscall_exit(regs); | 144 | audit_syscall_exit(regs); |
| 145 | 145 | ||
| 146 | /* Fake a debug trap */ | 146 | /* Fake a debug trap */ |
| 147 | if (ptraced & PT_DTRACE) | 147 | if (test_thread_flag(TIF_SINGLESTEP)) |
| 148 | send_sigtrap(®s->regs, 0); | 148 | send_sigtrap(®s->regs, 0); |
| 149 | 149 | ||
| 150 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 150 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
| @@ -53,7 +53,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) · 52 unmodified lines | |||
| 53 | unsigned long sp; | 53 | unsigned long sp; |
| 54 | int err; | 54 | int err; |
| 55 | 55 | ||
| 56 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | 56 | if (test_thread_flag(TIF_SINGLESTEP) && (current->ptrace & PT_PTRACED)) |
| 57 | singlestep = 1; | 57 | singlestep = 1; |
| 58 | 58 | ||
| 59 | /* Did we come from a system call? */ | 59 | /* Did we come from a system call? */ |
| @@ -128,7 +128,7 @@ void do_signal(struct pt_regs *regs) · 68 unmodified lines | |||
| 128 | * on the host. The tracing thread will check this flag and | 128 | * on the host. The tracing thread will check this flag and |
| 129 | * PTRACE_SYSCALL if necessary. | 129 | * PTRACE_SYSCALL if necessary. |
| 130 | */ | 130 | */ |
| 131 | if (current->ptrace & PT_DTRACE) | 131 | if (test_thread_flag(TIF_SINGLESTEP)) |
| 132 | current->thread.singlestep_syscall = | 132 | current->thread.singlestep_syscall = |
| 133 | is_syscall(PT_REGS_IP(¤t->thread.regs)); | 133 | is_syscall(PT_REGS_IP(¤t->thread.regs)); |
| 134 | 134 | ||
| @@ -30,7 +30,6 @@ extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr, · 29 unmodified lines | |||
| 30 | 30 | ||
| 31 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ | 31 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ |
| 32 | #define PT_PTRACED 0x00000001 | 32 | #define PT_PTRACED 0x00000001 |
| 33 | #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ | ||
| 34 | 33 | ||
| 35 | #define PT_OPT_FLAG_SHIFT 3 | 34 | #define PT_OPT_FLAG_SHIFT 3 |
| 36 | /* PT_TRACE_* event enable flags */ | 35 | /* PT_TRACE_* event enable flags */ |