Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1006492ybz; Wed, 22 Apr 2020 11:49:25 -0700 (PDT) X-Google-Smtp-Source: APiQypKQ6d82KTBHlwxqaFEEscUpqKKPyqNSq99QEK/9XPaJhpykswkPbvdCIlICHujPCJfWtEh5 X-Received: by 2002:aa7:d306:: with SMTP id p6mr24109edq.35.1587581365436; Wed, 22 Apr 2020 11:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587581365; cv=none; d=google.com; s=arc-20160816; b=PBpJedxsU92UBdHyoiDqEb1nWkPjeDpeiBsuCPfit50u80PYxIw3ruL+8VPgw6TNX4 ZpjdgkL2rPyQOUztnT+4TrBLtq+QlbmkTOTAoBK3Y06s9PGPZ/Imm9wOIr7ri79fx1w7 V0ROH/fw7Y9Up1syUIoS5SrossvDpFX7uQKZjEoKqiPOf84mGsPDJ3r+1YgfgWCTPPA+ Rph7GrhN53SdJmR5O6slq7FPXdOQuXbxv6Y2X0bKm6Nv8o/tLA/rVW2W8fqd9XbvafSP rSDfZ85n57ycRcGaNYVfhAeSGfaezNELxRc19cU9BzfT03zu0Sd5tqJ6gN5ttBhEjWIe yGYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=5k+yPGx/qr44nGnCycXueReY9HedaR9suO/n1V+xq9k=; b=QYxT5YU3T+I+MohzU6CwyeQm+K80sFyuw1Qi3AULdZTpui7/vuvJ9WDuOxzmQpiPBQ 4c1afz+otSvS5BxSymtrH50+vKZbg6NmoiGiWClrI2yvEa8/e/q6IIqfJ/Ps2E17T2NQ sMgzqZHIhA3/Qx9rnu2pPEXrY5K4HIrNBJ0fhLSv3nkuseR8emZauU5TLtSewaW6tRBu h9JM3NiW5N7sN0QE8r5L5ROL1310CyX72rEu/dN6U0DEjxTVEBw3D6yiSxAoKi29Rc/X vvRCzQHU+zSdGTm+Mj2JJd3o0JDmQSvwIN04xlUxV4CkaWywvVAm/dmWLsfrGG/TeTvV zaew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RFUf9SlO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si53765ejr.178.2020.04.22.11.49.02; Wed, 22 Apr 2020 11:49:25 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=RFUf9SlO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbgDVSrm (ORCPT + 99 others); Wed, 22 Apr 2020 14:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725810AbgDVSrl (ORCPT ); Wed, 22 Apr 2020 14:47:41 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6BADC03C1A9 for ; Wed, 22 Apr 2020 11:47:41 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id r14so1569314pfg.2 for ; Wed, 22 Apr 2020 11:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5k+yPGx/qr44nGnCycXueReY9HedaR9suO/n1V+xq9k=; b=RFUf9SlO6v6pCUVmkWkRELNgk+1N3Zs9ucmPxL27YFrNXeKy55VzP5MIVle/v1F0y3 VD0ElDOeI+B64ryKAl8IBmi6hGumY21RHSNiRJ+uXkPlg0v39ASsZhYhhdckAR5aIvIQ y6IzK01PbEzBGR8W4Uc1OHyusUmkCkOi8mYbyknc6ppZSuaCmxYlLYiNrgOsBfvtDlFG en+sqwFn7adRwle5S4ucCO4m2jqY8Vy1hHFYPPXg1FSpBPP9lg+LgLwN6sJ7nciNIbCp qgZm8hne2F5Mo3wOaeWsb38L0eFtVe1BHgm+KxDnMbHf+HKOEEPiDDl1nbKnRxlIUwlc wISw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5k+yPGx/qr44nGnCycXueReY9HedaR9suO/n1V+xq9k=; b=gTEo0tkInrMCxzRWwFP2tekElzxyCMWSDm5QnDDdd8fAvueDsDrnfx06HNpbm23gXa cqC10ldQHBMTFXRvJYMazfakrh91SWpzTMAeIBTP3gJ2ykwKXVzc0iZ1iONR5vkrLLJR SSd6pcpvY3RArPXluum+VfISM5RMMOpAJw80Brfg3eW40H0ExAcKTxaBIgcNaRyl4k8g cd5fMl+45VVq62g0/qpIkJoez3adBUwa7l4pFpqRP/WlIZzKxrygscdlqbcTZKhuXSpI DGYkp9fHShwoMxxSooaHNnJb+LWYCI6TQ0j+CMuEriigEotUSYSlKrwhvgZ1AHhVK5Hn FAOA== X-Gm-Message-State: AGi0PubhhNZkF8ztLHfFBLKaJbTCAt9AfaucixF+ao0R2IRl9Ol2ZjY5 69l6kjNVLsA8ZySS1EJX1BJ14pc7MGYelEwxei71HQ== X-Received: by 2002:a63:5009:: with SMTP id e9mr366799pgb.381.1587581260929; Wed, 22 Apr 2020 11:47:40 -0700 (PDT) MIME-Version: 1.0 References: <20200417190607.GY2424@tucnak> <20200422102309.GA26846@zn.tnic> <20200422114007.GC20730@hirez.programming.kicks-ass.net> <20200422134924.GB26846@zn.tnic> <20200422135531.GM2424@tucnak> <20a91f2e-0f25-8dba-e441-3233cc1ef398@suse.cz> <20200422165339.GE26846@zn.tnic> In-Reply-To: <20200422165339.GE26846@zn.tnic> From: Nick Desaulniers Date: Wed, 22 Apr 2020 11:47:27 -0700 Message-ID: Subject: Re: [PATCH v2] x86: fix early boot crash on gcc-10 To: Borislav Petkov Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , Jakub Jelinek , Peter Zijlstra , Michael Matz , Sergei Trofimovich , LKML , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , clang-built-linux Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 9:53 AM Borislav Petkov wrote: > > On Wed, Apr 22, 2020 at 04:16:53PM +0200, Martin Li=C5=A1ka wrote: > > And as I talked to Boris, I would recommend to come up with a "configur= e" check > > that a compiler does not optimize the key code sequence: > > > > $ cat asm-detect.c > > int foo(int a); > > int bar(int a) > > { > > int r =3D foo(a); > > asm (""); > > return r; > > } > > > > $ gcc -O2 -c asm-detect.c -S -o/dev/stdout | grep jmp > > [no output] > > That is a good test to run at the beginning of the compilation I guess. > > Without the asm("") it produces: > > bar: > .LFB0: > .cfi_startproc > jmp foo@PLT > .cfi_endproc > > I'd like for LLVM folks to confirm that this is a good test for LLVM too > Trying that here with clang gives: > > bar: # @bar > .cfi_startproc > # %bb.0: > jmp foo # TAILCALL > .Lfunc_end0: > > so this *looks* like it would work with LLVM too but I might be missing > something... LGTM https://godbolt.org/z/ExtHx7 --=20 Thanks, ~Nick Desaulniers