On 5/22/25 17:10, Andrew Cooper wrote:
~Andrew
SIGTRAP → sigreturn. Basically, we have to uplevel the suppression behavior to the kernel (where it belongs) instead of doing it at the ISA level.
So the problem is specifically that we're in a SYSCALL context (from FRED's point of view), and we rewrite state in the FRED FRAME to be another context which happened to have eflags.TF set.
And the combination of these two triggers a new singlestep to be pending immediately.
I have to admit that I didn't like the implication from the SYSCALL bit, and argued to have it handled differently, but alas. I think the real bug here is trying to ERETU with a splice of two different contexts worth of FRED state.
To some degree it is, yes. And it is sigreturn that does that splicing.
But it is desirable to be able to single-step across sigreturn if one is debugging from inside the signal handler, hence we should not clearing TF if it is set on sigreturn entry.
This is in fact exactly analogous to ERETU ignoring the syscall bit if TF is set before ERETU is executed, just one abstraction level higher up in the stack.
-hpa