Commit 029b5be5 authored by Shaokun Zhang's avatar Shaokun Zhang Committed by Greg Kroah-Hartman

arm64: mm: remove page_mapping check in __sync_icache_dcache

commit 20c27a42 upstream.

__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 <>
Cc: Will Deacon <>
Cc: Mark Rutland <>
Cc: <>
Reviewed-by: default avatarCatalin Marinas <>
Signed-off-by: default avatarShaokun Zhang <>
Signed-off-by: default avatarWill Deacon <>
Signed-off-by: default avatarSasha Levin <>
Cc: Amanieu d'Antras <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 1b284d78
......@@ -70,10 +70,6 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr)
struct page *page = pte_page(pte);
/* no flushing needed for anonymous pages */
if (!page_mapping(page))
if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
PAGE_SIZE << compound_order(page));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment