Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5764316imm; Mon, 23 Jul 2018 05:48:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfwaOrhQytYxSLmxxKsMxIgnrmRz7q4aHROLEVLjyvQVfet0GAgsxx9CkTMG8Yodt8IRR7D X-Received: by 2002:a62:3856:: with SMTP id f83-v6mr13228955pfa.48.1532350090816; Mon, 23 Jul 2018 05:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532350090; cv=none; d=google.com; s=arc-20160816; b=Dyj6x+kegNdfC8TrpLYe0++ILCC+WY7t6LgVsb7fLPlwjo+GFnmNFtqkVaVP+aeY8r cTGvBSK4/npVwR5GH8CeeesF2rDTfz1erat8gIpSPGVR/FAzGXz3e5tUgqE7hc1pA5HR 3IlAqoHzEfDLqMeSwhHqyRafF96z+lKFq7mJ3DSuro8cqEkIq6jlVeSAA07wMpppLU33 6VVMWACyo0hOV7lUk50A1VRLgZTo0VJ9CwYYigY8+w4gE6qcRE0zZZhJO5S7Bta62Gy6 qEt8q2Ap0EY868UfQdljfTBEBVOayHhvthmrqb4WgmbtqaZNRF/gHk6JG88pVO4SVWaj iKpw== 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=WZ7mswDRiOw0JLie2TlgDnDujVRgg8R0SduaQpnffm0=; b=Ze+G7CuP8/WI1Risjtc38XJqMLP1lqivwbFjhIr3fFZ/lhTIVqkufsvGYG8pFzjl8C dr7q7QsTPZFIf2wHYtWR6bROtSauLFWH9wDymglFm2x0PTpjI01RhInrh0HSNgDH/Shw CoJ0m4cVf5f4QnVcxyGoYVjNGZHa/Io9LvsRh532qpOSm6wGwkPpkAaCyw8LznFVgnTt XGc/FFIyt6p1yqM3+t+embR1jZNM0Cn3ug4hyB3nPWg94cUiX6VJ0yRVS3Jl1ioYFhIC o0z6tVQmmRnFMBwrTBUM8+ar4Ow5aiaZHSi54SLkBB1G2BWqYrDzH3GX5TWVp9HSqzJD 16iw== 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 w71-v6si8639309pgd.667.2018.07.23.05.47.56; Mon, 23 Jul 2018 05:48:10 -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 S2389710AbeGWNsM (ORCPT + 99 others); Mon, 23 Jul 2018 09:48:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51884 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388499AbeGWNsL (ORCPT ); Mon, 23 Jul 2018 09:48:11 -0400 Received: from localhost (LFbn-1-12238-233.w90-92.abo.wanadoo.fr [90.92.53.233]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 84616BE6; Mon, 23 Jul 2018 12:47:07 +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 , "Srivatsa S. Bhat" Subject: [PATCH 4.4 099/107] x86/cpu: Re-apply forced caps every time CPU caps are re-read Date: Mon, 23 Jul 2018 14:42:33 +0200 Message-Id: <20180723122418.464404710@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723122413.003644357@linuxfoundation.org> References: <20180723122413.003644357@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.4-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 Signed-off-by: Srivatsa S. Bhat 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 @@ -803,6 +803,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)