Skip to content

Commit

Permalink
Consolidate PTRACE_DETACH
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed Oct 16, 2007
1 parent e6716b8 commit 1bcf548
Show file tree
Hide file tree
Showing 19 changed files with 3 additions and 83 deletions.
4 changes: 0 additions & 4 deletions arch/alpha/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions arch/avr32/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions arch/blackfin/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
{

Expand Down
4 changes: 0 additions & 4 deletions arch/cris/arch-v10/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions arch/cris/arch-v32/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions arch/m32r/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions arch/m68k/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions arch/mips/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions arch/parisc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions arch/powerpc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions arch/s390/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions arch/sh/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions arch/sh64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions arch/um/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
5 changes: 0 additions & 5 deletions arch/x86/kernel/ptrace_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions arch/x86/kernel/ptrace_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down
4 changes: 0 additions & 4 deletions arch/xtensa/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1bcf548

Please sign in to comment.