From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Florian Weimer Newsgroups: gmane.comp.lib.glibc.alpha Subject: Re: [PATCH 0/2] nptl: Update struct pthread_unwind_buf Date: Sat, 24 Feb 2018 16:46:00 +0100 Message-ID: <87a7vyjsqv.fsf@mid.deneb.enyo.de> References: <20180201205757.51911-1-hjl.tools@gmail.com> <4abf9786-1879-f16c-5a01-3261cd718d63@redhat.com> <87inb7pug7.fsf@mid.deneb.enyo.de> <2a02aac9-6aa3-4dc6-b122-039ae85365e8@redhat.com> <87d11emoap.fsf@mid.deneb.enyo.de> <878tc2mkgr.fsf@mid.deneb.enyo.de> <90d3ee18-c292-117f-a0c1-7822e340ca02@redhat.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1519487055 18274 195.159.176.226 (24 Feb 2018 15:44:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 24 Feb 2018 15:44:15 +0000 (UTC) Cc: "Carlos O'Donell" , GNU C Library To: "H.J. Lu" Original-X-From: libc-alpha-return-90554-glibc-alpha=m.gmane.org@sourceware.org Sat Feb 24 16:44:11 2018 Return-path: Envelope-to: glibc-alpha@blaine.gmane.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=C7Wuy +outA3SqOjtU8fGcDBiQ2FzECoYbbxpdfQ5J3S6t1epTer/WAu5EJrNa+rAI6jG/ dec2UIAPDyaoUzG0kCOtKZI4qQJ8LG9qNFco9KPCs6lEhMEEgfMVdGEnmlr1Pxv2 5PU93wZltLRAJDGQ1ES11bnuxfWmr899hYvc0s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=R8Fighr155J l39ExndwhWIlJmQ0=; b=ByKu4COTtorzRPwPQ0AJlATih8pGUFTMcewNCnCLFqz FE33EFudawaQxQbrUS9haLddA9kdlz5ha3hfVUD2LLaP73lPovY2W3jKbeC+rvyA h+YS44acHX3z0mftPn+apjN9/kyBD8E6qV1RrLFErLJKI/NZDbqgd2MNXew4l50c = Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: libc-alpha-owner@sourceware.org Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy= X-HELO: albireo.enyo.de In-Reply-To: (H. J. Lu's message of "Sat, 24 Feb 2018 07:19:44 -0800") Xref: news.gmane.org gmane.comp.lib.glibc.alpha:82886 Archived-At: Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epbze-00048q-Iu for glibc-alpha@blaine.gmane.org; Sat, 24 Feb 2018 16:44:10 +0100 Received: (qmail 64407 invoked by alias); 24 Feb 2018 15:46:13 -0000 Received: (qmail 64350 invoked by uid 89); 24 Feb 2018 15:46:06 -0000 * 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.