Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp857884imm; Tue, 3 Jul 2018 00:56:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfLr+VjWO7xv6F58a024q2mHaz8NwzM8YRxHMka8m8QkpHm/46OEP7eB8mwoEaJJS/N+cXV X-Received: by 2002:a63:b445:: with SMTP id n5-v6mr20588007pgu.104.1530604575760; Tue, 03 Jul 2018 00:56:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530604575; cv=none; d=google.com; s=arc-20160816; b=t6ETQDrX0qFe4duEZ4ipy1oywbf6knX1oLzdVWGVs5OcnblolwFwWMcsJACFlYlO/a IYOsNCNQReKvAx6gKnfRWDqQBDlDud7Hjymddsi63aolB+NAR+krzt6Ln+OWpfjMjKOs VTOVvJm78MTUSRue09MeLFJX4RIVlsPV8OTu3jn/fTDcqiO/6xbxMm34kl5rjX/2GMuu qX3pihACfBmiQ0Xp5IHFi47yO/kJNWwgDCmBaZV6SWvatgCm7NaQ3fDv1j22IewMRM4K Erd1c+TAwtg/AQrEpM34numwH9RU5b5oNrkreN+hXz38HLdjBfBZp8ufzLmjI1+z0bry NwmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=tyzx6aNElunJnIZx2sPlo+QVDasrrKyyT0f8J/5uCBU=; b=mvx0kRoB3inGnfGG2W/a9ji5pFrqTLwGj+hv8PP60xZH4vZisg7RpuIlqgzJjwzCJ8 KHlBC821RqNKSb0qMMqdIiWjWWLY9yWxrUTL8z3xMNQP+vvemgHitdqoUmwOYlA6Llri Q/G/9uGmzmKXVL2URs1vAOWYIdBLVVbVgtQBW8kCwmSkzp2tcIE0pLA4tS9Mi4hmCDR1 t74eMRqxQximDQGhGMkXGqrSwhsdNxYrtvxUn6rc1hbmQF/GIVz9fLTUqyFyKAT12kYn Fn93BAUhtLPT0pcZAlg7zwmLbOzwqxOcxMugG7Kc2XO1Ca9LfpLDLj7UnYyvgiJUB9Ft 200g== 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 u1-v6si497077pgo.114.2018.07.03.00.56.01; Tue, 03 Jul 2018 00:56:15 -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 S933542AbeGCHzR (ORCPT + 99 others); Tue, 3 Jul 2018 03:55:17 -0400 Received: from terminus.zytor.com ([198.137.202.136]:35379 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753364AbeGCHzP (ORCPT ); Tue, 3 Jul 2018 03:55:15 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w637slM4202654 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 3 Jul 2018 00:54:48 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w637slbE202651; Tue, 3 Jul 2018 00:54:47 -0700 Date: Tue, 3 Jul 2018 00:54:47 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Zhenzhong Duan Message-ID: Cc: hpa@zytor.com, tglx@linutronix.de, bp@alien8.de, zhenzhong.duan@oracle.com, linux-kernel@vger.kernel.org, mingo@kernel.org, luto@kernel.org, peterz@infradead.org, torvalds@linux-foundation.org Reply-To: torvalds@linux-foundation.org, luto@kernel.org, mingo@kernel.org, peterz@infradead.org, zhenzhong.duan@oracle.com, linux-kernel@vger.kernel.org, bp@alien8.de, tglx@linutronix.de, hpa@zytor.com In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/mm/32: Initialize the CR4 shadow before __flush_tlb_all() Git-Commit-ID: 4fb5f58e8d191f7c81637ad81284e4848afb4244 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 4fb5f58e8d191f7c81637ad81284e4848afb4244 Gitweb: https://git.kernel.org/tip/4fb5f58e8d191f7c81637ad81284e4848afb4244 Author: Zhenzhong Duan AuthorDate: Mon, 2 Jul 2018 23:49:54 -0700 Committer: Ingo Molnar CommitDate: Tue, 3 Jul 2018 09:26:10 +0200 x86/mm/32: Initialize the CR4 shadow before __flush_tlb_all() On 32-bit kernels, __flush_tlb_all() may have read the CR4 shadow before the initialization of CR4 shadow in cpu_init(). Fix it by adding an explicit cr4_init_shadow() call into start_secondary() which is the first function called on non-boot SMP CPUs - ahead of the __flush_tlb_all() call. ( This is somewhat of a layering violation, but start_secondary() does CR4 bootstrap in the PCID case anyway. ) Signed-off-by: Zhenzhong Duan Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: "H. Peter Anvin" Link: http://lkml.kernel.org/r/b07b6ae9-4b57-4b40-b9bc-50c2c67f1d91@default Signed-off-by: Ingo Molnar --- arch/x86/kernel/smpboot.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index c2f7d1d2a5c3..db9656e13ea0 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -221,6 +221,11 @@ static void notrace start_secondary(void *unused) #ifdef CONFIG_X86_32 /* switch away from the initial page table */ load_cr3(swapper_pg_dir); + /* + * Initialize the CR4 shadow before doing anything that could + * try to read it. + */ + cr4_init_shadow(); __flush_tlb_all(); #endif load_current_idt();