Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2008897imm; Tue, 10 Jul 2018 11:31:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcGKNQYrJSny0Hg6fBjdaA+um1NGawD6sz6tzTVyaFsGitrEaP4prq1g+WkeDw0kPyOEnzG X-Received: by 2002:a63:4450:: with SMTP id t16-v6mr23788942pgk.102.1531247461151; Tue, 10 Jul 2018 11:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531247461; cv=none; d=google.com; s=arc-20160816; b=Ij+mQrCHr/tgUAMhmJU5wsa+Kd4Ki2hSfeNK2rd2S+UV9gocNTJYr98qXkuxMFXKXx lBCeNdfzqWpe+9qePZHbh/1FOIW9ePFqIyVr9Fa1rTqvsQgQJpTiYUaD2GwOBUTALJID +Q+oS5wZ0QEtODMgp2M9zKQllefYZbzE8bQustBqUTNLieD05Jk/ZLFycCesh6Jd5x/v kfO/9NQhryWUB2YDtlproLSFI0F7BM4ctnlrYjFKRV0FVC8qM21kqJoqCZJxKE5dUGzg eZzPmvaZkSjPQo0iCXgW3iuYntT2J9ZBNQ5MYmYP0kYSNMWdHhFz3Wv+KtwUe6iKdZeM 1qKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=m4STnymSE+SUHIGHXIZj1uJ+hNKFdKOpH80QlAQnWoE=; b=JNOum+SEPRnlNZ+jGd/PT2kNb89SAe8etlGRO2LvsP3fxXmVCbdPWwRnT6Of4TnE63 Muu9Af52R59EqvPyTOs7uiYVrUlOT/TzX0BYFUrMa7N/euBWd8B/aNRdb/U0jX/PZBpC PCEefM0iLwwMF2SmfqunQANtcBzuY4EpRAHe34P+9UwO+f4QzWSChxre/1xBg36aSIHg cin6IWvgbMfSh+ONWf7EC6hSYj1pPg8Pw4DtG60O48I4G8wQty7cA21YY2t6MreW6nBZ 07pLP5XoUvDk3Ki3AijxOXtXns+NyVHujQn93e+iFjSZCG5wgiA7R3w1jm8am0+Prb+n Cddg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11-v6si17040860plp.464.2018.07.10.11.30.45; Tue, 10 Jul 2018 11:31:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387862AbeGJS3u (ORCPT + 99 others); Tue, 10 Jul 2018 14:29:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45428 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732245AbeGJS3t (ORCPT ); Tue, 10 Jul 2018 14:29:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 45F11EB4; Tue, 10 Jul 2018 18:29:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Borislav Petkov , Borislav Petkov , Brian Gerst , Dave Hansen , Fenghua Yu , "H. Peter Anvin" , Linus Torvalds , Matthew Whitehead , Oleg Nesterov , One Thousand Gnomes , Peter Zijlstra , Rik van Riel , Thomas Gleixner , Yu-cheng Yu , Ingo Molnar Subject: [PATCH 4.9 18/52] x86/cpu: Re-apply forced caps every time CPU caps are re-read Date: Tue, 10 Jul 2018 20:24:46 +0200 Message-Id: <20180710182451.211448595@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710182449.285532226@linuxfoundation.org> References: <20180710182449.285532226@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Lutomirski commit 60d3450167433f2d099ce2869dc52dd9e7dc9b29 upstream. Calling get_cpu_cap() will reset a bunch of CPU features. This will cause the system to lose track of force-set and force-cleared features in the words that are reset until the end of CPU initialization. This can cause X86_FEATURE_FPU, for example, to change back and forth during boot and potentially confuse CPU setup. To minimize the chance of confusion, re-apply forced caps every time get_cpu_cap() is called. Signed-off-by: Andy Lutomirski Reviewed-by: Borislav Petkov Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Matthew Whitehead Cc: Oleg Nesterov Cc: One Thousand Gnomes Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Yu-cheng Yu Link: http://lkml.kernel.org/r/c817eb373d2c67c2c81413a70fc9b845fa34a37e.1484705016.git.luto@kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/common.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -848,6 +848,13 @@ void get_cpu_cap(struct cpuinfo_x86 *c) init_scattered_cpuid_features(c); init_speculation_control(c); + + /* + * Clear/Set all flags overridden by options, after probe. + * This needs to happen each time we re-probe, which may happen + * several times during CPU initialization. + */ + apply_forced_caps(c); } static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c)