Skip to content

Commit 643d95a

Browse files
sean-jcbonzini
authored andcommitted
Revert "x86/mm: Introduce lookup_address_in_mm()"
Drop lookup_address_in_mm() now that KVM is providing it's own variant of lookup_address_in_pgd() that is safe for use with user addresses, e.g. guards against page tables being torn down. A variant that provides a non-init mm is inherently dangerous and flawed, as the only reason to use an mm other than init_mm is to walk a userspace mapping, and lookup_address_in_pgd() does not play nice with userspace mappings, e.g. doesn't disable IRQs to block TLB shootdowns and doesn't use READ_ONCE() to ensure an upper level entry isn't converted to a huge page between checking the PAGE_SIZE bit and grabbing the address of the next level down. This reverts commit 13c72c0. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <YmwIi3bXr/1yhYV/@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 73331c5 commit 643d95a

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

arch/x86/include/asm/pgtable_types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,6 @@ static inline void update_page_count(int level, unsigned long pages) { }
559559
extern pte_t *lookup_address(unsigned long address, unsigned int *level);
560560
extern pte_t *lookup_address_in_pgd(pgd_t *pgd, unsigned long address,
561561
unsigned int *level);
562-
563-
struct mm_struct;
564-
extern pte_t *lookup_address_in_mm(struct mm_struct *mm, unsigned long address,
565-
unsigned int *level);
566562
extern pmd_t *lookup_pmd_address(unsigned long address);
567563
extern phys_addr_t slow_virt_to_phys(void *__address);
568564
extern int __init kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn,

arch/x86/mm/pat/set_memory.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -638,17 +638,6 @@ pte_t *lookup_address(unsigned long address, unsigned int *level)
638638
}
639639
EXPORT_SYMBOL_GPL(lookup_address);
640640

641-
/*
642-
* Lookup the page table entry for a virtual address in a given mm. Return a
643-
* pointer to the entry and the level of the mapping.
644-
*/
645-
pte_t *lookup_address_in_mm(struct mm_struct *mm, unsigned long address,
646-
unsigned int *level)
647-
{
648-
return lookup_address_in_pgd(pgd_offset(mm, address), address, level);
649-
}
650-
EXPORT_SYMBOL_GPL(lookup_address_in_mm);
651-
652641
static pte_t *_lookup_address_cpa(struct cpa_data *cpa, unsigned long address,
653642
unsigned int *level)
654643
{

0 commit comments

Comments
 (0)