• Shaokun Zhang's avatar
    arm64: mm: remove page_mapping check in __sync_icache_dcache · 20c27a42
    Shaokun Zhang authored
    __sync_icache_dcache unconditionally skips the cache maintenance for
    anonymous pages, under the assumption that flushing is only required in
    the presence of D-side aliases [see 7249b79f ("arm64: Do not flush
    the D-cache for anonymous pages")].
    
    Unfortunately, this breaks migration of anonymous pages holding
    self-modifying code, where userspace cannot be reasonably expected to
    reissue maintenance instructions in response to a migration.
    
    This patch fixes the problem by removing the broken page_mapping(page)
    check from the cache syncing code, otherwise we may end up fetching and
    executing stale instructions from the PoU.
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: <stable@vger.kernel.org>
    Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: default avatarShaokun Zhang <zhangshaokun@hisilicon.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    20c27a42
flush.c 2.58 KB