From: Mike Frysinger <vapier@gentoo.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Roland McGrath <roland@redhat.com>,
David Howells <dhowells@redhat.com>,
Paul Mundt <lethal@linux-sh.org>, Oleg Nesterov <oleg@redhat.com>,
uclinux-dist-devel@blackfin.uclinux.org,
linux-sh@vger.kernel.org
Subject: [PATCH] ptrace: unify FDPIC implementations
Date: Tue, 16 Feb 2010 00:30:29 +0000 [thread overview]
Message-ID: <1266280229-18469-1-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1265880960-26676-1-git-send-email-vapier@gentoo.org>
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>
---
Andrew: could you pick this up ? everyone concerned has acked it ...
arch/blackfin/kernel/ptrace.c | 33 ++++++++-------------------------
arch/frv/kernel/ptrace.c | 20 --------------------
arch/sh/kernel/ptrace_32.c | 23 -----------------------
kernel/ptrace.c | 20 ++++++++++++++++++++
4 files changed, 28 insertions(+), 68 deletions(-)
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 65567dc..0ae2f1e 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -261,11 +261,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
} else if (addr = (sizeof(struct pt_regs) + 8)) {
/* PT_DATA_ADDR */
tmp = child->mm->start_data;
-#ifdef CONFIG_BINFMT_ELF_FDPIC
+#ifdef CONFIG_BINFMT_ELF_FDPIC /* backwards compat */
} else if (addr = (sizeof(struct pt_regs) + 12)) {
- goto case_PTRACE_GETFDPIC_EXEC;
+ request = PTRACE_GETFDPIC;
+ addr = PTRACE_GETFDPIC_EXEC;
+ goto case_default;
} else if (addr = (sizeof(struct pt_regs) + 16)) {
- goto case_PTRACE_GETFDPIC_INTERP;
+ request = PTRACE_GETFDPIC;
+ addr = PTRACE_GETFDPIC_INTERP;
+ goto case_default;
#endif
} else {
tmp = get_reg(child, addr);
@@ -274,28 +278,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
break;
}
-#ifdef CONFIG_BINFMT_ELF_FDPIC
- case PTRACE_GETFDPIC: {
- unsigned long tmp = 0;
-
- switch (addr) {
- case_PTRACE_GETFDPIC_EXEC:
- case PTRACE_GETFDPIC_EXEC:
- tmp = child->mm->context.exec_fdpic_loadmap;
- break;
- case_PTRACE_GETFDPIC_INTERP:
- case PTRACE_GETFDPIC_INTERP:
- tmp = child->mm->context.interp_fdpic_loadmap;
- break;
- default:
- break;
- }
-
- ret = put_user(tmp, datap);
- break;
- }
-#endif
-
/* when I and D space are separate, this will have to be fixed. */
case PTRACE_POKEDATA:
pr_debug("ptrace: PTRACE_PEEKDATA\n");
@@ -409,6 +391,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret = 0;
break;
+ case_default:
default:
ret = ptrace_request(child, request, addr, data);
break;
diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c
index 60eeed3..fac0289 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)
0, sizeof(child->thread.user->f),
(const void __user *)data);
- case PTRACE_GETFDPIC:
- tmp = 0;
- switch (addr) {
- case PTRACE_GETFDPIC_EXEC:
- tmp = child->mm->context.exec_fdpic_loadmap;
- break;
- case PTRACE_GETFDPIC_INTERP:
- tmp = child->mm->context.interp_fdpic_loadmap;
- break;
- default:
- break;
- }
-
- ret = 0;
- if (put_user(tmp, (unsigned long *) data)) {
- ret = -EFAULT;
- break;
- }
- break;
-
default:
ret = ptrace_request(child, request, addr, data);
break;
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 9be35f3..ab8123b 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -405,29 +405,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
0, sizeof(struct pt_dspregs),
(const void __user *)data);
#endif
-#ifdef CONFIG_BINFMT_ELF_FDPIC
- case PTRACE_GETFDPIC: {
- unsigned long tmp = 0;
-
- switch (addr) {
- case PTRACE_GETFDPIC_EXEC:
- tmp = child->mm->context.exec_fdpic_loadmap;
- break;
- case PTRACE_GETFDPIC_INTERP:
- tmp = child->mm->context.interp_fdpic_loadmap;
- break;
- default:
- break;
- }
-
- ret = 0;
- if (put_user(tmp, datap)) {
- ret = -EFAULT;
- break;
- }
- break;
- }
-#endif
default:
ret = ptrace_request(child, request, addr, data);
break;
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 23bd09c..60fe465 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -554,6 +554,26 @@ int ptrace_request(struct task_struct *child, long request,
ret = ptrace_detach(child, data);
break;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ case PTRACE_GETFDPIC: {
+ unsigned long tmp = 0;
+
+ switch (addr) {
+ case PTRACE_GETFDPIC_EXEC:
+ tmp = child->mm->context.exec_fdpic_loadmap;
+ break;
+ case PTRACE_GETFDPIC_INTERP:
+ tmp = child->mm->context.interp_fdpic_loadmap;
+ break;
+ default:
+ break;
+ }
+
+ ret = put_user(tmp, (unsigned long __user *) data);
+ break;
+ }
+#endif
+
#ifdef PTRACE_SINGLESTEP
case PTRACE_SINGLESTEP:
#endif
--
1.7.0
next prev parent reply other threads:[~2010-02-16 0:30 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-11 9:36 [PATCH] ptrace: unify FDPIC implementations Mike Frysinger
2010-02-11 20:24 ` Roland McGrath
2010-02-11 21:07 ` David Howells
2010-02-11 23:26 ` Paul Mundt
2010-02-16 0:30 ` Mike Frysinger [this message]
2010-02-16 1:10 ` Paul Mundt
2010-02-16 8:12 ` Mike Frysinger
2010-05-21 8:42 ` [PATCH v2] " Mike Frysinger
2010-05-21 16:26 ` Oleg Nesterov
2010-05-21 18:35 ` Roland McGrath
2010-05-22 14:54 ` [PATCH -mm 0/1] (Was: ptrace: unify FDPIC implementations) Oleg Nesterov
2010-05-22 14:55 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage of Oleg Nesterov
2010-05-24 4:33 ` [Uclinux-dist-devel] [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix Mike Frysinger
2010-05-24 8:38 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage of Roland McGrath
2010-05-24 14:36 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage of child->mm David Howells
2010-05-24 15:14 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage Oleg Nesterov
2010-05-24 23:42 ` Roland McGrath
2010-05-25 1:29 ` [Uclinux-dist-devel] [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix Mike Frysinger
2010-05-25 19:11 ` Roland McGrath
2010-05-25 9:14 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage of child->mm David Howells
2010-05-25 10:23 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage Oleg Nesterov
2010-05-25 17:28 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage of Mike Frysinger
2010-05-26 12:40 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage Oleg Nesterov
2010-05-27 19:55 ` [PATCH 0/2] blackfin: ptrace mm/sram_list fixes Oleg Nesterov
2010-05-27 19:56 ` [PATCH 1/2] blackfin: ptrace: fix the unsafe usage of mm/find_vma Oleg Nesterov
2010-05-27 19:56 ` [PATCH 2/2] blackfin: use ->mmap_sem to protect Oleg Nesterov
2010-05-27 20:21 ` [PATCH 0/2] blackfin: ptrace mm/sram_list fixes Mike Frysinger
2010-05-28 19:43 ` Oleg Nesterov
2010-05-25 12:24 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage of child->mm David Howells
2010-05-25 12:30 ` [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1266280229-18469-1-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).