Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4704369imw; Tue, 12 Jul 2022 12:43:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szkSfRL/CrRDfeiE9TiNObbIN0AENnI8VjSPbuEcZuv0tJtSgNl3hKcCeG7XyO1Rvoxtry X-Received: by 2002:a05:6a00:134c:b0:52a:c52f:b339 with SMTP id k12-20020a056a00134c00b0052ac52fb339mr15533501pfu.32.1657655029625; Tue, 12 Jul 2022 12:43:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657655029; cv=none; d=google.com; s=arc-20160816; b=kNL/zq7v7zcDva9rktQzS4QJouUU/W1MqJV+0uJp4O8zXW0W5DHVzGJ15HqKorZz3/ 9g09eH7GlLGUCPpLsAAEUEVT0exfJpfJDuCle/TPEPZaDTn/6pp6KQXBy+aCHhpDtrrO FtN39xFa6bnOa0tg2grs00/FJJdjjJRJuFBSKgDH+1i9QulNZhnX9AHCx7egYKFNje7v thrQ1aO7HqF7NLWbKEE1X5ms0WJ/oCj+0f+27mzNmrQwdnmfV/kComt0vsP/AE8krX6B PNCVrowrb8KxuY6kufwy9dbTZwdtUDFlDaMg6zfZfGZFrlyjGUeToc8G50za3VptOefl z7PQ== 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=mqJ5mMfNzCCbff3Rdjj7/9E9ZdAH3wRBDmJVniTKRsw=; b=0eXKCbv/QvqgCA9YXZg+UtpS57nGzYk2GkYe0Wf/MCVfysbq5ZO66/lOrEYJ1U14fH GWIq5bDZXXn2zIyBT9YKXFts7CT+KQZg7NdR1QhMHaT9OTWS3DEqadphz5msKRRCFn63 N8X4VgoZf3urYibgw32yT6yMMc7Ezu4YRAbfDBdKEqgqxQ97mXiqExhv8fKocnTDdIwK fbFYHzYFmDo+6iOx18SoVPX3fVQgGqnwN5nezJxmzfEtlO2OVpqRmNgwpqvfPhkBQ3wb 4Hxr029ifGPYnziZIFnTt0YuDhMKfCcHxHR+Xs6iLFHXhYAsOs0ZhpJY1FmxQs5Y4xHS O4iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FrnA1tmn; 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 62-20020a630341000000b0040d4bd5d708si14787451pgd.848.2022.07.12.12.43.36; Tue, 12 Jul 2022 12:43:49 -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=FrnA1tmn; 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 S236074AbiGLTQC (ORCPT + 99 others); Tue, 12 Jul 2022 15:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236181AbiGLTOe (ORCPT ); Tue, 12 Jul 2022 15:14:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C4C7E7AE0; Tue, 12 Jul 2022 11:54:28 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8A26D61274; Tue, 12 Jul 2022 18:54:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2746BC3411C; Tue, 12 Jul 2022 18:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657652066; bh=7W6eWTEXjOF812u7n64OA5d98HorY4GvtJh/QdEio40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FrnA1tmne8G3ISQX37o5ws2QfniK42gKi4VYG4AeJcKHhsgwXa7rgNMuvQmGYXj+b cDI8vo3M9zH6CeLPllgzMNA2MlBaCoNOSGxwvY+R4uI9GmAqmqma6RaW54dpFSrBsM 6fSnhvMaIzUFNQwm7TKgOVStfbZldrtLQTPkI+Nc= 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 Subject: [PATCH 5.18 38/61] x86/bugs: Do IBPB fallback check only once Date: Tue, 12 Jul 2022 20:39:35 +0200 Message-Id: <20220712183238.507635568@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712183236.931648980@linuxfoundation.org> References: <20220712183236.931648980@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.7 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,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 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: 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 @@ -884,18 +884,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;