From: Greg Kroah-Hartman Date: Wed, 8 Jun 2016 01:08:29 +0000 (-0700) Subject: 4.6-stable patches X-Git-Tag: v4.4.13~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e24d4c097ef23fa82caba823e9b206b12968391f;p=thirdparty%2Fkernel%2Fstable-queue.git 4.6-stable patches added patches: mips-flush-highmem-pages-in-__flush_dcache_page.patch --- diff --git a/queue-4.6/mips-flush-highmem-pages-in-__flush_dcache_page.patch b/queue-4.6/mips-flush-highmem-pages-in-__flush_dcache_page.patch new file mode 100644 index 00000000000..c244dde050d --- /dev/null +++ b/queue-4.6/mips-flush-highmem-pages-in-__flush_dcache_page.patch @@ -0,0 +1,71 @@ +From 234859e49a15323cf1b2331bdde7f658c4cb45fb Mon Sep 17 00:00:00 2001 +From: Paul Burton +Date: Tue, 1 Mar 2016 02:37:57 +0000 +Subject: MIPS: Flush highmem pages in __flush_dcache_page + +From: Paul Burton + +commit 234859e49a15323cf1b2331bdde7f658c4cb45fb upstream. + +When flush_dcache_page is called on an executable page, that page is +about to be provided to userland & we can presume that the icache +contains no valid entries for its address range. However if the icache +does not fill from the dcache then we cannot presume that the pages +content has been written back as far as the memories that the dcache +will fill from (ie. L2 or further out). + +This was being done for lowmem pages, but not for highmem which can lead +to icache corruption. Fix this by mapping highmem pages & flushing their +content from the dcache in __flush_dcache_page before providing the page +to userland, just as is done for lowmem pages. + +Signed-off-by: Paul Burton +Cc: Lars Persson +Cc: Andrew Morton +Cc: Kirill A. Shutemov +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Patchwork: https://patchwork.linux-mips.org/patch/12720/ +Signed-off-by: Ralf Baechle +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/mm/cache.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/arch/mips/mm/cache.c ++++ b/arch/mips/mm/cache.c +@@ -16,6 +16,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -83,8 +84,6 @@ void __flush_dcache_page(struct page *pa + struct address_space *mapping = page_mapping(page); + unsigned long addr; + +- if (PageHighMem(page)) +- return; + if (mapping && !mapping_mapped(mapping)) { + SetPageDcacheDirty(page); + return; +@@ -95,8 +94,15 @@ void __flush_dcache_page(struct page *pa + * case is for exec env/arg pages and those are %99 certainly going to + * get faulted into the tlb (and thus flushed) anyways. + */ +- addr = (unsigned long) page_address(page); ++ if (PageHighMem(page)) ++ addr = (unsigned long)kmap_atomic(page); ++ else ++ addr = (unsigned long)page_address(page); ++ + flush_data_cache_page(addr); ++ ++ if (PageHighMem(page)) ++ __kunmap_atomic((void *)addr); + } + + EXPORT_SYMBOL(__flush_dcache_page); diff --git a/queue-4.6/mips-handle-highmem-pages-in-__update_cache.patch b/queue-4.6/mips-handle-highmem-pages-in-__update_cache.patch index a6e8007926d..dee4347cb1c 100644 --- a/queue-4.6/mips-handle-highmem-pages-in-__update_cache.patch +++ b/queue-4.6/mips-handle-highmem-pages-in-__update_cache.patch @@ -30,7 +30,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c -@@ -143,9 +143,17 @@ void __update_cache(struct vm_area_struc +@@ -149,9 +149,17 @@ void __update_cache(struct vm_area_struc return; page = pfn_to_page(pfn); if (page_mapping(page) && Page_dcache_dirty(page)) { diff --git a/queue-4.6/mips-sync-icache-dcache-in-set_pte_at.patch b/queue-4.6/mips-sync-icache-dcache-in-set_pte_at.patch index 2596c485cc0..04d062ea8a0 100644 --- a/queue-4.6/mips-sync-icache-dcache-in-set_pte_at.patch +++ b/queue-4.6/mips-sync-icache-dcache-in-set_pte_at.patch @@ -200,7 +200,7 @@ Signed-off-by: Greg Kroah-Hartman static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c -@@ -119,30 +119,17 @@ void __flush_anon_page(struct page *page +@@ -125,30 +125,17 @@ void __flush_anon_page(struct page *page EXPORT_SYMBOL(__flush_anon_page); diff --git a/queue-4.6/series b/queue-4.6/series index 899d5ef97d6..f9f4ae64d77 100644 --- a/queue-4.6/series +++ b/queue-4.6/series @@ -7,6 +7,7 @@ mips-avoid-using-unwind_stack-with-usermode.patch mips-fix-siginfo.h-to-use-strict-posix-types.patch mips-fix-uapi-include-in-exported-asm-siginfo.h.patch mips-fix-watchpoint-restoration.patch +mips-flush-highmem-pages-in-__flush_dcache_page.patch mips-handle-highmem-pages-in-__update_cache.patch mips-sync-icache-dcache-in-set_pte_at.patch mips-loongson-3-fix-build-error-after-ld-version.sh-modification.patch