Maybe this needs a more sophisticated 'is_inside_syscall()' check which will also mind 'Rip' position inside syscall / unixcall dispatchers. But that is probably not entirely trivial to do right and nice (not like I have a ready suggestion for details)\>
This isn't really enough, because we don't know whether the %rsp is correct yet. The problem gets worse if you care about the other registers. I think the only correct solution here is to effectively mask off signals until we're ready to process them. By this I don't mean literally masking the signals (this would be too expensive), but rather having the signal handler defer responding. This ends up being related to some other bugs, namely 54807, and I think Billy Laws also came up with a similar bug that was never formally filed. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10232#note_131632