error in arch/i386/kernel/ptrace.c (subtle)

From: Silvio Cesare (silvio@big.net.au)
Date: Sat Sep 02 2000 - 11:34:48 EST


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/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:13 EST