Commit ed73df0b authored by Ben Hutchings's avatar Ben Hutchings Committed by Greg Kroah-Hartman

vsyscall: Fix permissions for emulate mode with KAISER/PTI

The backport of KAISER to 4.4 turned vsyscall emulate mode into native
mode.  Add a vsyscall_pgprot variable to hold the correct page
protections, like Borislav and Hugh did for 3.2 and 3.18.

Cc: Borislav Petkov <bp@suse.de>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e1e457a4
...@@ -46,6 +46,7 @@ static enum { EMULATE, NATIVE, NONE } vsyscall_mode = ...@@ -46,6 +46,7 @@ static enum { EMULATE, NATIVE, NONE } vsyscall_mode =
#else #else
EMULATE; EMULATE;
#endif #endif
unsigned long vsyscall_pgprot = __PAGE_KERNEL_VSYSCALL;
static int __init vsyscall_setup(char *str) static int __init vsyscall_setup(char *str)
{ {
...@@ -336,11 +337,11 @@ void __init map_vsyscall(void) ...@@ -336,11 +337,11 @@ void __init map_vsyscall(void)
extern char __vsyscall_page; extern char __vsyscall_page;
unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page); unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page);
if (vsyscall_mode != NATIVE)
vsyscall_pgprot = __PAGE_KERNEL_VVAR;
if (vsyscall_mode != NONE) if (vsyscall_mode != NONE)
__set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall, __set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall,
vsyscall_mode == NATIVE __pgprot(vsyscall_pgprot));
? PAGE_KERNEL_VSYSCALL
: PAGE_KERNEL_VVAR);
BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) != BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) !=
(unsigned long)VSYSCALL_ADDR); (unsigned long)VSYSCALL_ADDR);
......
...@@ -13,6 +13,7 @@ extern void map_vsyscall(void); ...@@ -13,6 +13,7 @@ extern void map_vsyscall(void);
*/ */
extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address); extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
extern bool vsyscall_enabled(void); extern bool vsyscall_enabled(void);
extern unsigned long vsyscall_pgprot;
#else #else
static inline void map_vsyscall(void) {} static inline void map_vsyscall(void) {}
static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
......
...@@ -345,7 +345,7 @@ void __init kaiser_init(void) ...@@ -345,7 +345,7 @@ void __init kaiser_init(void)
if (vsyscall_enabled()) if (vsyscall_enabled())
kaiser_add_user_map_early((void *)VSYSCALL_ADDR, kaiser_add_user_map_early((void *)VSYSCALL_ADDR,
PAGE_SIZE, PAGE_SIZE,
__PAGE_KERNEL_VSYSCALL); vsyscall_pgprot);
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
void *percpu_vaddr = __per_cpu_user_mapped_start + void *percpu_vaddr = __per_cpu_user_mapped_start +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment