diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2015-12-21 19:09:54 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-01-12 06:17:28 -0500 |
commit | e27d90e8be08d96b5e047cd01daf7e62c4fcab78 (patch) | |
tree | e5c6839715f611e51d82a90716f38adee52389f7 /arch/x86/include | |
parent | aa0421410fc540832f0fd267ff0f2657c3276053 (diff) |
lguest: Map switcher text R/O
Pavel noted that lguest maps the switcher code executable and
read-write. This is a bad idea for any kernel text, but
particularly for text mapped at a fixed address.
Create two vmas, one for the text (PAGE_KERNEL_RX) and another
for the stacks (PAGE_KERNEL). Use VM_NO_GUARD to map them
adjacent (as expected by the rest of the code).
Reported-by: Pavel Machek <pavel@ucw.cz>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/lguest.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/include/asm/lguest.h b/arch/x86/include/asm/lguest.h index 3bbc07a57a31..73d0c9b92087 100644 --- a/arch/x86/include/asm/lguest.h +++ b/arch/x86/include/asm/lguest.h | |||
@@ -12,7 +12,9 @@ | |||
12 | #define GUEST_PL 1 | 12 | #define GUEST_PL 1 |
13 | 13 | ||
14 | /* Page for Switcher text itself, then two pages per cpu */ | 14 | /* Page for Switcher text itself, then two pages per cpu */ |
15 | #define TOTAL_SWITCHER_PAGES (1 + 2 * nr_cpu_ids) | 15 | #define SWITCHER_TEXT_PAGES (1) |
16 | #define SWITCHER_STACK_PAGES (2 * nr_cpu_ids) | ||
17 | #define TOTAL_SWITCHER_PAGES (SWITCHER_TEXT_PAGES + SWITCHER_STACK_PAGES) | ||
16 | 18 | ||
17 | /* Where we map the Switcher, in both Host and Guest. */ | 19 | /* Where we map the Switcher, in both Host and Guest. */ |
18 | extern unsigned long switcher_addr; | 20 | extern unsigned long switcher_addr; |