powerpc/pkeys: Avoid using lockless page table walk
Fetch pkey from vma instead of linux page table. Also document the fact that in some cases the pkey returned in siginfo won't be the same as the one we took keyfault on. Even with linux page table walk, we can end up in a similar scenario. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200505071729.54912-2-aneesh.kumar@linux.ibm.com
This commit is contained in:
committed by
Michael Ellerman
parent
93a98695f2
commit
fe4a6856cb
@ -1671,30 +1671,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
|
||||
hash_preload(vma->vm_mm, address, is_exec, trap);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PPC_MEM_KEYS
|
||||
/*
|
||||
* Return the protection key associated with the given address and the
|
||||
* mm_struct.
|
||||
*/
|
||||
u16 get_mm_addr_key(struct mm_struct *mm, unsigned long address)
|
||||
{
|
||||
pte_t *ptep;
|
||||
u16 pkey = 0;
|
||||
unsigned long flags;
|
||||
|
||||
if (!mm || !mm->pgd)
|
||||
return 0;
|
||||
|
||||
local_irq_save(flags);
|
||||
ptep = find_linux_pte(mm->pgd, address, NULL, NULL);
|
||||
if (ptep)
|
||||
pkey = pte_to_pkey_bits(pte_val(READ_ONCE(*ptep)));
|
||||
local_irq_restore(flags);
|
||||
|
||||
return pkey;
|
||||
}
|
||||
#endif /* CONFIG_PPC_MEM_KEYS */
|
||||
|
||||
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
|
||||
static inline void tm_flush_hash_page(int local)
|
||||
{
|
||||
|
Reference in New Issue
Block a user