Repository navigation
Fix SIGABRT crash in test suite by catching unhandled std::runtime_error in threads - #28
Conversation
Signed-off-by: AKG451 <akg451154@gmail.com>
37cf972 to
6c4c11e
Compare
|
Just to add some context on why the exceptions were being thrown: The standard test message in test_sig.cpp is I can either leave this PR as purely a stability fix (catching the exception), or I can push one more commit to bump the test message length to 64 bytes so the |
The ML-DSA-*-extmu variants sign an externally computed mu, which must be exactly 64 bytes, so signing the 37-byte test message failed and threw. Use a random 64-byte message for those variants, as liboqs's own test_sig does. Replace the per-helper try/catch blocks with a single guard around the functions run in std::threads, so that any exception is reported as a test failure instead of calling std::terminate() and aborting the run. With the abort gone, SNOVA overflowed the 512KB stack of a secondary thread on macOS, so add it to no_thread_sig_patterns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
|
Thanks for tracking this down, and for finding the extmu message-length check. I've pushed a commit that extends your patch a bit:
I also ran clang-format and restored the trailing newline. All 8 unit tests pass locally against liboqs |
|
Thank You @dstebila for the review and commit. |
When building
liboqs-cppagainstliboqs:main(0.16.0), the test suite completely crashes with aSIGABRT(core dumped) during theoqs_Signaturetests, halting the entire test runner.Root Cause:
Certain algorithms (specifically the new
ML-DSA-*-extmuvariants) are failing their signing operations and throwing astd::runtime_error("Can not sign message"). Becausetest_sig.cppruns these tests concurrently insidestd::thread, this unhandled exception immediately triggersstd::terminate(), blowing up the GoogleTest process and preventing developers from seeing the rest of the test results.The Fix:
I have wrapped the core cryptographic operations inside
test_sig_correctness,test_sig_correctness_with_ctx_str,test_sig_wrong_signature, andtest_sig_wrong_public_keyintry/catchblocks.If an algorithm throws an exception during testing, it is now gracefully caught and piped to
FAIL(). The test suite now safely completes its run and cleanly reports exactly which algorithms failed without crashing the OS process.