Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4704118imw; Tue, 12 Jul 2022 12:43:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tTBOS///4odz1ytHHtAoP8N3QUrhdYlSOUi2D6sXGDBq8m7bDj2FvmOObhKc8yqYqQJ7nl X-Received: by 2002:a17:90b:3910:b0:1f0:386e:c0ee with SMTP id ob16-20020a17090b391000b001f0386ec0eemr5981064pjb.141.1657655015011; Tue, 12 Jul 2022 12:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657655015; cv=none; d=google.com; s=arc-20160816; b=N6mjQAUSAq9HdhxSV4Zt9dVTACuP9gws19t0FukGaYVTga1NPgQXTc9wWfuSIm0LI6 AwNL3AoGKxNnCzrqmtU747GQaVdHCZJ1WwW8+x0Dctp+sZpHuwYfaGVHbQTcbHbMo3rt /XYM5TGw4kVIHEZ8tIdBYgeFasrs5pDnOx8VJJwR1WGq37WLXQLsBImypll+Y6h/MFxf cIwx4tjuMYzbG9X+52ljtbF61qroRX/vZLUiWNFESMmHo+H0mw/QZa2tLInKajAxDe6I kytQLYKBmP6zqYXDsn2m7d7tWPlrdLV5gVwwKqNZbPzcDGod04kJLb9LKZ7HjbOdrbR/ fiPA== 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=YBmE9gbRwqSM8erFFCSrexnwSInIAjjQdwaofW5iwZU=; b=igUNQaNePb0LmX6bGWxOYQhq36jjI/QUJUUttNKbvUxsgFNHrUqsUln4hR1TUbdyql oy6rT3qilcgKWyHgY/TyKjNvWZf8aXCP2AXFvxKqFLwjG6MupWGj5r5bbMim3w1BkEXe lknduTT5UyXfvaEC+v2og5YNhzzUGqIrp2qQBUIPhDC35VQ+UT1d9V55u0g9pc5oOwTK O93dx3v2TRv9tRjPexCeg1QU4OSms9lM5sL8xS4q0ps6Ke6Hlx+FGihT8XEK00Tc8OyG 8giFPl0wJY0yZcR2wEh3As0iIkpOBZb9KBBLSr4ioydtnyghOBFKStSETlzqYingyFEw HZuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EHdcI0IC; 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 lk11-20020a17090b33cb00b001ecfcc0a97dsi23588931pjb.71.2022.07.12.12.43.22; Tue, 12 Jul 2022 12:43: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=EHdcI0IC; 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 S236015AbiGLTPi (ORCPT + 99 others); Tue, 12 Jul 2022 15:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236126AbiGLTO3 (ORCPT ); Tue, 12 Jul 2022 15:14:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A99EE7AC2; Tue, 12 Jul 2022 11:54:12 -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 82F3B61123; Tue, 12 Jul 2022 18:54:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DDFAC3411C; Tue, 12 Jul 2022 18:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657652050; bh=N7xRo/S7eUzo2YjbTTxDeIjczUHyBLeWeth9bT8iJ9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHdcI0ICCcabx1SghGAD/qerLzehxO33Tl6qo9KJ4RuiWxKVqDVq/K+sbLRmdKse0 YIHxWCzlWCo6FmqDFa1JPEFrBNU87pTw7iq2j2nRTrWW06YuZK9oAVJKKOSxCzlTlH 1q3vTqrfKgCYX0joeTYxwIIhzncW5i09RyxPtBaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , "Peter Zijlstra (Intel)" , Borislav Petkov , Thadeu Lima de Souza Cascardo Subject: [PATCH 5.18 43/61] x86/speculation: Fix SPEC_CTRL write on SMT state change Date: Tue, 12 Jul 2022 20:39:40 +0200 Message-Id: <20220712183238.685207713@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 56aa4d221f1ee2c3a49b45b800778ec6e0ab73c5 upstream. If the SMT state changes, SSBD might get accidentally disabled. Fix that. Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1451,7 +1451,8 @@ static void __init spectre_v2_select_mit static void update_stibp_msr(void * __unused) { - write_spec_ctrl_current(x86_spec_ctrl_base, true); + u64 val = spec_ctrl_current() | (x86_spec_ctrl_base & SPEC_CTRL_STIBP); + write_spec_ctrl_current(val, true); } /* Update x86_spec_ctrl_base in case SMT state changed. */