From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75871 invoked by alias); 14 Jul 2018 23:16:16 -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 75735 invoked by uid 89); 14 Jul 2018 23:15:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f68.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+g8oXAfo5phovGCi9l9V7AbY7SogQ2AS02msohKrLXs=; b=CSASdkyccj56shgxfWNjqcKrcK0PIQv2ufgDCz9HfHuonGWKhZQkQz8s9Z65yl95Kl 6eu3hVz9xSNPi7YhyNJ/38lBQRkWn0aWwsXMr0NJZOdb49eW0Ui79Aev4awHOB9xvy/N LwvMep4UdHpEsw251hlMMb2n3ly6/dJub0u3gFg5AE4Nf15lwVWWw+x4nmsksn+O+b6H i1uCuLpFavHrCyii6q7b9gpsvfk3h++Wy9ID5SYfoNlKB6/t62XWqwYfrX0t7Pv7OqFI BSWBIP3mdircvUsTbWZEnWqCYwF6ItzLwMNieiVun7MCA4TqhlY/lUawM1hirN+0z9nn YvFQ== MIME-Version: 1.0 In-Reply-To: <87wotxifg7.fsf@mid.deneb.enyo.de> References: <20180613153207.57232-1-hjl.tools@gmail.com> <20180613153207.57232-3-hjl.tools@gmail.com> <20180713132252.GC2606@gmail.com> <87fu0lk2tf.fsf@mid.deneb.enyo.de> <87wotxifg7.fsf@mid.deneb.enyo.de> From: "H.J. Lu" Date: Sat, 14 Jul 2018 23:16:00 -0000 Message-ID: Subject: Re: V2: [PATCH 02/24] x86: Support shadow stack pointer in setjmp/longjmp To: Florian Weimer Cc: "Carlos O'Donell" , GNU C Library Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-07/txt/msg00412.txt.bz2 On Sat, Jul 14, 2018 at 4:07 PM, Florian Weimer wrote: > * H. J. Lu: > >> On Sat, Jul 14, 2018 at 12:57 PM, Florian Weimer wrote: >>> * H. J. Lu: >>> >>>> + /* Get the current ssp. */ >>>> + rdsspd %edx >>> >>> This moves the required binutils version past current Debian's 2.28. >>> >>> I know we recently increased the minimum make version recently, but >>> binutils 2.28 is still quite new, I think. >>> >>> Could we list the bytes for the instruction explicitly instead? >> >> The next patch: >> >> https://sourceware.org/ml/libc-alpha/2018-07/msg00266.html >> >> has sysdeps/x86/configure.ac: > > We currently have this (as of commit > faaee1f07ed25b2779bfd935ffb29f431b80d6d3): > > ==> sysdeps/unix/sysv/linux/x86/jmp_buf-ssp.sym <== > #include > #undef __saved_mask > > -- > SHADOW_STACK_POINTER_OFFSET offsetof(struct __jmp_buf_tag, __saved_mask.__saved.__shadow_stack_pointer) > > ==> sysdeps/x86/jmp_buf-ssp.sym <== > -- FIXME: Define SHADOW_STACK_POINTER_OFFSET to support shadow stack. > > So SHADOW_STACK_POINTER_OFFSET is defined unconditionally. I don't > see how the quoted patch changes that. > > Making sure that rdssp is only assembled with --enable-cet looks like > the right solution, but you need something like #if ENABLE_CET, and > not depend on SHADOW_STACK_POINTER_OFFSET being defined. Take sysdeps/x86_64/setjmp.S as example: /* Don't save shadow stack register if shadow stack isn't enabled. */ #if !SHSTK_ENABLED # undef SHADOW_STACK_POINTER_OFFSET #endif ..... Shadow stack pointer is saved/restored only if --enable-cet is used to configure glibc. If you compile glibc with -fcf-protection, but without configuring glibc with --enable-cet, result is undefined. -- H.J.