diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2020-04-21 12:20:28 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2020-04-24 16:55:50 +0300 |
commit | 8c5cc19e94703182647dfccc164e4437a04539c8 (patch) | |
tree | c244e843d16a250eb8ee2b59f6bcc61cc4875a47 /arch/x86/include | |
parent | 325518e9b743686f471e7a4ef617b57c91386795 (diff) | |
download | linux-8c5cc19e94703182647dfccc164e4437a04539c8.tar.xz |
x86/tlb: Uninline __get_current_cr3_fast()
cpu_tlbstate is exported because various TLB-related functions need
access to it, but cpu_tlbstate is sensitive information which should
only be accessed by well-contained kernel functions and not be directly
exposed to modules.
In preparation for unexporting cpu_tlbstate move __get_current_cr3_fast()
into the x86 TLB management code.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200421092558.848064318@linutronix.de
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/mmu_context.h | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 4e55370e48e8..9608536b9c85 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -225,24 +225,7 @@ static inline bool arch_vma_access_permitted(struct vm_area_struct *vma, return __pkru_allows_pkey(vma_pkey(vma), write); } -/* - * This can be used from process context to figure out what the value of - * CR3 is without needing to do a (slow) __read_cr3(). - * - * It's intended to be used for code like KVM that sneakily changes CR3 - * and needs to restore it. It needs to be used very carefully. - */ -static inline unsigned long __get_current_cr3_fast(void) -{ - unsigned long cr3 = build_cr3(this_cpu_read(cpu_tlbstate.loaded_mm)->pgd, - this_cpu_read(cpu_tlbstate.loaded_mm_asid)); - - /* For now, be very restrictive about when this can be called. */ - VM_WARN_ON(in_nmi() || preemptible()); - - VM_BUG_ON(cr3 != __read_cr3()); - return cr3; -} +unsigned long __get_current_cr3_fast(void); typedef struct { struct mm_struct *mm; |