fuzz/fuzz-hsm_encryption: don't run as unit test under valgrind.
What changed, and why it matters
This commit changes a fuzz test so it exits early when run under the Valgrind memory-checking tool. The reason is that the test uses Argon password hashing, which is extremely slow under Valgrind and was causing CI timeouts. It is a test-infrastructure/performance fix, not a security fix.
No security action required. Treat as a normal CI/test performance improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds an early-exit path in tests/fuzz/fuzz-hsm_encryption.c’s init(). If the code is not built in fuzzing mode and the environment variable VALGRIND=1 is set, the test calls common_shutdown() and exits with status 0. This prevents the Argon2-based HSM encryption test from running as a unit test under Valgrind, avoiding intolerable slowdown and CI timeouts. There is no change to production code, cryptographic logic, or memory-safety behavior.
Changed components
tests/fuzz/fuzz-hsm_encryption.cInspect captured patch +9 / −0
diff --git a/tests/fuzz/fuzz-hsm_encryption.c b/tests/fuzz/fuzz-hsm_encryption.c
index 168fc254..39f92fa7 100644
--- a/tests/fuzz/fuzz-hsm_encryption.c
+++ b/tests/fuzz/fuzz-hsm_encryption.c
@@ -3,10 +3,19 @@
#include <ccan/mem/mem.h>
#include <common/hsm_encryption.h>
+#include <common/setup.h>
+#include <stdlib.h>
#include <tests/fuzz/libfuzz.h>
void init(int *argc, char ***argv)
{
+ /* Don't run as a unit test under valgrind: too slow! */
+#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+ if (getenv("VALGRIND") && strcmp(getenv("VALGRIND"), "1") == 0) {
+ common_shutdown();
+ exit(0);
+ }
+#endif
}
void run(const uint8_t *data, size_t size)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.