From 4df63e0aaad565359cd1729ae09c7851a7db4479 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Sun, 10 Aug 2025 02:00:25 +0200 Subject: [PATCH] test/sanitytest.c: fix setitimer usage in timer disarmament MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It is incorrect to call setitimer(which, NULL, NULL) to disarm a timer, Linux just gives a pass on that; properly provide a zeroed-out structure instead. Fixes: 760929f6ba18 "crypto/sleep.c: avoid returning early due to signal" Reported-by: Neil Horman Signed-off-by: Eugene Syromiatnikov Reviewed-by: Paul Dale Reviewed-by: Saša Nedvědický Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/28215) (cherry picked from commit 1b1a859d3d8aafbdda2977f9955ceee6f32f7ea4) --- test/sanitytest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/sanitytest.c b/test/sanitytest.c index 0b4d4a6a7c3..282ad64f1ac 100644 --- a/test/sanitytest.c +++ b/test/sanitytest.c @@ -192,7 +192,9 @@ static int test_sanity_sleep(int i) #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L /* disarm the timer */ do { - if (setitimer(ITIMER_REAL, NULL, NULL)) { + static const struct itimerval it; + + if (setitimer(ITIMER_REAL, &it, NULL)) { TEST_perror("test_sanity_sleep: disarm setitimer"); break; } -- 2.47.2