Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3497240pxp; Tue, 22 Mar 2022 22:54:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzloV9IFoMXHdHJXkYBtsHYOrbHKpQkGewaUz8/XK+PL+ximC2QiKI8YlCDqpMFcq8ylres X-Received: by 2002:a17:906:c1c6:b0:6d5:cc27:a66c with SMTP id bw6-20020a170906c1c600b006d5cc27a66cmr29970869ejb.650.1648014864192; Tue, 22 Mar 2022 22:54:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648014864; cv=none; d=google.com; s=arc-20160816; b=tsw+tf4AIReBVVqueC+of3q1v0349sVaV7aYs+tigimj6+/49f6d5pOxYhOlTHLwlD PP+p+2I+J5o6cBGsssY3dDzQ745wmDH/4IyzpcYNQRnTNN3UzeSo+BYl9hyKY40oY/wa tMbZZNxI9Fnw9JkRkfJ4ZqETAk8H61o8u0tVuGT/635dSGYhi/rTTnJnmI6kpotF87Bv vzJ1gcsgLo8VOxc/PfjzE53n6h+cLh+lvoAe5Bl7kU6zffWLa18VrigQUPyY+K+o/Rwr kMiplRc28ooUESIuLK6pWfeRm/s0FKT9YHRATuAQ27/WC/1W8RFkQwnf8fH5FTHU4wc+ RikQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=8kywFf8VlHS1oYms1GMJtOQogL6li1B/8ObC7yvuhbs=; b=LFEbWc53KCCMDLCkiYR9FJH0pmzr9V9tdXnefhc8TqMLz69ftJykSQ+mBVn2ypxVLf BSph/byTSs/u3ECKvsEkrSl15l/9F/tTPy1KQF9Y0YJOGe76U/wwBCjetRUEp56Lg/t/ OvKEu0X4VLaATdEVWZLyM1qxn2fMH6ldEknyrS+SbTS6GNbYX53CdMZhyRFwQAmoFP0M XRg6p4avVOVC36WPixqJG2F2x6AYVK8EcsoK8oCoplQTzkv5ExTbiGmkgIy0ewlIi65X mq/xem9AUdlpa7y1KzhwFMTYLeQvPC9Sise0aFhZs7+jd/dnOXj2zknYS0cuOwYg9QDQ 09rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=y3zbldPa; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k23-20020a508ad7000000b00418e8ed6aacsi14746404edk.481.2022.03.22.22.53.59; Tue, 22 Mar 2022 22:54:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=y3zbldPa; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233421AbiCVUZh (ORCPT + 99 others); Tue, 22 Mar 2022 16:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbiCVUZe (ORCPT ); Tue, 22 Mar 2022 16:25:34 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2478466600; Tue, 22 Mar 2022 13:24:02 -0700 (PDT) Date: Tue, 22 Mar 2022 20:24:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1647980641; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8kywFf8VlHS1oYms1GMJtOQogL6li1B/8ObC7yvuhbs=; b=y3zbldPaze5+Km/rPpWLwW2kC7HLgiHlkCS+jOA18Ajjd9O9h3LRpFFL9WU4JBK2/jLsTm RqpdxSAyAdLSzgkQB9GIf0utr/IOKKYv3qXScsf/MAflS81eiqxSkMlRTHeG+aJsmSTeve woncraxwjVwxId6tLMOblYk+2mqBBbV6oLwSsAsVwVLhyidWgtxvin6tUGZpFp0+Dl5a+H HrT3eMEMcP81mssvodbdBawkiolX4PTGE45o9OAwpY9eJsWzgjvAdWG+G9V15onW1R2AZJ WZ0Lb0RAwxyh4DFq8+JZkBEsEeMDPdQCsO1PMLb44Lld1m2Kvwo/dzGBUhdYmg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1647980641; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8kywFf8VlHS1oYms1GMJtOQogL6li1B/8ObC7yvuhbs=; b=AXC7c4XTGYpf0kKSb7ZrLwgJj7B/AVeR8tCkXQma+iCPR2iuRPVE73UlzyKp7szN5psXFa RKNlfQ+VMQH8X7Bg== From: "tip-bot2 for Nathan Chancellor" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/Kconfig: Only enable CONFIG_CC_HAS_IBT for clang >= 14.0.0 Cc: Nathan Chancellor , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220318230747.3900772-2-nathan@kernel.org> References: <20220318230747.3900772-2-nathan@kernel.org> MIME-Version: 1.0 Message-ID: <164798064053.389.15506291444001135104.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/core branch of tip: Commit-ID: 262448f3d18959d175b10e28a3b65f41d1d7313f Gitweb: https://git.kernel.org/tip/262448f3d18959d175b10e28a3b65f41d1d7313f Author: Nathan Chancellor AuthorDate: Fri, 18 Mar 2022 16:07:46 -07:00 Committer: Peter Zijlstra CommitterDate: Tue, 22 Mar 2022 21:12:13 +01:00 x86/Kconfig: Only enable CONFIG_CC_HAS_IBT for clang >= 14.0.0 Commit 156ff4a544ae ("x86/ibt: Base IBT bits") added a check for a crash with 'clang -fcf-protection=branch -mfentry -pg', which intended to exclude Clang versions older than 14.0.0 from selecting CONFIG_X86_KERNEL_IBT. clang-11 does not have the issue that the check is testing for, so CONFIG_X86_KERNEL_IBT is selectable. Unfortunately, there is a different crash in clang-11 that was fixed in clang-12. To make matters worse, that crash does not appear to be entirely deterministic, as the same input to the compiler will sometimes crash and other times not, which makes dynamically checking for the crash like the '-pg' one unreliable. To make everything work properly for all common versions of clang, use a hard version check of 14.0.0, as that will be the first release upstream that has both bugs properly fixed. Signed-off-by: Nathan Chancellor Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220318230747.3900772-2-nathan@kernel.org --- arch/x86/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0f0672d..921e4eb 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1865,9 +1865,10 @@ config CC_HAS_IBT # GCC >= 9 and binutils >= 2.29 # Retpoline check to work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93654 # Clang/LLVM >= 14 - # fentry check to work around https://reviews.llvm.org/D111108 + # https://github.com/llvm/llvm-project/commit/e0b89df2e0f0130881bf6c39bf31d7f6aac00e0f + # https://github.com/llvm/llvm-project/commit/dfcf69770bc522b9e411c66454934a37c1f35332 def_bool ((CC_IS_GCC && $(cc-option, -fcf-protection=branch -mindirect-branch-register)) || \ - (CC_IS_CLANG && $(success,echo "void a(void) {}" | $(CC) -Werror $(CLANG_FLAGS) -fcf-protection=branch -mfentry -pg -x c - -c -o /dev/null))) && \ + (CC_IS_CLANG && CLANG_VERSION >= 140000)) && \ $(as-instr,endbr64) config X86_KERNEL_IBT