This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86: Add __sigsetjmp_cancel and __setjmp_cancel
* H. J. Lu:
> On Thu, Mar 29, 2018 at 1:15 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
>> * H. J. Lu:
>>
>>> You need to make a choice. You either don't introduce a new symbol
>>> version or don't save shadow stack for thread cancellation. You
>>> can't have both.
>>
>> I don't understand. We have room to save the shadow stack pointer in
>> the existing struct.
>
> No, we don't have room in struct pthread_unwind_buf:
>
> Note: There is an unused pointer space in pthread_unwind_buf_data. But
> it isn't suitable for saving and restoring shadow stack register since
> x32 is a 64-bit process with 32-bit software pointer and kernel may
> place x32 shadow stack above 4GB. We need to save and restore 64-bit
> shadow stack register for x32.
We have for void * fields. They are subsequently overwritten by
__pthread_register_cancel. But __sigsetjmp can write to them first
without causing any harm. We just need a private __longjmp_cancel
that doesn't restore the shadow stack pointer.