From 1bcf548293aef19b0797348332cf1dfbf2116cef Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 16 Oct 2007 01:23:45 -0700 Subject: [PATCH] Consolidate PTRACE_DETACH Identical handlers of PTRACE_DETACH go into ptrace_request(). Not touching compat code. Not touching archs that don't call ptrace_request. Signed-off-by: Alexey Dobriyan Acked-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/alpha/kernel/ptrace.c | 4 ---- arch/arm/kernel/ptrace.c | 4 ---- arch/avr32/kernel/ptrace.c | 5 ----- arch/blackfin/kernel/ptrace.c | 6 ------ arch/cris/arch-v10/kernel/ptrace.c | 4 ---- arch/cris/arch-v32/kernel/ptrace.c | 4 ---- arch/m32r/kernel/ptrace.c | 8 -------- arch/m68k/kernel/ptrace.c | 4 ---- arch/mips/kernel/ptrace.c | 4 ---- arch/parisc/kernel/ptrace.c | 4 ---- arch/powerpc/kernel/ptrace.c | 4 ---- arch/s390/kernel/ptrace.c | 5 ----- arch/sh/kernel/ptrace.c | 4 ---- arch/sh64/kernel/ptrace.c | 4 ---- arch/um/kernel/ptrace.c | 5 ----- arch/x86/kernel/ptrace_32.c | 5 ----- arch/x86/kernel/ptrace_64.c | 5 ----- arch/xtensa/kernel/ptrace.c | 4 ---- kernel/ptrace.c | 3 +++ 19 files changed, 3 insertions(+), 83 deletions(-) diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index 83a781842266..eaf4ee5f0c35 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c @@ -368,10 +368,6 @@ do_sys_ptrace(long request, long pid, long addr, long data, ret = 0; goto out; - case PTRACE_DETACH: /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - goto out; - default: ret = ptrace_request(child, request, addr, data); goto out; diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 78c9f1a3d41f..5feee722ea98 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -731,10 +731,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = 0; break; - case PTRACE_DETACH: - ret = ptrace_detach(child, data); - break; - case PTRACE_GETREGS: ret = ptrace_getregs(child, (void __user *)data); break; diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c index 39060cbeb2a3..9e16b8a447f2 100644 --- a/arch/avr32/kernel/ptrace.c +++ b/arch/avr32/kernel/ptrace.c @@ -227,11 +227,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = 0; break; - /* Detach a process that was attached */ - case PTRACE_DETACH: - ret = ptrace_detach(child, data); - break; - case PTRACE_GETREGS: ret = ptrace_getregs(child, (void __user *)data); break; diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index 64ce5fea8609..85caf9b711a1 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c @@ -385,12 +385,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; } - case PTRACE_DETACH: - { /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - } - case PTRACE_GETREGS: { diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c index f4f9db698b44..b570ae9b6cad 100644 --- a/arch/cris/arch-v10/kernel/ptrace.c +++ b/arch/cris/arch-v10/kernel/ptrace.c @@ -177,10 +177,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = 0; break; - case PTRACE_DETACH: - ret = ptrace_detach(child, data); - break; - /* Get all GP registers from the child. */ case PTRACE_GETREGS: { int i; diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c index 38ece0cd47cb..2df60529a8af 100644 --- a/arch/cris/arch-v32/kernel/ptrace.c +++ b/arch/cris/arch-v32/kernel/ptrace.c @@ -245,10 +245,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; } - case PTRACE_DETACH: - ret = ptrace_detach(child, data); - break; - /* Get all GP registers from the child. */ case PTRACE_GETREGS: { int i; diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index 62a51429306e..abbeaf8f6d0a 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c @@ -704,14 +704,6 @@ do_ptrace(long request, struct task_struct *child, long addr, long data) break; } - /* - * detach a process that was attached. - */ - case PTRACE_DETACH: - ret = 0; - ret = ptrace_detach(child, data); - break; - case PTRACE_GETREGS: ret = ptrace_getregs(child, (void __user *)data); break; diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index e792d3cba4c7..2075543c2d92 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c @@ -226,10 +226,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) wake_up_process(child); break; - case PTRACE_DETACH: /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - case PTRACE_GETREGS: /* Get all gp regs from the child. */ for (i = 0; i < 19; i++) { tmp = get_reg(child, i); diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 58aa6fec1146..999f7853de26 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -435,10 +435,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) wake_up_process(child); break; - case PTRACE_DETACH: /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - case PTRACE_GET_THREAD_AREA: ret = put_user(task_thread_info(child)->tp_value, (unsigned long __user *) data); diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 26ec774c5027..49c637970789 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c @@ -329,10 +329,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) /* give it a chance to run. */ goto out_wake; - case PTRACE_DETACH: - ret = ptrace_detach(child, data); - goto out_tsk; - case PTRACE_GETEVENTMSG: ret = put_user(child->ptrace_message, (unsigned int __user *) data); goto out_tsk; diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index cf7732cdd6c7..3e17d154d0d4 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -505,10 +505,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = ptrace_set_debugreg(child, addr, data); break; - case PTRACE_DETACH: - ret = ptrace_detach(child, data); - break; - #ifdef CONFIG_PPC64 case PTRACE_GETREGS64: #endif diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index f4503ca27630..1d81bf9488ae 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c @@ -683,11 +683,6 @@ do_ptrace(struct task_struct *child, long request, long addr, long data) wake_up_process(child); return 0; - case PTRACE_DETACH: - /* detach a process that was attached. */ - return ptrace_detach(child, data); - - /* Do requests that differ for 31/64 bit */ default: #ifdef CONFIG_COMPAT diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c index f64a2d2416d4..ac725f0aeb72 100644 --- a/arch/sh/kernel/ptrace.c +++ b/arch/sh/kernel/ptrace.c @@ -211,10 +211,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; } - case PTRACE_DETACH: /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - #ifdef CONFIG_SH_DSP case PTRACE_GETDSPREGS: { unsigned long dp; diff --git a/arch/sh64/kernel/ptrace.c b/arch/sh64/kernel/ptrace.c index df06c6477468..8a2d339cf760 100644 --- a/arch/sh64/kernel/ptrace.c +++ b/arch/sh64/kernel/ptrace.c @@ -244,10 +244,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; } - case PTRACE_DETACH: /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - default: ret = ptrace_request(child, request, addr, data); break; diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 6916c8888dba..36debc0de594 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c @@ -119,11 +119,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; } - case PTRACE_DETACH: - /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - #ifdef PTRACE_GETREGS case PTRACE_GETREGS: { /* Get all gp regs from the child. */ if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) { diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c index 0cecd7513c97..8622b9cd3e38 100644 --- a/arch/x86/kernel/ptrace_32.c +++ b/arch/x86/kernel/ptrace_32.c @@ -524,11 +524,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = 0; break; - case PTRACE_DETACH: - /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - case PTRACE_GETREGS: { /* Get all gp regs from the child. */ if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) { ret = -EIO; diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c index c0cac42df3b6..86321ee6da93 100644 --- a/arch/x86/kernel/ptrace_64.c +++ b/arch/x86/kernel/ptrace_64.c @@ -500,11 +500,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = 0; break; - case PTRACE_DETACH: - /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - case PTRACE_GETREGS: { /* Get all gp regs from the child. */ if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, sizeof(struct user_regs_struct))) { diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index 06a13d9b69db..5533c7850d53 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c @@ -304,10 +304,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = put_user(sizeof(elf_fpregset_t), (unsigned long *) data); break; - case PTRACE_DETACH: /* detach a process that was attached. */ - ret = ptrace_detach(child, data); - break; - default: ret = ptrace_request(child, request, addr, data); goto out; diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 3eca7a55f2ee..0870523c2ae4 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -386,6 +386,9 @@ int ptrace_request(struct task_struct *child, long request, case PTRACE_SETSIGINFO: ret = ptrace_setsiginfo(child, (siginfo_t __user *) data); break; + case PTRACE_DETACH: /* detach a process that was attached. */ + ret = ptrace_detach(child, data); + break; default: break; } -- 2.30.2