ANDROID: disable page table moves when speculative page faults are enabled
move_page_tables() can move entire pmd or pud without locking individual ptes. This is problematic for speculative page faults which do not take mmap_lock because they rely on ptl lock when writing new pte value. To avoid possible race, disable move_page_tables() optimization when CONFIG_SPECULATIVE_PAGE_FAULT is enabled. Bug: 257443051 Change-Id: Ib48dda08ecad1abc60d08fc089a6566a63393c13 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
13
mm/mremap.c
13
mm/mremap.c
@@ -219,7 +219,11 @@ static inline bool arch_supports_page_table_move(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_HAVE_MOVE_PMD
|
/*
|
||||||
|
* Speculative page fault handlers will not detect page table changes done
|
||||||
|
* without ptl locking.
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_HAVE_MOVE_PMD) && !defined(CONFIG_SPECULATIVE_PAGE_FAULT)
|
||||||
static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr,
|
static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr,
|
||||||
unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd)
|
unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd)
|
||||||
{
|
{
|
||||||
@@ -287,7 +291,12 @@ static inline bool move_normal_pmd(struct vm_area_struct *vma,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_PGTABLE_LEVELS > 2 && defined(CONFIG_HAVE_MOVE_PUD)
|
/*
|
||||||
|
* Speculative page fault handlers will not detect page table changes done
|
||||||
|
* without ptl locking.
|
||||||
|
*/
|
||||||
|
#if CONFIG_PGTABLE_LEVELS > 2 && defined(CONFIG_HAVE_MOVE_PUD) && \
|
||||||
|
!defined(CONFIG_SPECULATIVE_PAGE_FAULT)
|
||||||
static bool move_normal_pud(struct vm_area_struct *vma, unsigned long old_addr,
|
static bool move_normal_pud(struct vm_area_struct *vma, unsigned long old_addr,
|
||||||
unsigned long new_addr, pud_t *old_pud, pud_t *new_pud)
|
unsigned long new_addr, pud_t *old_pud, pud_t *new_pud)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user