]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.5/arm64-mm-remove-page_mapping-check-in-__sync_icache_dcache.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / arm64-mm-remove-page_mapping-check-in-__sync_icache_dcache.patch
1 From 20c27a4270c775d7ed661491af8ac03264d60fc6 Mon Sep 17 00:00:00 2001
2 From: Shaokun Zhang <zhangshaokun@hisilicon.com>
3 Date: Tue, 21 Jun 2016 15:32:57 +0800
4 Subject: arm64: mm: remove page_mapping check in __sync_icache_dcache
5
6 From: Shaokun Zhang <zhangshaokun@hisilicon.com>
7
8 commit 20c27a4270c775d7ed661491af8ac03264d60fc6 upstream.
9
10 __sync_icache_dcache unconditionally skips the cache maintenance for
11 anonymous pages, under the assumption that flushing is only required in
12 the presence of D-side aliases [see 7249b79f6b4cc ("arm64: Do not flush
13 the D-cache for anonymous pages")].
14
15 Unfortunately, this breaks migration of anonymous pages holding
16 self-modifying code, where userspace cannot be reasonably expected to
17 reissue maintenance instructions in response to a migration.
18
19 This patch fixes the problem by removing the broken page_mapping(page)
20 check from the cache syncing code, otherwise we may end up fetching and
21 executing stale instructions from the PoU.
22
23 Cc: Catalin Marinas <catalin.marinas@arm.com>
24 Cc: Will Deacon <will.deacon@arm.com>
25 Cc: Mark Rutland <mark.rutland@arm.com>
26 Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
27 Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
28 Signed-off-by: Will Deacon <will.deacon@arm.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 arch/arm64/mm/flush.c | 4 ----
33 1 file changed, 4 deletions(-)
34
35 --- a/arch/arm64/mm/flush.c
36 +++ b/arch/arm64/mm/flush.c
37 @@ -71,10 +71,6 @@ void __sync_icache_dcache(pte_t pte, uns
38 {
39 struct page *page = pte_page(pte);
40
41 - /* no flushing needed for anonymous pages */
42 - if (!page_mapping(page))
43 - return;
44 -
45 if (!test_and_set_bit(PG_dcache_clean, &page->flags))
46 sync_icache_aliases(page_address(page),
47 PAGE_SIZE << compound_order(page));