]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0015-x86-mm-Add-the-nopcid-boot-option-to-turn-off-PCID.patch
build: reformat existing patches
[pve-kernel.git] / patches / kernel / 0015-x86-mm-Add-the-nopcid-boot-option-to-turn-off-PCID.patch
CommitLineData
59d5af67 1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
321d628a
FG
2From: Andy Lutomirski <luto@kernel.org>
3Date: Thu, 29 Jun 2017 08:53:20 -0700
59d5af67 4Subject: [PATCH] x86/mm: Add the 'nopcid' boot option to turn off PCID
321d628a
FG
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9CVE-2017-5754
10
11The parameter is only present on x86_64 systems to save a few bytes,
12as PCID is always disabled on x86_32.
13
14Signed-off-by: Andy Lutomirski <luto@kernel.org>
15Reviewed-by: Nadav Amit <nadav.amit@gmail.com>
16Reviewed-by: Borislav Petkov <bp@suse.de>
17Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
18Cc: Andrew Morton <akpm@linux-foundation.org>
19Cc: Arjan van de Ven <arjan@linux.intel.com>
20Cc: Borislav Petkov <bp@alien8.de>
21Cc: Dave Hansen <dave.hansen@intel.com>
22Cc: Linus Torvalds <torvalds@linux-foundation.org>
23Cc: Mel Gorman <mgorman@suse.de>
24Cc: Peter Zijlstra <peterz@infradead.org>
25Cc: Rik van Riel <riel@redhat.com>
26Cc: linux-mm@kvack.org
27Link: http://lkml.kernel.org/r/8bbb2e65bcd249a5f18bfb8128b4689f08ac2b60.1498751203.git.luto@kernel.org
28Signed-off-by: Ingo Molnar <mingo@kernel.org>
29(cherry picked from commit 0790c9aad84901ca1bdc14746175549c8b5da215)
30Signed-off-by: Andy Whitcroft <apw@canonical.com>
31Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
32(cherry picked from commit 62d3a63645c17611fe8ccc0c5adc5e840d9cff7b)
33Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
34---
35 Documentation/admin-guide/kernel-parameters.txt | 2 ++
36 arch/x86/kernel/cpu/common.c | 18 ++++++++++++++++++
37 2 files changed, 20 insertions(+)
38
39diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
40index 73fd6abac39b..3510e255ef4c 100644
41--- a/Documentation/admin-guide/kernel-parameters.txt
42+++ b/Documentation/admin-guide/kernel-parameters.txt
43@@ -2700,6 +2700,8 @@
44 nopat [X86] Disable PAT (page attribute table extension of
45 pagetables) support.
46
47+ nopcid [X86-64] Disable the PCID cpu feature.
48+
49 norandmaps Don't use address space randomization. Equivalent to
50 echo 0 > /proc/sys/kernel/randomize_va_space
51
52diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
53index c8b39870f33e..904485e7b230 100644
54--- a/arch/x86/kernel/cpu/common.c
55+++ b/arch/x86/kernel/cpu/common.c
56@@ -168,6 +168,24 @@ static int __init x86_mpx_setup(char *s)
57 }
58 __setup("nompx", x86_mpx_setup);
59
60+#ifdef CONFIG_X86_64
61+static int __init x86_pcid_setup(char *s)
62+{
63+ /* require an exact match without trailing characters */
64+ if (strlen(s))
65+ return 0;
66+
67+ /* do not emit a message if the feature is not present */
68+ if (!boot_cpu_has(X86_FEATURE_PCID))
69+ return 1;
70+
71+ setup_clear_cpu_cap(X86_FEATURE_PCID);
72+ pr_info("nopcid: PCID feature disabled\n");
73+ return 1;
74+}
75+__setup("nopcid", x86_pcid_setup);
76+#endif
77+
78 static int __init x86_noinvpcid_setup(char *s)
79 {
80 /* noinvpcid doesn't accept parameters */
81--
822.14.2
83