Skip to content

Commit b3c1e01

Browse files
Christoph Hellwigtorvalds
authored andcommitted
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>
1 parent 7baab93 commit b3c1e01

3 files changed

Lines changed: 3 additions & 72 deletions

File tree

‎arch/h8300/kernel/ptrace.c‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ extern void h8300_enable_trace(struct task_struct *child);
4242
* in exit.c or in signal.c.
4343
*/
4444

45-
inline
46-
static 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-
5345
void ptrace_disable(struct task_struct *child)
5446
{
5547
h8300_disable_trace(child);
@@ -60,17 +52,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
6052
int ret;
6153

6254
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-
7455
/* read the word at location addr in the USER area. */
7556
case PTRACE_PEEKUSR: {
7657
unsigned long tmp = 0;
@@ -109,11 +90,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
10990
}
11091

11192
/* 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-
11793
case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
11894
if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) {
11995
ret = -EIO;
@@ -175,10 +151,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
175151
break;
176152
}
177153

178-
case PTRACE_DETACH: /* detach a process that was attached. */
179-
ret = ptrace_detach(child, data);
180-
break;
181-
182154
case PTRACE_GETREGS: { /* Get all gp regs from the child. */
183155
int i;
184156
unsigned long tmp;
@@ -210,7 +182,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
210182
}
211183

212184
default:
213-
ret = -EIO;
185+
ret = ptrace_request(child, request, addr, data);
214186
break;
215187
}
216188
return ret;

‎arch/m68knommu/kernel/ptrace.c‎

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
116116
int ret;
117117

118118
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-
125119
/* read the word at location addr in the USER area. */
126120
case PTRACE_PEEKUSR: {
127121
unsigned long tmp;
@@ -160,12 +154,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
160154
break;
161155
}
162156

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-
169157
case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
170158
ret = -EIO;
171159
if ((addr & 3) || addr < 0 ||
@@ -258,10 +246,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
258246
break;
259247
}
260248

261-
case PTRACE_DETACH: /* detach a process that was attached. */
262-
ret = ptrace_detach(child, data);
263-
break;
264-
265249
case PTRACE_GETREGS: { /* Get all gp regs from the child. */
266250
int i;
267251
unsigned long tmp;
@@ -325,7 +309,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
325309
break;
326310

327311
default:
328-
ret = -EIO;
312+
ret = ptrace_request(child, request, addr, data);
329313
break;
330314
}
331315
return ret;

‎arch/microblaze/kernel/ptrace.c‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
7878
unsigned long copied;
7979

8080
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-
10181
/* Read/write the word at location ADDR in the registers. */
10282
case PTRACE_PEEKUSR:
10383
case PTRACE_POKEUSR:
@@ -167,13 +147,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
167147
wake_up_process(child);
168148
break;
169149

170-
case PTRACE_DETACH: /* detach a process that was attached. */
171-
pr_debug("PTRACE_DETACH\n");
172-
rval = ptrace_detach(child, data);
173-
break;
174150
default:
175-
/* rval = ptrace_request(child, request, addr, data); noMMU */
176-
rval = -EIO;
151+
rval = ptrace_request(child, request, addr, data);
177152
}
178153
return rval;
179154
}

0 commit comments

Comments
 (0)