path: root/scripts/
AgeCommit message (Collapse)Author
2021-04-08module: ensure __cfi_check alignmentSami Tolvanen
CONFIG_CFI_CLANG_SHADOW assumes the __cfi_check() function is page aligned and at the beginning of the .text section. While Clang would normally align the function correctly, it fails to do so for modules with no executable code. This change ensures the correct __cfi_check() location and alignment. It also discards the .eh_frame section, which Clang can generate with certain sanitizers, such as CFI. Link: Signed-off-by: Sami Tolvanen <> Reviewed-by: Kees Cook <> Acked-by: Jessica Yu <> Tested-by: Nathan Chancellor <> Signed-off-by: Kees Cook <> Link:
2021-04-01kbuild: lto: Merge module sections if and only if CONFIG_LTO_CLANG is enabledSean Christopherson
Merge module sections only when using Clang LTO. With ld.bfd, merging sections does not appear to update the symbol tables for the module, e.g. 'readelf -s' shows the value that a symbol would have had, if sections were not merged. ld.lld does not show this problem. The stale symbol table breaks gdb's function disassembler, and presumably other things, e.g. gdb -batch -ex "file arch/x86/kvm/kvm.ko" -ex "disassemble kvm_init" reads the wrong bytes and dumps garbage. Fixes: dd2776222abb ("kbuild: lto: merge module sections") Cc: Nick Desaulniers <> Signed-off-by: Sean Christopherson <> Reviewed-by: Sami Tolvanen <> Tested-by: Sami Tolvanen <> Signed-off-by: Kees Cook <> Link:
2021-02-23Merge tag 'modules-for-v5.12' of ↵Linus Torvalds
git:// Pull module updates from Jessica Yu: - Retire EXPORT_UNUSED_SYMBOL() and EXPORT_SYMBOL_GPL_FUTURE(). These export types were introduced between 2006 - 2008. All the of the unused symbols have been long removed and gpl future symbols were converted to gpl quite a long time ago, and I don't believe these export types have been used ever since. So, I think it should be safe to retire those export types now (Christoph Hellwig) - Refactor and clean up some aged code cruft in the module loader (Christoph Hellwig) - Build {,module_}kallsyms_on_each_symbol only when livepatching is enabled, as it is the only caller (Christoph Hellwig) - Unexport find_module() and module_mutex and fix the last module callers to not rely on these anymore. Make module_mutex internal to the module loader (Christoph Hellwig) - Harden ELF checks on module load and validate ELF structures before checking the module signature (Frank van der Linden) - Fix undefined symbol warning for clang (Fangrui Song) - Fix smatch warning (Dan Carpenter) * tag 'modules-for-v5.12' of git:// module: potential uninitialized return in module_kallsyms_on_each_symbol() module: remove EXPORT_UNUSED_SYMBOL* module: remove EXPORT_SYMBOL_GPL_FUTURE module: move struct symsearch to module.c module: pass struct find_symbol_args to find_symbol module: merge each_symbol_section into find_symbol module: remove each_symbol_in_section module: mark module_mutex static kallsyms: only build {,module_}kallsyms_on_each_symbol when required kallsyms: refactor {,module_}kallsyms_on_each_symbol module: use RCU to synchronize find_module module: unexport find_module and module_mutex drm: remove drm_fb_helper_modinit powerpc/powernv: remove get_cxl_module module: harden ELF info handling module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols
2021-02-08module: remove EXPORT_UNUSED_SYMBOL*Christoph Hellwig
EXPORT_UNUSED_SYMBOL* is not actually used anywhere. Remove the unused functionality as we generally just remove unused code anyway. Reviewed-by: Miroslav Benes <> Reviewed-by: Emil Velikov <> Signed-off-by: Christoph Hellwig <> Signed-off-by: Jessica Yu <>
2021-02-08module: remove EXPORT_SYMBOL_GPL_FUTUREChristoph Hellwig
As far as I can tell this has never been used at all, and certainly not any time recently. Reviewed-by: Miroslav Benes <> Reviewed-by: Emil Velikov <> Signed-off-by: Christoph Hellwig <> Signed-off-by: Jessica Yu <>
2021-01-14kbuild: lto: merge module sectionsSami Tolvanen
LLD always splits sections with LTO, which increases module sizes. This change adds linker script rules to merge the split sections in the final module. Suggested-by: Nick Desaulniers <> Signed-off-by: Sami Tolvanen <> Reviewed-by: Kees Cook <> Signed-off-by: Kees Cook <> Link:
2020-09-25kbuild: preprocess module linker scriptMasahiro Yamada
There was a request to preprocess the module linker script like we do for the vmlinux one. ( The difference between and is that the latter is needed for external module builds, thus must be cleaned up by 'make mrproper' instead of 'make clean'. Also, it must be created by 'make modules_prepare'. You cannot put it in arch/$(SRCARCH)/kernel/, which is cleaned up by 'make clean'. I moved arch/$(SRCARCH)/kernel/ to arch/$(SRCARCH)/include/asm/, which is included from scripts/ scripts/ is fine because 'make clean' keeps all the build artifacts under scripts/. You can add arch-specific sections in <asm/>. Signed-off-by: Masahiro Yamada <> Tested-by: Jessica Yu <> Acked-by: Will Deacon <> Acked-by: Geert Uytterhoeven <> Acked-by: Palmer Dabbelt <> Reviewed-by: Kees Cook <> Acked-by: Jessica Yu <>