Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4693591imw; Tue, 12 Jul 2022 12:33:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vgDziqQG8XSwf1OFGQJNYcwGuh0FCJLVmh+Fr+3j46m90bvFZeNV85ApoajVAU33NhzNxZ X-Received: by 2002:a17:90b:3502:b0:1f0:986:e36b with SMTP id ls2-20020a17090b350200b001f00986e36bmr6231630pjb.154.1657654422825; Tue, 12 Jul 2022 12:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657654422; cv=none; d=google.com; s=arc-20160816; b=Tm6UdM2H+Mt5mnavmoQcMzmn2a3oLDOjo6vusmKybF3foaWdoRGIUeFAnfo4NiRktt mIt5hwS/1bH1v3sCu8J3P3++CIwsFnEtpt99YAPyBPJQ+XqMnim5v/PYzIDTtl/fyKWQ fkMXjHO2nIK5iJ2ioA8xgFmPXRyk3C42aNcMkEP9mcMV4j+KhVP5RzGtHUS50FLtMFhn SLhqITkhjCGMglVT8T+Bpl2Sx6bLspT7G+OyySWth7o1jKG86WnddiG9HnlSPKm0dwva F431MUOwTIO8NJNWIm3PjlxVvUY0477ZKSe1PoXz4XeoUhC5Lg552TW+PfSSf+bc00Xt 47HA== 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=ClrVqubR9lMk2ILuGfPzXkSKQw8h/bqqClzExnYeJ+cDCm+Gpu7TMDVoQCfoObuVSa kn5y9gu4HRyYN4RcIyKJvIdwMKdy4igwMVD+UDRShheA+0DWAVo6BFpR2TofjBbmJvH/ Gcl+HZtvk4MA+OcyRu3Od7MX7PK4Wox1BpZb+KFpvuchZK6+fgLzdVhbaZIGmu6RtJ6m EtqnZ/7CiEQBpYsioo8hjmZfg1TBFEFHtkK+DvVw5G3h2/4/7XaAp1dok5/DG23OmUuH Q/Rcm7tbzCObM1qWvUpCFv/A1LHZloWfZaDWBAv3yrYHwflnvAjXz7rW04l41Adu3VJ1 Rp5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="z+UmkDn/"; 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 u22-20020a632356000000b003fd6d264f32si14808357pgm.610.2022.07.12.12.33.29; Tue, 12 Jul 2022 12:33: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="z+UmkDn/"; 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 S235015AbiGLS53 (ORCPT + 99 others); Tue, 12 Jul 2022 14:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234954AbiGLS4y (ORCPT ); Tue, 12 Jul 2022 14:56:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8ACD31E3; Tue, 12 Jul 2022 11:46: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 ams.source.kernel.org (Postfix) with ESMTPS id 4F622B81BBB; Tue, 12 Jul 2022 18:46:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79D30C3411C; Tue, 12 Jul 2022 18:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657651615; bh=E1G/sj44DQ1PBjU34Ar46hxoaFI0v+72xBumAP9AX4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z+UmkDn/GTPDFyyXGogJU8S+/AYJwK/w56EnAmDDv2dYW8OBkk3pllDJOIoK7DAdZ IULUHHc+iQ3OrAJ/ubJBN69a8ovSeIHeb8cQfKjECdxX6gyrNe86RtEWAuRCo4R00h Hs3mHiD88NvHLXWf5KPBBBHY3wGZ6/DfsbfSDEs0= 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/130] x86/bugs: Do IBPB fallback check only once Date: Tue, 12 Jul 2022 20:39:15 +0200 Message-Id: <20220712183251.505316520@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712183246.394947160@linuxfoundation.org> References: <20220712183246.394947160@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: 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;