Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • scripts
  • Makefile.vmlinux
Find file BlameHistoryPermalink
  • Sami Tolvanen's avatar
    kbuild: Fix CFI hash randomization with KASAN · 42633ed8
    Sami Tolvanen authored Jan 12, 2023
    Clang emits a asan.module_ctor constructor to each object file
    when KASAN is enabled, and these functions are indirectly called
    in do_ctors. With CONFIG_CFI_CLANG, the compiler also emits a CFI
    type hash before each address-taken global function so they can
    pass indirect call checks.
    
    However, in commit 0c3e806e ("x86/cfi: Add boot time hash
    randomization"), x86 implemented boot time hash randomization,
    which relies on the .cfi_sites section generated by objtool. As
    objtool is run against vmlinux.o instead of individual object
    files with X86_KERNEL_IBT (enabled by default), CFI types in
    object files that are not part of vmlinux.o end up not being
    included in .cfi_sites, and thus won't get randomized and trip
    CFI when called.
    
    Only .vmlinux.export.o and init/version-timestamp.o are linked
    into vmlinux separately from vmlinux.o. As these files don't
    contain any functions, disable KASAN for both of them to avoid
    breaking hash randomization.
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/1742
    Fixes: 0c3e806e
    
     ("x86/cfi: Add boot time hash randomization")
    Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
    Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/20230112224948.1479453-2-samitolvanen@google.com
    42633ed8
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7