* [Linux-ia64] Fix error checking in sys32_ptrace
@ 2003-03-27 15:02 Andreas Schwab
2003-03-27 20:49 ` David Mosberger
2003-04-16 23:05 ` Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Schwab @ 2003-03-27 15:02 UTC (permalink / raw)
To: linux-ia64
This fixes sys32_ptrace to use ptrace_check_attach, so that it
automatically inherits all future enhancements there.
Andreas.
--- linux-2.4.19/arch/ia64/ia32/sys_ia32.c.~1~ 2003-03-20 16:33:21.000000000 +0100
+++ linux-2.4.19/arch/ia64/ia32/sys_ia32.c 2003-03-21 22:27:32.000000000 +0100
@@ -3076,26 +3076,23 @@ sys32_ptrace (int request, pid_t pid, un
ret = -ESRCH;
read_lock(&tasklist_lock);
child = find_task_by_pid(pid);
+ if (child)
+ get_task_struct(child);
read_unlock(&tasklist_lock);
if (!child)
goto out;
ret = -EPERM;
if (pid = 1) /* no messing around with init! */
- goto out;
+ goto out_tsk;
if (request = PTRACE_ATTACH) {
ret = sys_ptrace(request, pid, addr, data, arg4, arg5, arg6, arg7, stack);
- goto out;
- }
- ret = -ESRCH;
- if (!(child->ptrace & PT_PTRACED))
- goto out;
- if (child->state != TASK_STOPPED) {
- if (request != PTRACE_KILL)
- goto out;
+ goto out_tsk;
}
- if (child->p_pptr != current)
- goto out;
+
+ ret = ptrace_check_attach(child, request = PTRACE_KILL);
+ if (ret < 0)
+ goto out_tsk;
switch (request) {
case PTRACE_PEEKTEXT:
@@ -3105,12 +3102,12 @@ sys32_ptrace (int request, pid_t pid, un
ret = put_user(value, (unsigned int *) A(data));
else
ret = -EIO;
- goto out;
+ goto out_tsk;
case PTRACE_POKETEXT:
case PTRACE_POKEDATA: /* write the word at location addr */
ret = ia32_poke(regs, child, addr, data);
- goto out;
+ goto out_tsk;
case PTRACE_PEEKUSR: /* read word at addr in USER area */
ret = -EIO;
@@ -3185,6 +3182,8 @@ sys32_ptrace (int request, pid_t pid, un
break;
}
+ out_tsk:
+ free_task_struct(child);
out:
unlock_kernel();
return ret;
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Linux-ia64] Fix error checking in sys32_ptrace
2003-03-27 15:02 [Linux-ia64] Fix error checking in sys32_ptrace Andreas Schwab
@ 2003-03-27 20:49 ` David Mosberger
2003-04-16 23:05 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: David Mosberger @ 2003-03-27 20:49 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 27 Mar 2003 16:02:48 +0100, Andreas Schwab <schwab@suse.de> said:
Andreas> This fixes sys32_ptrace to use ptrace_check_attach, so that it
Andreas> automatically inherits all future enhancements there.
The patch didn't apply in 2.5, but I merged it manually.
Thanks,
--david
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Linux-ia64] Fix error checking in sys32_ptrace
2003-03-27 15:02 [Linux-ia64] Fix error checking in sys32_ptrace Andreas Schwab
2003-03-27 20:49 ` David Mosberger
@ 2003-04-16 23:05 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2003-04-16 23:05 UTC (permalink / raw)
To: linux-ia64
On Thursday 27 March 2003 8:02 am, Andreas Schwab wrote:
> This fixes sys32_ptrace to use ptrace_check_attach, so that it
> automatically inherits all future enhancements there.
I applied this in 2.4.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-16 23:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-27 15:02 [Linux-ia64] Fix error checking in sys32_ptrace Andreas Schwab
2003-03-27 20:49 ` David Mosberger
2003-04-16 23:05 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox