lkml.org 
[lkml]   [2000]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjecterror in arch/i386/kernel/ptrace.c (subtle)
Date
From
Hi.  This is my first post to this list (not that i'm even subscribed) and am
very new to linux internals so apologies up front :)

There is a subtle bug in the behaviour of ptrace when modifying the EIP
register. Noteably, if the eip changes and a syscall was interrupted, the
signal handling code will subtract 2 from the eip thinking its trying to
restart the syscall (obviously, only on systems that restart slow syscalls).
This behaviour could cause problems with debuggers that change the execution
path.

My fix would be to change orig_eax to -1 if the eip register is modified.
Thus the signal handling code wouldnt think it needed to restart any syscalls.
This is untested code btw.

in the putreg function

case EIP:
put_stack_long(child, 4*ORIG_EAX - sizeof(struct pt_regs), -1);
break;

I believe that is all that is required, but since I'd hardly call myself a
kernel hacker I'll let the experts decide. Its highly likely that many other
unix systems have this same problem.

Please reply to this email personally, as I'm not a subscriber to this
mailing list.

--
Silvio
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.019 / U:2.196 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site