Fix PR44281 (bad RA with global regs)
Michael Matz
matz@suse.de
Mon Feb 29 20:09:00 GMT 2016
Hi,
On Mon, 29 Feb 2016, Mikael Pettersson wrote:
> Well, almost. While it is true that a signal handler cannot
> *accidentally* clobber the register state of the interrupted thread, it
> can in fact access and update any part of that state via the ucontext_t
> passed to it. Doing so is uncommon, but not unheard of and not even
> that difficult -- I've done it myself in several different runtime
> systems.
Yeah, well, sure. That's not clobbering the registers directly though,
but setting it up so that the kernel does it on return :) If you do that,
you have to have a special sig-handler anyway, lest it clobbers other
registers that are currently in use by the interrupted piece of code.
> The code in a signal handler cannot assume that global register
> variables are in sync with the interrupted thread, or that plain
> assignments to them are reflected back, but that's not GCC's fault, nor
> is it GCC's job to make that happen.
And it's documented to not happen (reliably anyway), so all is fine.
Ciai,
Michael.
More information about the Gcc-patches
mailing list