arch: ptrace: Cleanup ptrace_disable
Subsystems (9)
cover arch: ptrace: Cleanup ptrace_disable
From: Guo Ren <[email protected]>
This series cleanup ptrace_disable() in arch/*. Some architectures are duplicate clearing SYSCALL TRACE.
Guo Ren (3):
riscv: ptrace: Remove duplicate operation
openrisc: ptrace: Remove duplicate operation
arch: ptrace: Cleanup ptrace_disable
arch/arc/kernel/ptrace.c | 4 ---- arch/arm/kernel/ptrace.c | 8 -------- arch/microblaze/kernel/ptrace.c | 5 ----- arch/nios2/kernel/ptrace.c | 5 ----- arch/openrisc/kernel/ptrace.c | 1 - arch/riscv/kernel/ptrace.c | 5 ----- arch/sparc/kernel/ptrace_32.c | 10 ---------- arch/sparc/kernel/ptrace_64.c | 10 ---------- kernel/ptrace.c | 8 ++++++++ 9 files changed, 8 insertions(+), 48 deletions(-)
Signature · 1 line
2.36.1
PATCH 1/3 riscv: ptrace: Remove duplicate operation
From: Guo Ren <[email protected]>
The TIF_SYSCALL_TRACE is controlled by a common code, see kernel/ptrace.c and include/linux/thread.h.
clear_task_syscall_work(child, SYSCALL_TRACE);
--- arch/riscv/kernel/ptrace.c | 1 - 1 file changed, 1 deletion(-)
arch/riscv/kernel/ptrace.c +0 -1
@@ -212,7 +212,6 @@ unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)void ptrace_disable (struct task_struct *child) { -clear_tsk_thread_flag (child,TIF_SYSCALL_TRACE ); } long arch_ptrace(struct task_struct *child, long request,
Signature · 1 line
2.36.1
PATCH 2/3 openrisc: ptrace: Remove duplicate operation
In reply to [email protected]From: Guo Ren <[email protected]>
The TIF_SYSCALL_TRACE is controlled by a common code, see kernel/ptrace.c and include/linux/thread.h.
clear_task_syscall_work(child, SYSCALL_TRACE);
--- arch/openrisc/kernel/ptrace.c | 1 - 1 file changed, 1 deletion(-)
arch/openrisc/kernel/ptrace.c +0 -1
@@ -132,7 +132,6 @@ void ptrace_disable(struct task_struct *child)pr_debug ("ptrace_disable(): TODO\n" );user_disable_single_step (child); -clear_tsk_thread_flag (child,TIF_SYSCALL_TRACE ); } long arch_ptrace(struct task_struct *child, long request, unsigned long addr,
Signature · 1 line
2.36.1
PATCH 3/3 arch: ptrace: Cleanup ptrace_disable
In reply to [email protected]From: Guo Ren <[email protected]>
Add a weak empty function in common and remove architectures' duplicated ones.
--- arch/arc/kernel/ptrace.c | 4 ---- arch/arm/kernel/ptrace.c | 8 -------- arch/microblaze/kernel/ptrace.c | 5 ----- arch/nios2/kernel/ptrace.c | 5 ----- arch/riscv/kernel/ptrace.c | 4 ---- arch/sparc/kernel/ptrace_32.c | 10 ---------- arch/sparc/kernel/ptrace_64.c | 10 ---------- kernel/ptrace.c | 8 ++++++++ 8 files changed, 8 insertions(+), 46 deletions(-)
arch/arc/kernel/ptrace.c +0 -4
@@ -317,10 +317,6 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)return &user_arc_view; } -void ptrace_disable (struct task_struct *child) -{ -} -long arch_ptrace (struct task_struct *child,long request,unsigned long addr,unsigned long data) {
arch/arm/kernel/ptrace.c +0 -8
@@ -186,14 +186,6 @@ put_user_reg(struct task_struct *task, int offset, long data)return ret; } -/* -* Called by kernel/ptrace.c when detaching.. -*/ -void ptrace_disable (struct task_struct *child) -{ -/* Nothing to do. */ -} -/* * Handle hitting a breakpoint. */
arch/microblaze/kernel/ptrace.c +0 -5
@@ -162,8 +162,3 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)if (step ||test_thread_flag (TIF_SYSCALL_TRACE ))ptrace_report_syscall_exit (regs, step); } - -void ptrace_disable (struct task_struct *child) -{ -/* nothing to do */ -}
arch/nios2/kernel/ptrace.c +0 -5
@@ -117,11 +117,6 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)return &nios2_user_view; } -void ptrace_disable (struct task_struct *child) -{ - -} -long arch_ptrace (struct task_struct *child,long request,unsigned long addr,unsigned long data) {
arch/riscv/kernel/ptrace.c +0 -4
@@ -210,10 +210,6 @@ unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)return 0 ; } -void ptrace_disable (struct task_struct *child) -{ -} -long arch_ptrace (struct task_struct *child,long request,unsigned long addr,unsigned long data) {
arch/sparc/kernel/ptrace_32.c +0 -10
@@ -29,16 +29,6 @@/* #define ALLOW_INIT_TRACING */ -/* -* Called by kernel/ptrace.c when detaching.. -* -* Make sure single step bits etc are not set. -*/ -void ptrace_disable (struct task_struct *child) -{ -/* nothing to do */ -} -enum sparc_regset {REGSET_GENERAL ,REGSET_FP ,
arch/sparc/kernel/ptrace_64.c +0 -10
@@ -83,16 +83,6 @@ static const struct pt_regs_offset regoffset_table[] = { REG_OFFSET_END, }; -/* -* Called by kernel/ptrace.c when detaching.. -* -* Make sure single step bits etc are not set. -*/ -void ptrace_disable (struct task_struct *child) -{ -/* nothing to do */ -} -/* To get the necessary page struct, access_process_vm() first calls * get_user_pages(). This has done a flush_dcache_page() on the * accessed page. Then our caller (copy_{to,from}_user_page()) did
kernel/ptrace.c +8 -0
@@ -579,6 +579,14 @@ static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)return dead; } +__weak void ptrace_disable (struct task_struct *child) +{ +/* +* Nothing to do.., some architectures would replace it with +* their own function. +*/ +} +static int ptrace_detach (struct task_struct *child,unsigned int data) {if (!valid_signal (data))
Signature · 1 line
2.36.1
Re: [PATCH 2/3] openrisc: ptrace: Remove duplicate operation
In reply to [email protected]Quoted 9 lines · On Tue, Aug 30, 2022 at 02:53:15AM -0400, [email protected] wrote:
From: Guo Ren <[email protected]>
The
TIF_SYSCALL_TRACEis controlled by a common code, seekernel/ptrace.candinclude/linux/thread.h.
clear_task_syscall_work(child, SYSCALL_TRACE);Signed-off-by Guo Ren <[email protected]>Signed-off-by Guo Ren <[email protected]>
Quoted 19 lines
--- arch/openrisc/kernel/ptrace.c | 1 - 1 file changed, 1 deletion(-)arch/openrisc/kernel/ptrace.c +0
-1@@ -132,7 +132,6 @@ void ptrace_disable(struct task_struct *child)pr_debug ("ptrace_disable(): TODO\n" );user_disable_single_step (child); -clear_tsk_thread_flag (child,TIF_SYSCALL_TRACE ); } long arch_ptrace(struct task_struct *child, long request, unsigned long addr,Signature · 1 line
2.36.1
Quoted 11 lines · On 08/30, [email protected] wrote:
From: Guo Ren <[email protected]>
This series cleanup
ptrace_disable()inarch/*. Some architectures are duplicate clearing SYSCALL TRACE.Guo Ren (3):
riscv: ptrace: Remove duplicate operation
openrisc: ptrace: Remove duplicate operation
arch: ptrace: Cleanupptrace_disable
Quoted 10 lines
arch/arc/kernel/ptrace.c | 4 ---- arch/arm/kernel/ptrace.c | 8 -------- arch/microblaze/kernel/ptrace.c | 5 ----- arch/nios2/kernel/ptrace.c | 5 ----- arch/openrisc/kernel/ptrace.c | 1 - arch/riscv/kernel/ptrace.c | 5 ----- arch/sparc/kernel/ptrace_32.c | 10 ---------- arch/sparc/kernel/ptrace_64.c | 10 ---------- kernel/ptrace.c | 8 ++++++++ 9 files changed, 8 insertions(+), 48 deletions(-)