• Ryan Roberts's avatar
    arm64: mm: Permit PTE SW bits to change in live mappings · 895a3702
    Ryan Roberts authored
    Previously pgattr_change_is_safe() was overly-strict and complained
    (e.g. "[  116.262743] __check_safe_pte_update: unsafe attribute change:
    0x0560000043768fc3 -> 0x0160000043768fc3") if it saw any SW bits change
    in a live PTE. There is no such restriction on SW bits in the Arm ARM.
    
    Until now, no SW bits have been updated in live mappings via the
    set_ptes() route. PTE_DIRTY would be updated live, but this is handled
    by ptep_set_access_flags() which does not call pgattr_change_is_safe().
    However, with the introduction of uffd-wp for arm64, there is core-mm
    code that does ptep_get(); pte_clear_uffd_wp(); set_ptes(); which
    triggers this false warning.
    
    Silence this warning by masking out the SW bits during checks.
    
    The bug isn't technically in the highlighted commit below, but that's
    where bisecting would likely lead as its what made the bug user-visible.
    Signed-off-by: default avatarRyan Roberts <ryan.roberts@arm.com>
    Fixes: 5b32510a ("arm64/mm: Add uffd write-protect support")
    Link: https://lore.kernel.org/r/20240619121859.4153966-1-ryan.roberts@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    895a3702
mmu.c 40.5 KB