Patch "ARM: 8662/1: module: split core and init PLT sections" has been added to the 4.11-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ARM: 8662/1: module: split core and init PLT sections
to the 4.11-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:
arm-8662-1-module-split-core-and-init-plt-sections.patch
and it can be found in the queue-4.11 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
b7ede5a1f5905ac394cc8e61712a13e3c5cb7b8fMon Sep 17 00:00:00 2001
From: Ard Biesheuvel <[email protected]>
Date: Wed, 22 Feb 2017 19:40:12 +0100
Subject: ARM: 8662/1: module: split core and init PLT sections
From: Ard Biesheuvel <[email protected]>
commit b7ede5a1f5905ac394cc8e61712a13e3c5cb7b8f upstream.
Since commit 35fa91eed817 ("ARM: kernel: merge core and init PLTs"), the ARM module PLT code allocates all PLT entries in a single core section, since the overhead of having a separate init PLT section is not justified by the small number of PLT entries usually required for init code.
However, the core and init module regions are allocated independently, and there is a corner case where the core region may be allocated from the VMALLOC region if the dedicated module region is exhausted, but the init region, being much smaller, can still be allocated from the module region. This puts the PLT entries out of reach of the relocated branch instructions, defeating the whole purpose of PLTs.
So split the core and init PLT regions, and name the latter ".init.plt" so it gets allocated along with (and sufficiently close to) the .init sections that it serves. Also, given that init PLT entries may need to be emitted for branches that target the core module, modify the logic that disregards defined symbols to only disregard symbols that are defined in the same section.
--- arch/arm/include/asm/module.h | 9 +++- arch/arm/kernel/module-plts.c | 85 +++++++++++++++++++++++++++++------------- arch/arm/kernel/module.lds | 1 3 files changed, 67 insertions(+), 28 deletions(-)
arch/arm/include/asm/module.h +7 -2
@@ -18,13 +18,18 @@ enum { };#endif +struct mod_plt_sec { +struct elf32_shdr *plt; +int plt_count; +}; +struct mod_arch_specific {#ifdef CONFIG_ARM_UNWIND struct unwind_table *unwind[ARM_SEC_MAX ];#endif #ifdef CONFIG_ARM_MODULE_PLTS -struct elf32_shdr *plt; -int plt_count; +struct mod_plt_sec core; +struct mod_plt_sec init;#endif };
arch/arm/kernel/module-plts.c +59 -26
153 lines not on this page · raw message
arch/arm/kernel/module.lds +1 -0
@@ -1,3 +1,4 @@ SECTIONS { .plt : { BYTE(0) } + .init.plt : { BYTE(0) } }
Patches currently in stable-queue which might be from [email protected] are
queue-4.11/arm-8662-1-module-split-core-and-init-plt-sections.patch queue-4.11/arm-8667-3-fix-memory-attribute-inconsistencies-when-using-fixmap.patch