]>
Commit | Line | Data |
---|---|---|
59d5af67 | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
321d628a FG |
2 | From: Andy Lutomirski <luto@kernel.org> |
3 | Date: Thu, 29 Jun 2017 08:53:20 -0700 | |
59d5af67 | 4 | Subject: [PATCH] x86/mm: Add the 'nopcid' boot option to turn off PCID |
321d628a FG |
5 | MIME-Version: 1.0 |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | CVE-2017-5754 | |
10 | ||
11 | The parameter is only present on x86_64 systems to save a few bytes, | |
12 | as PCID is always disabled on x86_32. | |
13 | ||
14 | Signed-off-by: Andy Lutomirski <luto@kernel.org> | |
15 | Reviewed-by: Nadav Amit <nadav.amit@gmail.com> | |
16 | Reviewed-by: Borislav Petkov <bp@suse.de> | |
17 | Reviewed-by: Thomas Gleixner <tglx@linutronix.de> | |
18 | Cc: Andrew Morton <akpm@linux-foundation.org> | |
19 | Cc: Arjan van de Ven <arjan@linux.intel.com> | |
20 | Cc: Borislav Petkov <bp@alien8.de> | |
21 | Cc: Dave Hansen <dave.hansen@intel.com> | |
22 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
23 | Cc: Mel Gorman <mgorman@suse.de> | |
24 | Cc: Peter Zijlstra <peterz@infradead.org> | |
25 | Cc: Rik van Riel <riel@redhat.com> | |
26 | Cc: linux-mm@kvack.org | |
27 | Link: http://lkml.kernel.org/r/8bbb2e65bcd249a5f18bfb8128b4689f08ac2b60.1498751203.git.luto@kernel.org | |
28 | Signed-off-by: Ingo Molnar <mingo@kernel.org> | |
29 | (cherry picked from commit 0790c9aad84901ca1bdc14746175549c8b5da215) | |
30 | Signed-off-by: Andy Whitcroft <apw@canonical.com> | |
31 | Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> | |
32 | (cherry picked from commit 62d3a63645c17611fe8ccc0c5adc5e840d9cff7b) | |
33 | Signed-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 | ||
39 | diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt | |
40 | index 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 | ||
52 | diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c | |
53 | index 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 | -- | |
82 | 2.14.2 | |
83 |