diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-05-26 17:42:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:44 -0400 |
commit | 9c1a125921d146f22cf28ff366ff69fd602a0e9b (patch) | |
tree | 37df1b2ae74c23371de7e8b46427fc0a16727cdb /arch | |
parent | 0ac0c0d0f837c499afd02a802f9cf52d3027fa3b (diff) |
ptrace: unify FDPIC implementations
The Blackfin/FRV/SuperH guys all have the same exact FDPIC ptrace code in
their arch handlers (since they were probably copied & pasted). Since
these ptrace interfaces are an arch independent aspect of the FDPIC code,
unify them in the common ptrace code so new FDPIC ports don't need to copy
and paste this fundamental stuff yet again.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Roland McGrath <roland@redhat.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/kernel/ptrace.c | 33 | ||||
-rw-r--r-- | arch/frv/kernel/ptrace.c | 20 | ||||
-rw-r--r-- | arch/sh/kernel/ptrace_32.c | 23 |
3 files changed, 9 insertions, 67 deletions
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index 43eb969405d1..6ec77685df52 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c | |||
@@ -292,28 +292,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
292 | break; | 292 | break; |
293 | } | 293 | } |
294 | 294 | ||
295 | #ifdef CONFIG_BINFMT_ELF_FDPIC | ||
296 | case PTRACE_GETFDPIC: { | ||
297 | unsigned long tmp = 0; | ||
298 | |||
299 | switch (addr) { | ||
300 | case_PTRACE_GETFDPIC_EXEC: | ||
301 | case PTRACE_GETFDPIC_EXEC: | ||
302 | tmp = child->mm->context.exec_fdpic_loadmap; | ||
303 | break; | ||
304 | case_PTRACE_GETFDPIC_INTERP: | ||
305 | case PTRACE_GETFDPIC_INTERP: | ||
306 | tmp = child->mm->context.interp_fdpic_loadmap; | ||
307 | break; | ||
308 | default: | ||
309 | break; | ||
310 | } | ||
311 | |||
312 | ret = put_user(tmp, datap); | ||
313 | break; | ||
314 | } | ||
315 | #endif | ||
316 | |||
317 | /* when I and D space are separate, this will have to be fixed. */ | 295 | /* when I and D space are separate, this will have to be fixed. */ |
318 | case PTRACE_POKEDATA: | 296 | case PTRACE_POKEDATA: |
319 | pr_debug("ptrace: PTRACE_PEEKDATA\n"); | 297 | pr_debug("ptrace: PTRACE_PEEKDATA\n"); |
@@ -357,8 +335,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
357 | case PTRACE_PEEKUSR: | 335 | case PTRACE_PEEKUSR: |
358 | switch (addr) { | 336 | switch (addr) { |
359 | #ifdef CONFIG_BINFMT_ELF_FDPIC /* backwards compat */ | 337 | #ifdef CONFIG_BINFMT_ELF_FDPIC /* backwards compat */ |
360 | case PT_FDPIC_EXEC: goto case_PTRACE_GETFDPIC_EXEC; | 338 | case PT_FDPIC_EXEC: |
361 | case PT_FDPIC_INTERP: goto case_PTRACE_GETFDPIC_INTERP; | 339 | request = PTRACE_GETFDPIC; |
340 | addr = PTRACE_GETFDPIC_EXEC; | ||
341 | goto case_default; | ||
342 | case PT_FDPIC_INTERP: | ||
343 | request = PTRACE_GETFDPIC; | ||
344 | addr = PTRACE_GETFDPIC_INTERP; | ||
345 | goto case_default; | ||
362 | #endif | 346 | #endif |
363 | default: | 347 | default: |
364 | ret = get_reg(child, addr, datap); | 348 | ret = get_reg(child, addr, datap); |
@@ -385,6 +369,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
385 | 0, sizeof(struct pt_regs), | 369 | 0, sizeof(struct pt_regs), |
386 | (const void __user *)data); | 370 | (const void __user *)data); |
387 | 371 | ||
372 | case_default: | ||
388 | default: | 373 | default: |
389 | ret = ptrace_request(child, request, addr, data); | 374 | ret = ptrace_request(child, request, addr, data); |
390 | break; | 375 | break; |
diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c index 60eeed3694c0..fac028936a04 100644 --- a/arch/frv/kernel/ptrace.c +++ b/arch/frv/kernel/ptrace.c | |||
@@ -344,26 +344,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
344 | 0, sizeof(child->thread.user->f), | 344 | 0, sizeof(child->thread.user->f), |
345 | (const void __user *)data); | 345 | (const void __user *)data); |
346 | 346 | ||
347 | case PTRACE_GETFDPIC: | ||
348 | tmp = 0; | ||
349 | switch (addr) { | ||
350 | case PTRACE_GETFDPIC_EXEC: | ||
351 | tmp = child->mm->context.exec_fdpic_loadmap; | ||
352 | break; | ||
353 | case PTRACE_GETFDPIC_INTERP: | ||
354 | tmp = child->mm->context.interp_fdpic_loadmap; | ||
355 | break; | ||
356 | default: | ||
357 | break; | ||
358 | } | ||
359 | |||
360 | ret = 0; | ||
361 | if (put_user(tmp, (unsigned long *) data)) { | ||
362 | ret = -EFAULT; | ||
363 | break; | ||
364 | } | ||
365 | break; | ||
366 | |||
367 | default: | 347 | default: |
368 | ret = ptrace_request(child, request, addr, data); | 348 | ret = ptrace_request(child, request, addr, data); |
369 | break; | 349 | break; |
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index d4104ce9fe53..6c4bbba2a675 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c | |||
@@ -436,29 +436,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
436 | 0, sizeof(struct pt_dspregs), | 436 | 0, sizeof(struct pt_dspregs), |
437 | (const void __user *)data); | 437 | (const void __user *)data); |
438 | #endif | 438 | #endif |
439 | #ifdef CONFIG_BINFMT_ELF_FDPIC | ||
440 | case PTRACE_GETFDPIC: { | ||
441 | unsigned long tmp = 0; | ||
442 | |||
443 | switch (addr) { | ||
444 | case PTRACE_GETFDPIC_EXEC: | ||
445 | tmp = child->mm->context.exec_fdpic_loadmap; | ||
446 | break; | ||
447 | case PTRACE_GETFDPIC_INTERP: | ||
448 | tmp = child->mm->context.interp_fdpic_loadmap; | ||
449 | break; | ||
450 | default: | ||
451 | break; | ||
452 | } | ||
453 | |||
454 | ret = 0; | ||
455 | if (put_user(tmp, datap)) { | ||
456 | ret = -EFAULT; | ||
457 | break; | ||
458 | } | ||
459 | break; | ||
460 | } | ||
461 | #endif | ||
462 | default: | 439 | default: |
463 | ret = ptrace_request(child, request, addr, data); | 440 | ret = ptrace_request(child, request, addr, data); |
464 | break; | 441 | break; |