build: pass hardening flags to secp256k1 #36534

pull fametrano wants to merge 1 commits into bitcoin:master from fametrano:build-secp256k1-hardening changing 2 files +27 −20
  1. fametrano commented at 7:04 AM on October 15, 2026: contributor

    The secp256k1 subtree is built without our hardening flags. They are on core_interface, and cmake/secp256k1.cmake passes the subtree only the sanitizer and APPEND_* flags, so unless the compiler enables them by default its objects miss FORTIFY, the stack protector, stack clash protection and control flow protection. On aarch64 Ubuntu 26.04 with GCC 15 this also costs the whole binary its control flow property: master's bitcoind has no AArch64 feature note, and the three secp256k1 objects are the only ones in the build tree without it.

    This PR moves the flags back to a hardening_interface library, which core_interface links; the CMakeLists.txt change is a revert of 77e553ab6a plus one comment. cmake/secp256k1.cmake then passes them to the subtree the same way as sanitize_interface. With it, the same build shows AArch64 feature: BTI, PAC, GCS on bitcoind. It does not fix #30677 on its own: the depends libraries are still built without -fcf-protection, which #30685 tried to change.

  2. build: pass hardening flags to secp256k1
    The hardening flags are added to core_interface, which the secp256k1
    subtree does not use: cmake/secp256k1.cmake passes it only the
    sanitizer and APPEND_* flags. Its objects are therefore built without
    _FORTIFY_SOURCE, -fstack-protector-all, -fstack-clash-protection,
    -fcf-protection and -mbranch-protection, unless the compiler enables
    them by default.
    
    This also drops the control flow property from the binaries. The
    linker marks an executable as BTI/PAC (aarch64) or IBT/SHSTK (x86_64)
    enabled only when every object it links has the property. On aarch64
    Ubuntu 26.04 with GCC 15, bitcoind built from master has no AArch64
    feature property, and the secp256k1 objects are the only objects in
    the build tree without it.
    
    Move the hardening flags to a hardening_interface library, which
    core_interface links, and pass its compile and link options to the
    subtree in the same way as sanitize_interface. This brings back the
    hardening_interface that was folded into core_interface in 77e553ab6a,
    now that the flags have a second user.
    09509dde1d
  3. DrahtBot added the label Build system on Oct 15, 2026
  4. DrahtBot commented at 7:05 AM on October 15, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. maflcko added the label DrahtBot Guix build requested on Oct 15, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-19 17:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me