Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3717346ybz; Mon, 20 Apr 2020 08:12:19 -0700 (PDT) X-Google-Smtp-Source: APiQypJobaYAOhxEl9qCNc/hl3isniGzuGlr9Nz2S3H08GTi2da1XZutVm2T3C/9pPKGtGupPTVS X-Received: by 2002:a17:906:5c43:: with SMTP id c3mr16188727ejr.3.1587395538987; Mon, 20 Apr 2020 08:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587395538; cv=none; d=google.com; s=arc-20160816; b=cy2IsZM13SUcd71CzTpHswboGbcG2Drse6TJamvyLV9I4S9r9bNeYW7+AexcP/86+y CMVXG/o8Pq3fuhuiBeCReUXnB1ZCI546hOMcqAFi3gSJ+Am6mGjKFog92ImfZy80QK40 uxXJmfA9AboI5ARru3fKp8rq+VSJ2l2nQd2liLHkox0FLpenCgSZJdK6mENzmIl2nLAi LPwRmv9NiPY3p5po5P5DXh6lBzLsArgqoMsxL+ht+hGMFfiiifJLsIzmboD/UdpayaWz 9hRC+eqOg3G3rVZXaNDXT7/R1vdyS4KGmVPWhJuOlnB++Cu+tUcGqKaOFFFYGaTTvobv dkGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=cuMa7oatx8var+QR+Rwmmp50C8J7BkkYmNVn7b8fhvM=; b=bO2DkuD5yjzizQ1j7/Yj1xTNdL0EU6y9SRDbJapzS9LtLKBqtIbpbNyj86G3ng9WH3 o46YAFMzLTnmAXVaYBKuUdObN3PU3pqNw7o+R3RW9KRitSqfS9bTBFvmHq9j6+Utd/Br sLUSS/hZ7JWR8gx93b8aJca/gWXVhsCkhHWTyHIyUQnGGbCLN657OiKZlEo9fc7aGXII 8Uh7Y5t/BmTe6IrF6F5B5PB1Di4+079h4uXlDqWxMtKs9ZMqW3JRM1HDDso02uGUx1FP mnIKoXyZeCZ77BbxZ6uqH4tsa9w0yj/oNasr8bobbXsTFAMCKoebkali+hARh3PdJ8Qf MlNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si656566ejy.347.2020.04.20.08.11.51; Mon, 20 Apr 2020 08:12:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729557AbgDTOEM (ORCPT + 99 others); Mon, 20 Apr 2020 10:04:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:39096 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727919AbgDTOEJ (ORCPT ); Mon, 20 Apr 2020 10:04:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 16C32ABD7; Mon, 20 Apr 2020 14:04:07 +0000 (UTC) Date: Mon, 20 Apr 2020 14:04:06 +0000 (UTC) From: Michael Matz To: Nick Desaulniers cc: Jakub Jelinek , Borislav Petkov , Sergei Trofimovich , LKML , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , clang-built-linux Subject: Re: [PATCH v2] x86: fix early boot crash on gcc-10 In-Reply-To: Message-ID: References: <20200415074842.GA31016@zn.tnic> <20200415231930.19755bc7@sf> <20200417075739.GA7322@zn.tnic> <20200417080726.GS2424@tucnak> <20200417084224.GB7322@zn.tnic> <20200417085859.GU2424@tucnak> <20200417090909.GC7322@zn.tnic> <20200417190607.GY2424@tucnak> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, 17 Apr 2020, Nick Desaulniers wrote: > Ah seems we do have __attribute__((no_selector)) > (https://reviews.llvm.org/D46300, > https://releases.llvm.org/7.0.0/tools/clang/docs/AttributeReference.html#no-stack-protector-clang-no-stack-protector-clang-no-stack-protector) > which differs from GCC attribute name. As you will discover upthread that was tried with GCC and found insufficient, as GCC is a bit surprising with optimize attributes: it resets every -f option from the command line and applies only the ones from the attributes. Including a potential -fno-omit-frame-pointer, causing all kinds of itches :) (The similar attribute in clang might work less surprising of course). Ciao, Michael. > > I'm still catching up on the thread (and my cat is insistent about > sleeping on my lap while I'm trying to use my laptop), but I like > https://lore.kernel.org/lkml/20200417190607.GY2424@tucnak/T/#m23d197d3a66a6c7d04c5444af4f51d940895b412 > if it additionally defined __no_stack_protector for compiler-clang.h. > > On Fri, Apr 17, 2020 at 12:06 PM Jakub Jelinek wrote: > > > > On Fri, Apr 17, 2020 at 11:22:25AM -0700, Nick Desaulniers wrote: > > > > Sorry, I don't quite follow. The idea is that an empty asm statement > > > > in foo() should prevent foo() from being inlined into bar()? > > > > > > s/inlined/tail called/ > > > > Yeah. The thing is, the caller changes the stack protector guard base > > value, so at the start of the function it saves a different value then > > it compares at the end. But, the function that it calls at the end > > actually doesn't return, so this isn't a problem. > > If it is tail called though, the stack protector guard checking is done > > before the tail call and it crashes. > > If the called function is marked with noreturn attribute or _Noreturn, > > at least GCC will also not tail call it and all is fine, but not sure > > what LLVM does in that case. > > Seems fine? https://godbolt.org/z/VEoEfw > (try commenting out the __attribute__((noreturn)) to observe the tail calls. >