build: run constant-time tests in both test suites #1944

pull Yudis-bit wants to merge 2 commits into bitcoin-core:master from Yudis-bit:cmake-run-constant-time-tests changing 8 files +61 −11
  1. Yudis-bit commented at 10:15 AM on September 27, 2026: contributor

    Both build systems build ctime_tests without running it as part of the standard test suite. This change registers constant-time test execution in both CTest and Autotools make check.

    When MemorySanitizer is enabled, the test executes directly; under Valgrind builds, it runs under valgrind --error-exitcode=42. For Valgrind configurations, registration is cleanly omitted with a configure notice if the binary is absent or during cross-compilation. The Autotools integration employs a dedicated runner to prevent a global LOG_COMPILER from wrapping Valgrind twice, allowing the standalone CI invocation in ci/ci.sh to be retired.

    Verification covers both CMake and Autotools suites under standard, MSan, and Valgrind configurations, confirming that deliberate branching on poisoned secrets triggers test failure while clean trees pass.

    Addresses #1560.

  2. cmake: run constant-time tests with CTest 00ff182cab
  3. Yudis-bit requested review from Copilot on Sep 27, 2026
  4. Copilot commented at 10:15 AM on September 27, 2026: none

    Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

  5. hebasto commented at 3:22 PM on September 27, 2026: member

    Addresses the CMake part of #1560. Autotools integration remains separate.

    I'd prefer to modify both build systems at the same time.

  6. autotools: run constant-time tests in make check
    Run ctime_tests through a shell test with its own runner so LOG_COMPILER
    does not wrap it a second time in CI. Prefer MSan when enabled; otherwise
    use Valgrind with --error-exitcode=42 for native builds when available.
    
    Remove the separate CI invocation now that make check covers it, and
    document how to run or disable the test.
    93b2cc9e45
  7. Yudis-bit renamed this:
    cmake: run constant-time tests with CTest
    build: run constant-time tests in both test suites
    on Sep 27, 2026
  8. Yudis-bit commented at 3:54 PM on September 27, 2026: contributor

    @hebasto Added Autotools support in 93b2cc9. make check now runs the constant-time test under Valgrind, or directly for MSan builds. I also removed the separate CI invocation.

    Both test suites pass. A temporary branch on poisoned secret data makes both fail; they pass again after restoring the source.

  9. fametrano commented at 8:56 PM on October 21, 2026: contributor

    tACK 93b2cc9e45f09e78cc6327a5111e19ee9e7fd6b7. I wanted to see both test suites catch a real constant-time leak. They do, and the clean tree passes.

    On Linux aarch64 (Debian trixie, GCC 14, Valgrind 3.24), I ran the full ctest and make check suites on this branch, then again with a branch on seckey[0] added to secp256k1_ec_seckey_verify. Without the branch, both suites pass. With it, both fail on the ctime test, with two "Conditional jump or move depends on uninitialised value(s)" errors. Under make check, Valgrind runs the real binary in .libs, not the libtool wrapper, and exits with status 42. make check TESTS=ctime_tests.sh LOG_COMPILER=false passes, so a global LOG_COMPILER does not wrap the script. On master with the same branch added, both suites pass, because neither runs ctime_tests. The CMake binary from that build, run by hand under Valgrind, fails. I did not test MSan or cross-compiled builds. I can share the logs.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-23 08:15 UTC

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