lkml.org 
[lkml]   [2017]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 16/23] x86, kaiser: map debug IDT tables
From
Date

The IDT table it references are another structure where the
CPU references a virtual address. It also obviously needs these
to handle an interrupt in userspace, so these need to be mapped into
the user copy of the page tables.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Moritz Lipp <moritz.lipp@iaik.tugraz.at>
Cc: Daniel Gruss <daniel.gruss@iaik.tugraz.at>
Cc: Michael Schwarz <michael.schwarz@iaik.tugraz.at>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Kees Cook <keescook@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: x86@kernel.org
---

b/arch/x86/mm/kaiser.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff -puN arch/x86/mm/kaiser.c~kaiser-user-map-trace-and-debug-idt arch/x86/mm/kaiser.c
--- a/arch/x86/mm/kaiser.c~kaiser-user-map-trace-and-debug-idt 2017-10-31 15:03:57.365444956 -0700
+++ b/arch/x86/mm/kaiser.c 2017-10-31 15:03:57.368445098 -0700
@@ -250,6 +250,14 @@ int kaiser_add_user_map_ptrs(const void
flags);
}

+static int kaiser_user_map_ptr_early(const void *start_addr, unsigned long size,
+ unsigned long flags)
+{
+ int ret = kaiser_add_user_map(start_addr, size, flags);
+ WARN_ON(ret);
+ return ret;
+}
+
/*
* Ensure that the top level of the (shadow) page tables are
* entirely populated. This ensures that all processes that get
@@ -331,6 +339,10 @@ void __init kaiser_init(void)
sizeof(gate_desc) * NR_VECTORS,
__PAGE_KERNEL_RO);

+ kaiser_user_map_ptr_early(&debug_idt_table,
+ sizeof(gate_desc) * NR_VECTORS,
+ __PAGE_KERNEL);
+
/*
* We could theoretically do this in setup_fixmap_gdt().
* But, we would need to rewrite the above page table
_
\
 
 \ /
  Last update: 2017-10-31 23:35    [W:0.233 / U:0.032 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site