From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 425AEC2D0EF for ; Fri, 17 Apr 2020 19:06:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19A9820780 for ; Fri, 17 Apr 2020 19:06:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AhxeHMIZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729749AbgDQTGY (ORCPT ); Fri, 17 Apr 2020 15:06:24 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:40077 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729287AbgDQTGX (ORCPT ); Fri, 17 Apr 2020 15:06:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587150382; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=l7NhxqPBgZKRGKonQi6tXhellcY9V1W8AoTLk+/o7jk=; b=AhxeHMIZqqfumAhEEcGpEJT0vbq+K9osCYcm/FPh6HGkN2ruGA1677b0yV8yDVVmcZbaiY RBYMKRnhW94QgDmwdjV/eBJTtaxBbI1X88SQB/k9MQzExmQNJHD1AazJ5AwOeRXtBfe28M r0uEf22j0Nkqu8PTimCRWGUr97N948w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-68-ETcNWG3XNDSFn1nDcYYgJg-1; Fri, 17 Apr 2020 15:06:20 -0400 X-MC-Unique: ETcNWG3XNDSFn1nDcYYgJg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5842107ACC7; Fri, 17 Apr 2020 19:06:18 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-104.ams2.redhat.com [10.36.112.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C485D7664; Fri, 17 Apr 2020 19:06:17 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 03HJ6EnA028978; Fri, 17 Apr 2020 21:06:14 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 03HJ6785028977; Fri, 17 Apr 2020 21:06:07 +0200 Date: Fri, 17 Apr 2020 21:06:07 +0200 From: Jakub Jelinek To: Nick Desaulniers Cc: Borislav Petkov , Sergei Trofimovich , Michael Matz , 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 Message-ID: <20200417190607.GY2424@tucnak> Reply-To: Jakub Jelinek 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Jakub