提交 1bcf5482 编写于 作者: A Alexey Dobriyan 提交者: Linus Torvalds

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: NAlexey Dobriyan <adobriyan@sw.ru>
Acked-by: NChristoph Hellwig <hch@infradead.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e6716b87
...@@ -368,10 +368,6 @@ do_sys_ptrace(long request, long pid, long addr, long data, ...@@ -368,10 +368,6 @@ do_sys_ptrace(long request, long pid, long addr, long data,
ret = 0; ret = 0;
goto out; goto out;
case PTRACE_DETACH: /* detach a process that was attached. */
ret = ptrace_detach(child, data);
goto out;
default: default:
ret = ptrace_request(child, request, addr, data); ret = ptrace_request(child, request, addr, data);
goto out; goto out;
......
...@@ -731,10 +731,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -731,10 +731,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = 0; ret = 0;
break; break;
case PTRACE_DETACH:
ret = ptrace_detach(child, data);
break;
case PTRACE_GETREGS: case PTRACE_GETREGS:
ret = ptrace_getregs(child, (void __user *)data); ret = ptrace_getregs(child, (void __user *)data);
break; break;
......
...@@ -227,11 +227,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -227,11 +227,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = 0; ret = 0;
break; break;
/* Detach a process that was attached */
case PTRACE_DETACH:
ret = ptrace_detach(child, data);
break;
case PTRACE_GETREGS: case PTRACE_GETREGS:
ret = ptrace_getregs(child, (void __user *)data); ret = ptrace_getregs(child, (void __user *)data);
break; break;
......
...@@ -385,12 +385,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -385,12 +385,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
break; break;
} }
case PTRACE_DETACH:
{ /* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
}
case PTRACE_GETREGS: case PTRACE_GETREGS:
{ {
......
...@@ -177,10 +177,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -177,10 +177,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = 0; ret = 0;
break; break;
case PTRACE_DETACH:
ret = ptrace_detach(child, data);
break;
/* Get all GP registers from the child. */ /* Get all GP registers from the child. */
case PTRACE_GETREGS: { case PTRACE_GETREGS: {
int i; int i;
......
...@@ -245,10 +245,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -245,10 +245,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
break; break;
} }
case PTRACE_DETACH:
ret = ptrace_detach(child, data);
break;
/* Get all GP registers from the child. */ /* Get all GP registers from the child. */
case PTRACE_GETREGS: { case PTRACE_GETREGS: {
int i; int i;
......
...@@ -704,14 +704,6 @@ do_ptrace(long request, struct task_struct *child, long addr, long data) ...@@ -704,14 +704,6 @@ do_ptrace(long request, struct task_struct *child, long addr, long data)
break; break;
} }
/*
* detach a process that was attached.
*/
case PTRACE_DETACH:
ret = 0;
ret = ptrace_detach(child, data);
break;
case PTRACE_GETREGS: case PTRACE_GETREGS:
ret = ptrace_getregs(child, (void __user *)data); ret = ptrace_getregs(child, (void __user *)data);
break; break;
......
...@@ -226,10 +226,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -226,10 +226,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
wake_up_process(child); wake_up_process(child);
break; 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. */ case PTRACE_GETREGS: /* Get all gp regs from the child. */
for (i = 0; i < 19; i++) { for (i = 0; i < 19; i++) {
tmp = get_reg(child, i); tmp = get_reg(child, i);
......
...@@ -435,10 +435,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -435,10 +435,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
wake_up_process(child); wake_up_process(child);
break; break;
case PTRACE_DETACH: /* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
case PTRACE_GET_THREAD_AREA: case PTRACE_GET_THREAD_AREA:
ret = put_user(task_thread_info(child)->tp_value, ret = put_user(task_thread_info(child)->tp_value,
(unsigned long __user *) data); (unsigned long __user *) data);
......
...@@ -329,10 +329,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -329,10 +329,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
/* give it a chance to run. */ /* give it a chance to run. */
goto out_wake; goto out_wake;
case PTRACE_DETACH:
ret = ptrace_detach(child, data);
goto out_tsk;
case PTRACE_GETEVENTMSG: case PTRACE_GETEVENTMSG:
ret = put_user(child->ptrace_message, (unsigned int __user *) data); ret = put_user(child->ptrace_message, (unsigned int __user *) data);
goto out_tsk; goto out_tsk;
......
...@@ -505,10 +505,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -505,10 +505,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = ptrace_set_debugreg(child, addr, data); ret = ptrace_set_debugreg(child, addr, data);
break; break;
case PTRACE_DETACH:
ret = ptrace_detach(child, data);
break;
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
case PTRACE_GETREGS64: case PTRACE_GETREGS64:
#endif #endif
......
...@@ -683,11 +683,6 @@ do_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -683,11 +683,6 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
wake_up_process(child); wake_up_process(child);
return 0; return 0;
case PTRACE_DETACH:
/* detach a process that was attached. */
return ptrace_detach(child, data);
/* Do requests that differ for 31/64 bit */ /* Do requests that differ for 31/64 bit */
default: default:
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
......
...@@ -211,10 +211,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -211,10 +211,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
break; break;
} }
case PTRACE_DETACH: /* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
#ifdef CONFIG_SH_DSP #ifdef CONFIG_SH_DSP
case PTRACE_GETDSPREGS: { case PTRACE_GETDSPREGS: {
unsigned long dp; unsigned long dp;
......
...@@ -244,10 +244,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -244,10 +244,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
break; break;
} }
case PTRACE_DETACH: /* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
default: default:
ret = ptrace_request(child, request, addr, data); ret = ptrace_request(child, request, addr, data);
break; break;
......
...@@ -119,11 +119,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -119,11 +119,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
break; break;
} }
case PTRACE_DETACH:
/* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
#ifdef PTRACE_GETREGS #ifdef PTRACE_GETREGS
case PTRACE_GETREGS: { /* Get all gp regs from the child. */ case PTRACE_GETREGS: { /* Get all gp regs from the child. */
if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) { if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) {
......
...@@ -524,11 +524,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -524,11 +524,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = 0; ret = 0;
break; 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. */ case PTRACE_GETREGS: { /* Get all gp regs from the child. */
if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) { if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) {
ret = -EIO; ret = -EIO;
......
...@@ -500,11 +500,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -500,11 +500,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = 0; ret = 0;
break; 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. */ case PTRACE_GETREGS: { /* Get all gp regs from the child. */
if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, if (!access_ok(VERIFY_WRITE, (unsigned __user *)data,
sizeof(struct user_regs_struct))) { sizeof(struct user_regs_struct))) {
......
...@@ -304,10 +304,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -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); ret = put_user(sizeof(elf_fpregset_t), (unsigned long *) data);
break; break;
case PTRACE_DETACH: /* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
default: default:
ret = ptrace_request(child, request, addr, data); ret = ptrace_request(child, request, addr, data);
goto out; goto out;
......
...@@ -386,6 +386,9 @@ int ptrace_request(struct task_struct *child, long request, ...@@ -386,6 +386,9 @@ int ptrace_request(struct task_struct *child, long request,
case PTRACE_SETSIGINFO: case PTRACE_SETSIGINFO:
ret = ptrace_setsiginfo(child, (siginfo_t __user *) data); ret = ptrace_setsiginfo(child, (siginfo_t __user *) data);
break; break;
case PTRACE_DETACH: /* detach a process that was attached. */
ret = ptrace_detach(child, data);
break;
default: default:
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册