Google luky.org euqset.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ptrace single-stepping change breaks Wine



On Sat, 1 Jan 2005, Davide Libenzi wrote:
> 
> I used the test program below on 2.4.27, 2.6.8.1 and latest BK + TF-careful. 
> In all cases single stepping over POPF succeeded.

I don't think you realize what the failure case for popf was.

It wasn't that we couldn't single-step it: it was that we corrupted the 
resulting elfags value after single-stepping it.

Try to extend your program to print out not only the EIP after the 
single-step, but also the value of EFLAGS, and you'll see what I mean. 
Earlier kernels are _really_ bad at it: they'll always report that TF is 
set. The "TF-careful" patch gets TF right for normal instructions, and the 
"TF-popf" patch gets TF right after popf too.

The one remaining case I know of where we still get TF wrong is "pushf",
where single-stepping a pushf will not corrupt TF, but it will save the
wrong value on the stack (which obviously may corrupt TF _later_, when the
paired "popf" happens).

It's sad that x86 put the single-stepping into a user-visible register.  
All the other debug state is kernel-only, meaning that we don't have to
play any games with them... It would have been nice if Intel had added a
"single-step" bit to %db7, and then just or'ed in the values of TF and the
new flag when deciding to single-step. That would have allowed the legacy
stuff to work, and given debuggers a much less intrusive way to single-
step.

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


$B$3$N>pJs$,$"$J$?$NC5$7$F$$?$b$N$+$I$&$+A*Br$7$F$/$@$5$!#(B
yes/$B$^$5$K$3$l$@!*(B   no/$B0c$&$J$!(B   part/$B0lIt8+$D$+$C$?(B   try/$B$3$l$G;n$7$F$_$k(B

$B$"$J$?$,C5$7$F$$?>pJs$O$I$N$h$&$J$3$H$+!"$4<+M3$K5-F~2<$5$!#FC$K!V$^$5$K$3$l$@!*!W$H8@$&>l9g$O5-F~$r$*4j$$7$^$9!#(B
$BNc(B:$B!VJ#?t$N%^%7%s$+$i(BCATV$B7PM3$G(Bipmasquerade$B$rMxMQ$7$F(BWeb$B$r;2>H$7$?$>l9g$N@_Dj$K$D$$F!W(B
Follow-Ups: References: