From: Greg Kroah-Hartman Date: Sun, 31 Jan 2016 19:22:58 +0000 (-0800) Subject: 4.1-stable patches X-Git-Tag: v4.1.17~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33a55a85da337868c8b7befe83825e4962e3df8c;p=thirdparty%2Fkernel%2Fstable-queue.git 4.1-stable patches added patches: recordmcount-fix-endianness-handling-bug-for-nop_mcount.patch --- diff --git a/queue-4.1/arm64-mm-use-correct-mapping-granularity-under-debug_rodata.patch b/queue-4.1/arm64-mm-use-correct-mapping-granularity-under-debug_rodata.patch deleted file mode 100644 index 4174402cee0..00000000000 --- a/queue-4.1/arm64-mm-use-correct-mapping-granularity-under-debug_rodata.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 4fee9f364b9b99f76732f2a6fd6df679a237fa74 Mon Sep 17 00:00:00 2001 -From: Ard Biesheuvel -Date: Mon, 16 Nov 2015 11:18:14 +0100 -Subject: arm64: mm: use correct mapping granularity under DEBUG_RODATA - -From: Ard Biesheuvel - -commit 4fee9f364b9b99f76732f2a6fd6df679a237fa74 upstream. - -When booting a 64k pages kernel that is built with CONFIG_DEBUG_RODATA -and resides at an offset that is not a multiple of 512 MB, the rounding -that occurs in __map_memblock() and fixup_executable() results in -incorrect regions being mapped. - -The following snippet from /sys/kernel/debug/kernel_page_tables shows -how, when the kernel is loaded 2 MB above the base of DRAM at 0x40000000, -the first 2 MB of memory (which may be inaccessible from non-secure EL1 -or just reserved by the firmware) is inadvertently mapped into the end of -the module region. - - ---[ Modules start ]--- - 0xfffffdffffe00000-0xfffffe0000000000 2M RW NX ... UXN MEM/NORMAL - ---[ Modules end ]--- - ---[ Kernel Mapping ]--- - 0xfffffe0000000000-0xfffffe0000090000 576K RW NX ... UXN MEM/NORMAL - 0xfffffe0000090000-0xfffffe0000200000 1472K ro x ... UXN MEM/NORMAL - 0xfffffe0000200000-0xfffffe0000800000 6M ro x ... UXN MEM/NORMAL - 0xfffffe0000800000-0xfffffe0000810000 64K ro x ... UXN MEM/NORMAL - 0xfffffe0000810000-0xfffffe0000a00000 1984K RW NX ... UXN MEM/NORMAL - 0xfffffe0000a00000-0xfffffe00ffe00000 4084M RW NX ... UXN MEM/NORMAL - -The same issue is likely to occur on 16k pages kernels whose load -address is not a multiple of 32 MB (i.e., SECTION_SIZE). So round to -SWAPPER_BLOCK_SIZE instead of SECTION_SIZE. - -Fixes: da141706aea5 ("arm64: add better page protections to arm64") -Signed-off-by: Ard Biesheuvel -Acked-by: Mark Rutland -Acked-by: Laura Abbott -Signed-off-by: Catalin Marinas -Signed-off-by: Greg Kroah-Hartman - ---- - arch/arm64/mm/mmu.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/arch/arm64/mm/mmu.c -+++ b/arch/arm64/mm/mmu.c -@@ -307,8 +307,8 @@ static void __init __map_memblock(phys_a - * for now. This will get more fine grained later once all memory - * is mapped - */ -- unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE); -- unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); -+ unsigned long kernel_x_start = round_down(__pa(_stext), SWAPPER_BLOCK_SIZE); -+ unsigned long kernel_x_end = round_up(__pa(__init_end), SWAPPER_BLOCK_SIZE); - - if (end < kernel_x_start) { - create_mapping(start, __phys_to_virt(start), -@@ -396,18 +396,18 @@ void __init fixup_executable(void) - { - #ifdef CONFIG_DEBUG_RODATA - /* now that we are actually fully mapped, make the start/end more fine grained */ -- if (!IS_ALIGNED((unsigned long)_stext, SECTION_SIZE)) { -+ if (!IS_ALIGNED((unsigned long)_stext, SWAPPER_BLOCK_SIZE)) { - unsigned long aligned_start = round_down(__pa(_stext), -- SECTION_SIZE); -+ SWAPPER_BLOCK_SIZE); - - create_mapping(aligned_start, __phys_to_virt(aligned_start), - __pa(_stext) - aligned_start, - PAGE_KERNEL); - } - -- if (!IS_ALIGNED((unsigned long)__init_end, SECTION_SIZE)) { -+ if (!IS_ALIGNED((unsigned long)__init_end, SWAPPER_BLOCK_SIZE)) { - unsigned long aligned_end = round_up(__pa(__init_end), -- SECTION_SIZE); -+ SWAPPER_BLOCK_SIZE); - create_mapping(__pa(__init_end), (unsigned long)__init_end, - aligned_end - __pa(__init_end), - PAGE_KERNEL); diff --git a/queue-4.1/recordmcount-fix-endianness-handling-bug-for-nop_mcount.patch b/queue-4.1/recordmcount-fix-endianness-handling-bug-for-nop_mcount.patch new file mode 100644 index 00000000000..cb03ae0ce91 --- /dev/null +++ b/queue-4.1/recordmcount-fix-endianness-handling-bug-for-nop_mcount.patch @@ -0,0 +1,34 @@ +From c84da8b9ad3761eef43811181c7e896e9834b26b Mon Sep 17 00:00:00 2001 +From: libin +Date: Tue, 3 Nov 2015 08:58:47 +0800 +Subject: recordmcount: Fix endianness handling bug for nop_mcount + +From: libin + +commit c84da8b9ad3761eef43811181c7e896e9834b26b upstream. + +In nop_mcount, shdr->sh_offset and welp->r_offset should handle +endianness properly, otherwise it will trigger Segmentation fault +if the recordmcount main and file.o have different endianness. + +Link: http://lkml.kernel.org/r/563806C7.7070606@huawei.com + +Signed-off-by: Li Bin +Signed-off-by: Steven Rostedt +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/recordmcount.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/scripts/recordmcount.h ++++ b/scripts/recordmcount.h +@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *c + + if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { + if (make_nop) +- ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset); ++ ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset)); + if (warn_on_notrace_sect && !once) { + printf("Section %s has mcount callers being ignored\n", + txtname); diff --git a/queue-4.1/series b/queue-4.1/series index 6a4c97a65f6..40f73cb8611 100644 --- a/queue-4.1/series +++ b/queue-4.1/series @@ -108,7 +108,6 @@ powerpc-module-handle-r_ppc64_entry-relocations.patch recordmcount-arm64-replace-the-ignored-mcount-call-into-nop.patch arm64-bpf-fix-div-by-zero-case.patch arm64-bpf-fix-mod-by-zero-case.patch -arm64-mm-use-correct-mapping-granularity-under-debug_rodata.patch arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch arm-arm64-kvm-test-properly-for-a-pte-s-uncachedness.patch arm64-kvm-fix-aarch32-to-aarch64-register-mapping.patch @@ -125,3 +124,4 @@ direct-io-fix-negative-return-from-dio-read-beyond-eof.patch fix-the-regression-from-direct-io-fix-negative-return-from-dio-read-beyond-eof.patch mn10300-select-config_have_uid16-to-fix-build-failure.patch arm64-restore-bogomips-information-in-proc-cpuinfo.patch +recordmcount-fix-endianness-handling-bug-for-nop_mcount.patch