• Jessica Yu's avatar
    arm64/module: set trampoline section flags regardless of CONFIG_DYNAMIC_FTRACE · e0328fed
    Jessica Yu authored
    In the arm64 module linker script, the section .text.ftrace_trampoline
    is specified unconditionally regardless of whether CONFIG_DYNAMIC_FTRACE
    is enabled (this is simply due to the limitation that module linker
    scripts are not preprocessed like the vmlinux one).
    
    Normally, for .plt and .text.ftrace_trampoline, the section flags
    present in the module binary wouldn't matter since module_frob_arch_sections()
    would assign them manually anyway. However, the arm64 module loader only
    sets the section flags for .text.ftrace_trampoline when CONFIG_DYNAMIC_FTRACE=y.
    That's only become problematic recently due to a recent change in
    binutils-2.35, where the .text.ftrace_trampoline section (along with the
    .plt section) is now marked writable and executable (WAX).
    
    We no longer allow writable and executable sections to be loaded due to
    commit 5c3a7db0 ("module: Harden STRICT_MODULE_RWX"), so this is
    causing all modules linked with binut...
    e0328fed
module-plts.c 10.7 KB