* [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo
@ 2008-04-22 19:20 Roland McGrath
2008-04-22 19:21 ` [PATCH 2/2 x86/latest] x86_64 ia32 ptrace: convert to compat_arch_ptrace Roland McGrath
2008-04-22 19:23 ` [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo Ingo Molnar
0 siblings, 2 replies; 3+ messages in thread
From: Roland McGrath @ 2008-04-22 19:20 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel
This removes the special-case handling for PTRACE_GETSIGINFO
and PTRACE_SETSIGINFO from x86_64's sys32_ptrace. The generic
compat_ptrace_request code handles these.
Signed-off-by: Roland McGrath <roland@redhat.com>
---
arch/x86/kernel/ptrace.c | 30 +-----------------------------
1 files changed, 1 insertions(+), 29 deletions(-)
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 1edbb13..b564116 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1301,32 +1301,6 @@ static int genregs32_set(struct task_struct *target,
return ret;
}
-static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data)
-{
- siginfo_t __user *si = compat_alloc_user_space(sizeof(siginfo_t));
- compat_siginfo_t __user *si32 = compat_ptr(data);
- siginfo_t ssi;
- int ret;
-
- if (request == PTRACE_SETSIGINFO) {
- memset(&ssi, 0, sizeof(siginfo_t));
- ret = copy_siginfo_from_user32(&ssi, si32);
- if (ret)
- return ret;
- if (copy_to_user(si, &ssi, sizeof(siginfo_t)))
- return -EFAULT;
- }
- ret = sys_ptrace(request, pid, addr, (unsigned long)si);
- if (ret)
- return ret;
- if (request == PTRACE_GETSIGINFO) {
- if (copy_from_user(&ssi, si, sizeof(siginfo_t)))
- return -EFAULT;
- ret = copy_siginfo_to_user32(si32, &ssi);
- }
- return ret;
-}
-
asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
{
struct task_struct *child;
@@ -1374,11 +1348,9 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
case PTRACE_SETFPXREGS:
case PTRACE_GETFPXREGS:
case PTRACE_GETEVENTMSG:
- break;
-
case PTRACE_SETSIGINFO:
case PTRACE_GETSIGINFO:
- return ptrace32_siginfo(request, pid, addr, data);
+ break;
}
child = ptrace_get_task_struct(pid);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2 x86/latest] x86_64 ia32 ptrace: convert to compat_arch_ptrace
2008-04-22 19:20 [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo Roland McGrath
@ 2008-04-22 19:21 ` Roland McGrath
2008-04-22 19:23 ` [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo Ingo Molnar
1 sibling, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2008-04-22 19:21 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel
Now that there are no more special cases in sys32_ptrace, we
can convert to using the generic compat_sys_ptrace entry point.
The sys32_ptrace function gets simpler and becomes compat_arch_ptrace.
Signed-off-by: Roland McGrath <roland@redhat.com>
---
arch/x86/ia32/ia32entry.S | 2 +-
arch/x86/kernel/ptrace.c | 67 +++++---------------------------------------
include/asm-x86/ptrace.h | 2 +
3 files changed, 11 insertions(+), 60 deletions(-)
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index ae7158b..b5e329d 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -430,7 +430,7 @@ ia32_sys_call_table:
.quad sys_setuid16
.quad sys_getuid16
.quad compat_sys_stime /* stime */ /* 25 */
- .quad sys32_ptrace /* ptrace */
+ .quad compat_sys_ptrace /* ptrace */
.quad sys_alarm
.quad sys_fstat /* (old)fstat */
.quad sys_pause
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index b564116..b7ff783 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1301,69 +1301,16 @@ static int genregs32_set(struct task_struct *target,
return ret;
}
-asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
+long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
+ compat_ulong_t caddr, compat_ulong_t cdata)
{
- struct task_struct *child;
- struct pt_regs *childregs;
+ unsigned long addr = caddr;
+ unsigned long data = cdata;
void __user *datap = compat_ptr(data);
int ret;
__u32 val;
switch (request) {
- case PTRACE_TRACEME:
- case PTRACE_ATTACH:
- case PTRACE_KILL:
- case PTRACE_CONT:
- case PTRACE_SINGLESTEP:
- case PTRACE_SINGLEBLOCK:
- case PTRACE_DETACH:
- case PTRACE_SYSCALL:
- case PTRACE_OLDSETOPTIONS:
- case PTRACE_SETOPTIONS:
- case PTRACE_SET_THREAD_AREA:
- case PTRACE_GET_THREAD_AREA:
-#ifdef CONFIG_X86_PTRACE_BTS
- case PTRACE_BTS_CONFIG:
- case PTRACE_BTS_STATUS:
- case PTRACE_BTS_SIZE:
- case PTRACE_BTS_GET:
- case PTRACE_BTS_CLEAR:
- case PTRACE_BTS_DRAIN:
-#endif /* CONFIG_X86_PTRACE_BTS */
- return sys_ptrace(request, pid, addr, data);
-
- default:
- return -EINVAL;
-
- case PTRACE_PEEKTEXT:
- case PTRACE_PEEKDATA:
- case PTRACE_POKEDATA:
- case PTRACE_POKETEXT:
- case PTRACE_POKEUSR:
- case PTRACE_PEEKUSR:
- case PTRACE_GETREGS:
- case PTRACE_SETREGS:
- case PTRACE_SETFPREGS:
- case PTRACE_GETFPREGS:
- case PTRACE_SETFPXREGS:
- case PTRACE_GETFPXREGS:
- case PTRACE_GETEVENTMSG:
- case PTRACE_SETSIGINFO:
- case PTRACE_GETSIGINFO:
- break;
- }
-
- child = ptrace_get_task_struct(pid);
- if (IS_ERR(child))
- return PTR_ERR(child);
-
- ret = ptrace_check_attach(child, request == PTRACE_KILL);
- if (ret < 0)
- goto out;
-
- childregs = task_pt_regs(child);
-
- switch (request) {
case PTRACE_PEEKUSR:
ret = getreg32(child, addr, &val);
if (ret == 0)
@@ -1409,12 +1356,14 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
sizeof(struct user32_fxsr_struct),
datap);
+ case PTRACE_GET_THREAD_AREA:
+ case PTRACE_SET_THREAD_AREA:
+ return arch_ptrace(child, request, addr, data);
+
default:
return compat_ptrace_request(child, request, addr, data);
}
- out:
- put_task_struct(child);
return ret;
}
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h
index f78dafc..6303701 100644
--- a/include/asm-x86/ptrace.h
+++ b/include/asm-x86/ptrace.h
@@ -265,6 +265,8 @@ extern int do_get_thread_area(struct task_struct *p, int idx,
extern int do_set_thread_area(struct task_struct *p, int idx,
struct user_desc __user *info, int can_allocate);
+#define __ARCH_WANT_COMPAT_SYS_PTRACE
+
#endif /* __KERNEL__ */
#endif /* !__ASSEMBLY__ */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo
2008-04-22 19:20 [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo Roland McGrath
2008-04-22 19:21 ` [PATCH 2/2 x86/latest] x86_64 ia32 ptrace: convert to compat_arch_ptrace Roland McGrath
@ 2008-04-22 19:23 ` Ingo Molnar
1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-04-22 19:23 UTC (permalink / raw)
To: Roland McGrath; +Cc: Thomas Gleixner, linux-kernel
* Roland McGrath <roland@redhat.com> wrote:
> This removes the special-case handling for PTRACE_GETSIGINFO and
> PTRACE_SETSIGINFO from x86_64's sys32_ptrace. The generic
> compat_ptrace_request code handles these.
thanks Roland, applied.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-22 19:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-22 19:20 [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo Roland McGrath
2008-04-22 19:21 ` [PATCH 2/2 x86/latest] x86_64 ia32 ptrace: convert to compat_arch_ptrace Roland McGrath
2008-04-22 19:23 ` [PATCH 1/2 x86/latest] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®