From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53401 invoked by alias); 29 Mar 2018 20:20:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 53232 invoked by uid 89); 29 Mar 2018 20:20:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=H*F:U*fw, subsequently X-HELO: albireo.enyo.de From: Florian Weimer To: "H.J. Lu" Cc: Joseph Myers , "Carlos O'Donell" , "Tsimbalist\, Igor V" , GNU C Library Subject: Re: [PATCH] x86: Add __sigsetjmp_cancel and __setjmp_cancel References: <87efkkxwah.fsf@mid.deneb.enyo.de> <871sg2wzsv.fsf@mid.deneb.enyo.de> <87bmf6vfbp.fsf@mid.deneb.enyo.de> <87605eve34.fsf@mid.deneb.enyo.de> <87zi2qtz7s.fsf@mid.deneb.enyo.de> Date: Thu, 29 Mar 2018 20:20:00 -0000 In-Reply-To: (H. J. Lu's message of "Thu, 29 Mar 2018 13:17:54 -0700") Message-ID: <87vadetz09.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-03/txt/msg00606.txt.bz2 * H. J. Lu: > On Thu, Mar 29, 2018 at 1:15 PM, Florian Weimer 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.