Skip to contentSkip to conversation

Patch "arm64: mm: remove page_mapping check in __sync_icache_dcache" has been added to the 4.6-stable tree

PATCH [email protected] 1 participant 1 message Jul 24, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

arm64: mm: remove page_mapping check in __sync_icache_dcache

to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arm64-mm-remove-page_mapping-check-in-__sync_icache_dcache.patch
and it can be found in the queue-4.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 20c27a4270c775d7ed661491af8ac03264d60fc6 Mon Sep 17 00:00:00 2001

From: Shaokun Zhang <[email protected]>
Date: Tue, 21 Jun 2016 15:32:57 +0800
Subject: arm64: mm: remove page_mapping check in __sync_icache_dcache

From: Shaokun Zhang <[email protected]>

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.

---
 arch/arm64/mm/flush.c |    4 ----
 1 file changed, 4 deletions(-)
arch/arm64/mm/flush.c +0 -4
@@ -71,10 +71,6 @@ void __sync_icache_dcache(pte_t pte, uns
 {
 	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))
 		sync_icache_aliases(page_address(page),
 				    PAGE_SIZE << compound_order(page));

Patches currently in stable-queue which might be from [email protected] are

queue-4.6/arm64-mm-remove-page_mapping-check-in-__sync_icache_dcache.patch