This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 0/2] nptl: Update struct pthread_unwind_buf
* H. J. Lu:
> PLEASE take a closer look:
>
> Yes, there are
>
> void *__pad[4];
>
> But the name is misleading. It isn't real padding. This is
> an opaque array:
>
> /* Private data in the cleanup buffer. */
> union pthread_unwind_buf_data
> {
> /* This is the placeholder of the public version. */
> void *pad[4];
>
> struct
> {
> /* Pointer to the previous cleanup buffer. */
> struct pthread_unwind_buf *prev;
>
> /* Backward compatibility: state of the old-style cleanup
> handler at the time of the previous new-style cleanup handler
> installment. */
> struct _pthread_cleanup_buffer *cleanup;
>
> /* Cancellation type before the push call. */
> int canceltype;
> } data;
> };
>
> Only the last element in __pad[4] is unused. There is
The entire __pad array is unused until the handler is registered,
which happens *after* the call to __sigsetjmp, in the
__pthread_register_cancel function. This means that __sigsetjmp may
clobber it.