|
|
Message-ID: <AGEAXQDgLLHbg8Be3dIwKaqe.1.1795686953315.Hmail.2601110895@stu.pku.edu.cn>
Date: Thu, 26 Nov 2026 17:55:53 +0800 (GMT+08:00)
From: 吴尚哲 <wushangzhe26@....pku.edu.cn>
To: musl <musl@...ts.openwall.com>
Subject: Bug in ualarm(): reads uninitialized timer data after setitimer() fails
Hello,
ualarm() in musl 1.2.5 copies the requested duration directly
into tv_usec and leaves tv_sec at zero. Linux expects tv_usec
to hold only the subsecond remainder, so setitimer() rejects
an out-of-range value with EINVAL.
In src/unistd/ualarm.c:11–12:
setitimer(ITIMER_REAL, &it, &it_old);
return it_old.it_value.tv_sec*1000000 + it_old.it_value.tv_usec;
ualarm() ignores the error and computes its return value from
it_old, which is uninitialized when setitimer() leaves it untouched.
In our static x86_64 tests, the failing setitimer() call left the
sentinel bytes in its output structure unchanged. In the
corresponding ualarm() test, the return value changed when we filled
it_old with a known byte pattern.
Checking the result of setitimer() and returning an error before
reading it_old would fix the uninitialized read.
Thanks,
Shangzhe
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.