]> git.itanic.dy.fi Git - linux-stable/commitdiff
arm64: mm: remove page_mapping check in __sync_icache_dcache
authorShaokun Zhang <zhangshaokun@hisilicon.com>
Tue, 21 Jun 2016 07:32:57 +0000 (15:32 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 22 Aug 2016 21:38:17 +0000 (22:38 +0100)
commit 20c27a4270c775d7ed661491af8ac03264d60fc6 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 7249b79f6b4cc ("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>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/arm64/mm/flush.c

index 0d64089d28b517c4feef39ba350284809a159159..112cf05691c0948cdf656ae33dca51956cb2a372 100644 (file)
@@ -74,10 +74,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))
-               return;
-
        if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
                __flush_dcache_area(page_address(page),
                                PAGE_SIZE << compound_order(page));