aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-03-10 18:22:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:38 -0500
commitb3c1e01a09d6af2dd7811a066ffcfc5171be2bed (patch)
treee59bb3618ed20fe05caba4c8cb7e292b7b2559b1
parent7baab93f9297da3e42a8cecfbf91d5f22f415500 (diff)
ptrace: use ptrace_request() in the remaining architectures
Use ptrace_request() in the three remaining architectures that didn't use it (m68knommu, h8300, microblaze). This means: - ptrace_request now handles PTRACE_{PEEK,POKE}{TEXT,DATA} and PTRACE_DETATCH calls that were previously called directly, or in case of h8300 even open coded. - adds new support for PTRACE_SETOPTIONS/PTRACE_GETEVENTMSG/ PTRACE_GETSIGINFO/PTRACE_SETSIGINFO Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Michal Simek <monstr@monstr.eu> Acked-by: Greg Ungerer <gerg@uclinux.org> Acked-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/h8300/kernel/ptrace.c30
-rw-r--r--arch/m68knommu/kernel/ptrace.c18
-rw-r--r--arch/microblaze/kernel/ptrace.c27
3 files changed, 3 insertions, 72 deletions
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c
index d32bbf02fc4..04bb9dd194e 100644
--- a/arch/h8300/kernel/ptrace.c
+++ b/arch/h8300/kernel/ptrace.c
@@ -42,14 +42,6 @@ extern void h8300_enable_trace(struct task_struct *child);
42 * in exit.c or in signal.c. 42 * in exit.c or in signal.c.
43 */ 43 */
44 44
45inline
46static int read_long(struct task_struct * tsk, unsigned long addr,
47 unsigned long * result)
48{
49 *result = *(unsigned long *)addr;
50 return 0;
51}
52
53void ptrace_disable(struct task_struct *child) 45void ptrace_disable(struct task_struct *child)
54{ 46{
55 h8300_disable_trace(child); 47 h8300_disable_trace(child);
@@ -60,17 +52,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
60 int ret; 52 int ret;
61 53
62 switch (request) { 54 switch (request) {
63 case PTRACE_PEEKTEXT: /* read word at location addr. */
64 case PTRACE_PEEKDATA: {
65 unsigned long tmp;
66
67 ret = read_long(child, addr, &tmp);
68 if (ret < 0)
69 break ;
70 ret = put_user(tmp, (unsigned long *) data);
71 break ;
72 }
73
74 /* read the word at location addr in the USER area. */ 55 /* read the word at location addr in the USER area. */
75 case PTRACE_PEEKUSR: { 56 case PTRACE_PEEKUSR: {
76 unsigned long tmp = 0; 57 unsigned long tmp = 0;
@@ -109,11 +90,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
109 } 90 }
110 91
111 /* when I and D space are separate, this will have to be fixed. */ 92 /* when I and D space are separate, this will have to be fixed. */
112 case PTRACE_POKETEXT: /* write the word at location addr. */
113 case PTRACE_POKEDATA:
114 ret = generic_ptrace_pokedata(child, addr, data);
115 break;
116
117 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 93 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
118 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { 94 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) {
119 ret = -EIO; 95 ret = -EIO;
@@ -175,10 +151,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
175 break; 151 break;
176 } 152 }
177 153
178 case PTRACE_DETACH: /* detach a process that was attached. */
179 ret = ptrace_detach(child, data);
180 break;
181
182 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 154 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
183 int i; 155 int i;
184 unsigned long tmp; 156 unsigned long tmp;
@@ -210,7 +182,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
210 } 182 }
211 183
212 default: 184 default:
213 ret = -EIO; 185 ret = ptrace_request(child, request, addr, data);
214 break; 186 break;
215 } 187 }
216 return ret; 188 return ret;
diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c
index 85ed2f988f9..b100394813a 100644
--- a/arch/m68knommu/kernel/ptrace.c
+++ b/arch/m68knommu/kernel/ptrace.c
@@ -116,12 +116,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
116 int ret; 116 int ret;
117 117
118 switch (request) { 118 switch (request) {
119 /* when I and D space are separate, these will need to be fixed. */
120 case PTRACE_PEEKTEXT: /* read word at location addr. */
121 case PTRACE_PEEKDATA:
122 ret = generic_ptrace_peekdata(child, addr, data);
123 break;
124
125 /* read the word at location addr in the USER area. */ 119 /* read the word at location addr in the USER area. */
126 case PTRACE_PEEKUSR: { 120 case PTRACE_PEEKUSR: {
127 unsigned long tmp; 121 unsigned long tmp;
@@ -160,12 +154,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
160 break; 154 break;
161 } 155 }
162 156
163 /* when I and D space are separate, this will have to be fixed. */
164 case PTRACE_POKETEXT: /* write the word at location addr. */
165 case PTRACE_POKEDATA:
166 ret = generic_ptrace_pokedata(child, addr, data);
167 break;
168
169 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 157 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
170 ret = -EIO; 158 ret = -EIO;
171 if ((addr & 3) || addr < 0 || 159 if ((addr & 3) || addr < 0 ||
@@ -258,10 +246,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
258 break; 246 break;
259 } 247 }
260 248
261 case PTRACE_DETACH: /* detach a process that was attached. */
262 ret = ptrace_detach(child, data);
263 break;
264
265 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 249 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
266 int i; 250 int i;
267 unsigned long tmp; 251 unsigned long tmp;
@@ -325,7 +309,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
325 break; 309 break;
326 310
327 default: 311 default:
328 ret = -EIO; 312 ret = ptrace_request(child, request, addr, data);
329 break; 313 break;
330 } 314 }
331 return ret; 315 return ret;
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index 4b3ac32754d..8c21d8b3cb0 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -78,26 +78,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
78 unsigned long copied; 78 unsigned long copied;
79 79
80 switch (request) { 80 switch (request) {
81 case PTRACE_PEEKTEXT: /* read word at location addr. */
82 case PTRACE_PEEKDATA:
83 pr_debug("PEEKTEXT/PEEKDATA at %08lX\n", addr);
84 copied = access_process_vm(child, addr, &val, sizeof(val), 0);
85 rval = -EIO;
86 if (copied != sizeof(val))
87 break;
88 rval = put_user(val, (unsigned long *)data);
89 break;
90
91 case PTRACE_POKETEXT: /* write the word at location addr. */
92 case PTRACE_POKEDATA:
93 pr_debug("POKETEXT/POKEDATA to %08lX\n", addr);
94 rval = 0;
95 if (access_process_vm(child, addr, &data, sizeof(data), 1)
96 == sizeof(data))
97 break;
98 rval = -EIO;
99 break;
100
101 /* Read/write the word at location ADDR in the registers. */ 81 /* Read/write the word at location ADDR in the registers. */
102 case PTRACE_PEEKUSR: 82 case PTRACE_PEEKUSR:
103 case PTRACE_POKEUSR: 83 case PTRACE_POKEUSR:
@@ -167,13 +147,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
167 wake_up_process(child); 147 wake_up_process(child);
168 break; 148 break;
169 149
170 case PTRACE_DETACH: /* detach a process that was attached. */
171 pr_debug("PTRACE_DETACH\n");
172 rval = ptrace_detach(child, data);
173 break;
174 default: 150 default:
175 /* rval = ptrace_request(child, request, addr, data); noMMU */ 151 rval = ptrace_request(child, request, addr, data);
176 rval = -EIO;
177 } 152 }
178 return rval; 153 return rval;
179} 154}