Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1368872imi; Sat, 23 Jul 2022 03:54:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uXnY4+8W/ywMcjZ0eDSO3c5iuYZpZY5E41bGgUkFy0vu8SWvr31PmPVxAyZaO0PiemclMZ X-Received: by 2002:a17:907:980b:b0:72b:215c:7933 with SMTP id ji11-20020a170907980b00b0072b215c7933mr3140093ejc.431.1658573675728; Sat, 23 Jul 2022 03:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658573675; cv=none; d=google.com; s=arc-20160816; b=JhKSLFegoTthGHkenbJXF78WggqJDm+to4igSksm/zxlDdMMkQUJ4iUrcHpXfAovPD as2eaxqeY5zB5w/cG/f8jEME54Qh7gSHQH6O+cxJKnbRV2q7HRfWS4TvKjgYnLMDQCHf MScL3NTPvT0Xq2GESXlC9jbuRTkfn27RPp2nvlHX6MZpHUxXwdy0cSH1PHB59gMoqaI8 4/IpcVES7Gl0GDZX9T3MQDLtVOFWR9tr9rkmbAQM2w3btX3pSqbTQZMrzxb5vS8yZn6R Ixm2RKPlbbqMKIlCMV6DfFmR3Izp/DwY99UWVKiB2ecoun6Lqy8kS/twy2syIs4MDvob 2VzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E/SqAi03AOziprDfxOpzoF4BLrd/8g58Ynb+zUh0d/4=; b=qba9DxxgEXReb4fLeXhDOkXx0FwxSE1XUdhEu8ptbXAeqW3MRM60KY4Q+KJEO0bUSX lIhG0b4/KOj8LodVf1skHLzZSYqUzy7n8y7oyl2RT9QvcG/FaekRjYSJ44MleoD0CY99 zd6rD9u9Cyv4mCCXmEWXO/afYJ8MJ528nn+3NvELCIG3a6Rp25YMFhXWAEI5ToWfGCV9 gvuzvCu7BZYZpGSstO58oG7lGpFORA/NcZUPEuTgLnPXY2vRObEA+7H/9FX5MmtlbmR/ DMpbzScWQ/k7FGXf2TMJlzyaMXyboDe1QZ5P/KTl6ewbQGRNewytnSHZT9cMgByWtuAC DPaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bdq6rxEA; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a1709061f0800b007065d999015si7788413ejj.232.2022.07.23.03.54.09; Sat, 23 Jul 2022 03:54:35 -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=@linuxfoundation.org header.s=korg header.b=bdq6rxEA; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238746AbiGWKIh (ORCPT + 99 others); Sat, 23 Jul 2022 06:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238618AbiGWKIP (ORCPT ); Sat, 23 Jul 2022 06:08:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285EC78205; Sat, 23 Jul 2022 03:01:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A70FB82C1A; Sat, 23 Jul 2022 10:01:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2AACC341C0; Sat, 23 Jul 2022 10:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658570473; bh=E1G/sj44DQ1PBjU34Ar46hxoaFI0v+72xBumAP9AX4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bdq6rxEAZpDeLvyl48wwWpumxsWIT2kfAMUdiNfjQVnMjXadHUUau9nijMxbuhkMR EaQd+zr21pZfmYO/ICwQGaBHL4ph7ZReVevolwsLAlhFgt/uF3/DQyvws35J4WTnU2 7jKmV5+cMSFHslU+LLDImWMK8M40BsqFVvBdq2Fs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Borislav Petkov , Thadeu Lima de Souza Cascardo , Ben Hutchings Subject: [PATCH 5.10 109/148] x86/bugs: Do IBPB fallback check only once Date: Sat, 23 Jul 2022 11:55:21 +0200 Message-Id: <20220723095254.884274073@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220723095224.302504400@linuxfoundation.org> References: <20220723095224.302504400@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Josh Poimboeuf commit 0fe4aeea9c01baabecc8c3afc7889c809d939bc2 upstream. When booting with retbleed=auto, if the kernel wasn't built with CONFIG_CC_HAS_RETURN_THUNK, the mitigation falls back to IBPB. Make sure a warning is printed in that case. The IBPB fallback check is done twice, but it really only needs to be done once. Signed-off-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/bugs.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -847,18 +847,13 @@ static void __init retbleed_select_mitig case RETBLEED_CMD_AUTO: default: if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || - boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { - - if (IS_ENABLED(CONFIG_RETPOLINE) && - IS_ENABLED(CONFIG_CC_HAS_RETURN_THUNK)) - retbleed_mitigation = RETBLEED_MITIGATION_UNRET; - else - retbleed_mitigation = RETBLEED_MITIGATION_IBPB; - } + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) + retbleed_mitigation = RETBLEED_MITIGATION_UNRET; /* - * The Intel mitigation (IBRS) was already selected in - * spectre_v2_select_mitigation(). + * The Intel mitigation (IBRS or eIBRS) was already selected in + * spectre_v2_select_mitigation(). 'retbleed_mitigation' will + * be set accordingly below. */ break;