Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp457436imi; Fri, 22 Jul 2022 02:48:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u/UFS+pbfvc5jrFIFvV4VA2RRJkj5UTyNSzLzMurV7tJax/Rf3qOjBno2dAF/4UkX5VPMg X-Received: by 2002:aa7:8811:0:b0:52a:b0a4:a324 with SMTP id c17-20020aa78811000000b0052ab0a4a324mr2701945pfo.63.1658483322748; Fri, 22 Jul 2022 02:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658483322; cv=none; d=google.com; s=arc-20160816; b=uo9r/L+5YuHnJ7h8sdVNiLJSaHWnsTLPvyIcGvVqF5KyRE8tFDCl19Fra/qqAbEVQu Sjux2w/KaaTUZqUdxqkoTXiGHckhltXero3o6LLdjKHHdmWKRj+bYlUTFnGwNgdEE/Yc cy8NUpTbcjy0hgqcl8h6+UU4k6p8xWAgwqn7MTnTT5syqhFD9aYp/bIODkxlsVOiURSe GqN6T9LJlY4jQ6LGEKnM+qvtYfbnK8VteHSDjs/kFggKiDLgALXDIQwkysFncf0//Bpa JP64UNbXRHPONA0e2gQKVsrAVu6qMrO1Xr9tvf6dOk7hiElJx2BCA+qKip6GFq8C8UWJ 3ivA== 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=Kj50gZ/s3OG5r681qmfPKVNj32sN1p1VKoGTB+OPIgnLULF57PeDsP59FeAw0T61jY IyrVk1I5A2yvqjlsBDf5ACiix7jY1v7tz43Wg+9i8itPYFcEDZn6DSQqTDCgdwq/y+HQ iwYzpMKhMZJhHzS/VRcdCvH0WC5LBZm9GPpyNZcLBOmmDSAQRAF3g2u/yZuXsv+hQngO BYkYRamGVBqGqIdSfGRrt6KhI9Fsz3bsdIqJBguapdHT85AnvvZQo+4guvYvnPnKD2ra wJe+tJipES7cLrV0OrjgWyxOs5H91C+0w0PkQHLR4fpVbYBMIzuqGA1SXnYqbnPOo8UI MlWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ffePE97K; 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 pj9-20020a17090b4f4900b001f24b418354si1539255pjb.117.2022.07.22.02.48.28; Fri, 22 Jul 2022 02:48:42 -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=ffePE97K; 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 S235533AbiGVJOz (ORCPT + 99 others); Fri, 22 Jul 2022 05:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235530AbiGVJOF (ORCPT ); Fri, 22 Jul 2022 05:14:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16C03AF878; Fri, 22 Jul 2022 02:10:57 -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 A53E261F4C; Fri, 22 Jul 2022 09:10:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D4D4C341C6; Fri, 22 Jul 2022 09:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658481056; bh=7W6eWTEXjOF812u7n64OA5d98HorY4GvtJh/QdEio40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffePE97KGVR9gortEhNGtfXJThmMag746kO86xDmOgBBMGBChVxE5BdzXz0zfAOJq vZfzAX3nv/yVqZiLb+dt9YDHO+5FaQ/wvjJ2GFculQetbaX8Y3S8PFrhiM3DWBbog0 itJjeCb0+JzEiB1V1keBl53VTytCvYYEXxs98ZRo= 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/70] x86/bugs: Do IBPB fallback check only once Date: Fri, 22 Jul 2022 11:07:33 +0200 Message-Id: <20220722090652.852737617@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722090650.665513668@linuxfoundation.org> References: <20220722090650.665513668@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: 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;