]> git.proxmox.com Git - pve-kernel.git/blame - 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
CommitLineData
321d628a
FG
1From 8307fa79c19ddc006d5f816f6eb5127d9064dcd3 Mon Sep 17 00:00:00 2001
2From: Andy Lutomirski <luto@kernel.org>
3Date: Sat, 4 Nov 2017 04:19:51 -0700
e4cdf2a5 4Subject: [PATCH 115/241] selftests/x86/ldt_gdt: Run most existing LDT test
321d628a
FG
5 cases against the GDT as well
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10CVE-2017-5754
11
12Now that the main test infrastructure supports the GDT, run tests
13that will pass the kernel's GDT permission tests against the GDT.
14
15Signed-off-by: Andy Lutomirski <luto@kernel.org>
16Cc: Borislav Petkov <bpetkov@suse.de>
17Cc: Linus Torvalds <torvalds@linux-foundation.org>
18Cc: Peter Zijlstra <peterz@infradead.org>
19Cc: Thomas Gleixner <tglx@linutronix.de>
20Link: http://lkml.kernel.org/r/686a1eda63414da38fcecc2412db8dba1ae40581.1509794321.git.luto@kernel.org
21Signed-off-by: Ingo Molnar <mingo@kernel.org>
22(cherry picked from commit adedf2893c192dd09b1cc2f2dcfdd7cad99ec49d)
23Signed-off-by: Andy Whitcroft <apw@canonical.com>
24Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
25(cherry picked from commit f05c092307d8479094d83d4337d66e6e86e730a9)
26Signed-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
31diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c
32index 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--
532.14.2
54