Re: strange behavior with sigreturn() to 32bit

From: stsp
Date: Mon Dec 12 2022 - 23:23:20 EST



13.12.2022 02:59, Andy Lutomirski пишет:
I generally distrust gdb when mixed modes are involved -- it's fundamentally intensely buggy. Now maybe you're not hitting the bugs I know of, but still...

Anyway, the behavior I expect (not that I've tested this, but based on my memory of how this is all supposed to work) is that an attempt to return to user mode will fail with #GP because the full value of RIP is compared to the segment limit, which is 2^32-1. And #GP is 0xd, so your non-gdb outputs look broadly correct...
Yes, that may explain the problem.
So where is this check? And should it
be fixed to apply the mask to RIP?
Or should I always clear high parts
by hands? If so - only for RIP?