]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/sanitytest.c: fix setitimer usage in timer disarmament
authorEugene Syromiatnikov <esyr@openssl.org>
Sun, 10 Aug 2025 00:00:25 +0000 (02:00 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 11 Aug 2025 14:58:05 +0000 (16:58 +0200)
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 <nhorman@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28215)

test/sanitytest.c

index 2dab0340dee5698d8ef63f4be253916f733c6cb9..f17ca4592f65d6e633c17565bdc5211fb4267a05 100644 (file)
@@ -189,7 +189,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;
         }