diff options
-rw-r--r-- | include/linux/compat.h | 4 | ||||
-rw-r--r-- | kernel/ptrace.c | 38 |
2 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h index ba29d4c59643..a907fbede6c3 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -243,6 +243,10 @@ asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, | |||
243 | compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, | 243 | compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, |
244 | const compat_ulong_t __user *new_nodes); | 244 | const compat_ulong_t __user *new_nodes); |
245 | 245 | ||
246 | extern int compat_ptrace_request(struct task_struct *child, | ||
247 | compat_long_t request, | ||
248 | compat_ulong_t addr, compat_ulong_t data); | ||
249 | |||
246 | /* | 250 | /* |
247 | * epoll (fs/eventpoll.c) compat bits follow ... | 251 | * epoll (fs/eventpoll.c) compat bits follow ... |
248 | */ | 252 | */ |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index e6a99d2793b3..ed1c3d56c2cd 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -607,3 +607,41 @@ int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data) | |||
607 | copied = access_process_vm(tsk, addr, &data, sizeof(data), 1); | 607 | copied = access_process_vm(tsk, addr, &data, sizeof(data), 1); |
608 | return (copied == sizeof(data)) ? 0 : -EIO; | 608 | return (copied == sizeof(data)) ? 0 : -EIO; |
609 | } | 609 | } |
610 | |||
611 | #ifdef CONFIG_COMPAT | ||
612 | #include <linux/compat.h> | ||
613 | |||
614 | int compat_ptrace_request(struct task_struct *child, compat_long_t request, | ||
615 | compat_ulong_t addr, compat_ulong_t data) | ||
616 | { | ||
617 | compat_ulong_t __user *datap = compat_ptr(data); | ||
618 | compat_ulong_t word; | ||
619 | int ret; | ||
620 | |||
621 | switch (request) { | ||
622 | case PTRACE_PEEKTEXT: | ||
623 | case PTRACE_PEEKDATA: | ||
624 | ret = access_process_vm(child, addr, &word, sizeof(word), 0); | ||
625 | if (ret != sizeof(word)) | ||
626 | ret = -EIO; | ||
627 | else | ||
628 | ret = put_user(word, datap); | ||
629 | break; | ||
630 | |||
631 | case PTRACE_POKETEXT: | ||
632 | case PTRACE_POKEDATA: | ||
633 | ret = access_process_vm(child, addr, &data, sizeof(data), 1); | ||
634 | ret = (ret != sizeof(data) ? -EIO : 0); | ||
635 | break; | ||
636 | |||
637 | case PTRACE_GETEVENTMSG: | ||
638 | ret = put_user((compat_ulong_t) child->ptrace_message, datap); | ||
639 | break; | ||
640 | |||
641 | default: | ||
642 | ret = ptrace_request(child, request, addr, data); | ||
643 | } | ||
644 | |||
645 | return ret; | ||
646 | } | ||
647 | #endif /* CONFIG_COMPAT */ | ||