History

ptrace: Migrate to use SYSCALL_TRACE flag

On architectures using the generic syscall entry code the architecture independent syscall work is moved to flags in thread_info::syscall_work. This removes architecture dependencies and frees up TIF bits. Define SYSCALL_WORK_SYSCALL_TRACE, use it in the generic entry code and convert the code which uses the TIF specific helper functions to use the new *_syscall_work() helpers which either resolve to the new mode for users of the generic entry code or to the TIF based functions for the other architectures.

Gabriel Krisman Bertazi committed 5 years ago

Commit 64c19ba1 parent 524666c7 files · +31 −25Browse files

Showing the changes to kernel (3 of 7 files). Show all

Unified · Split

3 files
  1. kernel/entry/common.c +2 −2
  2. kernel/fork.c +1 −1
  3. kernel/ptrace.c +3 −3
kernel/entry/common.c+2−2
@@ -47,7 +47,7 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall, · 46 unmodified lines
4747 long ret = 0;
4848
4949 /* Handle ptrace */
50− if (ti_work & (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU)) {
50+ if (work & SYSCALL_WORK_SYSCALL_TRACE || ti_work & _TIF_SYSCALL_EMU) {
5151 ret = arch_syscall_enter_tracehook(regs);
5252 if (ret || (ti_work & _TIF_SYSCALL_EMU))
5353 return -1L;
@@ -237,7 +237,7 @@ static void syscall_exit_work(struct pt_regs *regs, unsigned long ti_work, · 183 unmodified lines
237237 trace_sys_exit(regs, syscall_get_return_value(current, regs));
238238
239239 step = report_single_step(ti_work);
240− if (step || ti_work & _TIF_SYSCALL_TRACE)
240+ if (step || work & SYSCALL_WORK_SYSCALL_TRACE)
241241 arch_syscall_exit_tracehook(regs, step);
242242 }
243243
kernel/fork.c+1−1
@@ -2158,7 +2158,7 @@ static __latent_entropy struct task_struct *copy_process( · 2157 unmodified lines
21582158 * child regardless of CLONE_PTRACE.
21592159 */
21602160 user_disable_single_step(p);
2161− clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
2161+ clear_task_syscall_work(p, SYSCALL_TRACE);
21622162 #ifdef TIF_SYSCALL_EMU
21632163 clear_tsk_thread_flag(p, TIF_SYSCALL_EMU);
21642164 #endif
kernel/ptrace.c+3−3
@@ -117,7 +117,7 @@ void __ptrace_unlink(struct task_struct *child) · 116 unmodified lines
117117 const struct cred *old_cred;
118118 BUG_ON(!child->ptrace);
119119
120− clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
120+ clear_task_syscall_work(child, SYSCALL_TRACE);
121121 #ifdef TIF_SYSCALL_EMU
122122 clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
123123 #endif
@@ -812,9 +812,9 @@ static int ptrace_resume(struct task_struct *child, long request, · 688 unmodified lines
812812 return -EIO;
813813
814814 if (request == PTRACE_SYSCALL)
815− set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
815+ set_task_syscall_work(child, SYSCALL_TRACE);
816816 else
817− clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
817+ clear_task_syscall_work(child, SYSCALL_TRACE);
818818
819819 #ifdef TIF_SYSCALL_EMU
820820 if (request == PTRACE_SYSEMU || request == PTRACE_SYSEMU_SINGLESTEP)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t