]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0115-selftests-x86-ldt_gdt-Run-most-existing-LDT-test-cas.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0115-selftests-x86-ldt_gdt-Run-most-existing-LDT-test-cas.patch
1 From 8307fa79c19ddc006d5f816f6eb5127d9064dcd3 Mon Sep 17 00:00:00 2001
2 From: Andy Lutomirski <luto@kernel.org>
3 Date: Sat, 4 Nov 2017 04:19:51 -0700
4 Subject: [PATCH 115/241] selftests/x86/ldt_gdt: Run most existing LDT test
5 cases against the GDT as well
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 CVE-2017-5754
11
12 Now that the main test infrastructure supports the GDT, run tests
13 that will pass the kernel's GDT permission tests against the GDT.
14
15 Signed-off-by: Andy Lutomirski <luto@kernel.org>
16 Cc: Borislav Petkov <bpetkov@suse.de>
17 Cc: Linus Torvalds <torvalds@linux-foundation.org>
18 Cc: Peter Zijlstra <peterz@infradead.org>
19 Cc: Thomas Gleixner <tglx@linutronix.de>
20 Link: http://lkml.kernel.org/r/686a1eda63414da38fcecc2412db8dba1ae40581.1509794321.git.luto@kernel.org
21 Signed-off-by: Ingo Molnar <mingo@kernel.org>
22 (cherry picked from commit adedf2893c192dd09b1cc2f2dcfdd7cad99ec49d)
23 Signed-off-by: Andy Whitcroft <apw@canonical.com>
24 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
25 (cherry picked from commit f05c092307d8479094d83d4337d66e6e86e730a9)
26 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
27 ---
28 tools/testing/selftests/x86/ldt_gdt.c | 10 +++++++++-
29 1 file changed, 9 insertions(+), 1 deletion(-)
30
31 diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c
32 index 337f217d0ae9..05d0d6f49c2c 100644
33 --- a/tools/testing/selftests/x86/ldt_gdt.c
34 +++ b/tools/testing/selftests/x86/ldt_gdt.c
35 @@ -188,7 +188,15 @@ static bool install_valid_mode(const struct user_desc *d, uint32_t ar,
36
37 static bool install_valid(const struct user_desc *desc, uint32_t ar)
38 {
39 - return install_valid_mode(desc, ar, false, true);
40 + bool ret = install_valid_mode(desc, ar, false, true);
41 +
42 + if (desc->contents <= 1 && desc->seg_32bit &&
43 + !desc->seg_not_present) {
44 + /* Should work in the GDT, too. */
45 + install_valid_mode(desc, ar, false, false);
46 + }
47 +
48 + return ret;
49 }
50
51 static void install_invalid(const struct user_desc *desc, bool oldmode)
52 --
53 2.14.2
54