1 Oct 2005 07:25
[PATCH] invalid assumption in setitimer01.c
The K42 open source research operating system recently stumbled upon a
problem in testcases/kernel/syscalls/setitimer/setitimer01.c.
The logic therein assumes that two successive calls to
setitimer(which, value, ovalue) will result in the tv_sec field of the
`ovalue' returned by the second being equal to the tv_sec field of the
'value' passed to the first. In other words, that no time measurable in
seconds will transpire between the two calls. This is an invalid
assumption, as demonstrated by the following:
$ stress -m 16 -d 2 -i 4 --timeout 10m &
$ for ((i=0; ; i++)); do setitimer01 || { echo FAIL: $i runs; break; }; done
setitimer01 1 PASS : functionality is correct
setitimer01 1 PASS : functionality is correct
...
setitimer01 1 FAIL : old timer value is not equal to expected value
FAIL: 15078 runs
The fix that seems most in keeping with the intent of the original
author (who is CC'ed) is to just assert that the seconds remaining is less
than or equal to the starting value, rather than exactly equal to the
starting value.
Signed-off-by: Amos Waterland <apw@...>
--- testcases/kernel/syscalls/setitimer/setitimer01.c.orig
+++ testcases/kernel/syscalls/setitimer/setitimer01.c
<at> <at> -130,7 +130,7 <at> <at>
"call failed");
}
(Continue reading)
RSS Feed