smokey: y2038: Fix false success in syscall tests
cover smokey: y2038: Fix false success in syscall tests
This series fixes two cases where the y2038 tests may report success despite an unexpected system call or thread result.
In both cases, a zero return value is propagated to the test framework even though the actual result does not match the expected result.
Both fixes ensure that an unexpected zero result is converted to -EINVAL.
The issues were reproduced using fault injection, and both fixes were verified using regression testing on an LP64 Xenomai Cobalt environment.
Guangfeng Wang (2):
smokey: y2038: Fix false success in run_thread()
smokey: y2038: Fix false success in sigtimedwait64 test
testsuite/smokey/y2038/syscall-tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/2 smokey: y2038: Fix false success in run_thread()
When the actual thread result is zero but the expected result is non-zero, run_thread() incorrectly returns success despite the result mismatch.
Return -EINVAL when the actual result is zero and does not match the expected result.
Verified using fault injection and regression testing.
--- testsuite/smokey/y2038/syscall-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testsuite/smokey/y2038/syscall-tests.c +1 -1
@@ -157,7 +157,7 @@ static int run_thread(void *(*thread)(void *), void *arg, int exp_result) res = (long )status; -return (res == exp_result) ?0 : res; +return (res == exp_result) ?0 : (res ?: -EINVAL ); }static int test_sc_cobalt_sem_timedwait64 (void )
Signature · 1 line
2.47.3
Re: [PATCH 1/2] smokey: y2038: Fix false success in run_thread()
Quoted 19 lines · Guangfeng Wang
When the actual thread result is zero but the expected result is non-zero,
run_thread()incorrectly returns success despite the result mismatch.Return
-EINVALwhen the actual result is zero and does not match the expected result.Verified using fault injection and regression testing.
Signed-off-by Guangfeng Wang <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testsuite/smokey/y2038/syscall-tests.c +0
-0
testsuite/smokey/y2038/syscall-tests.c static int run_thread(void *(*thread)(void *), void *arg, int exp_result) · line 160
Quoted 5 lines
testsuite/smokey/y2038/syscall-tests.c +1
-1@@ -157,7 +157,7 @@ static int run_thread(void *(*thread)(void *), void *arg, int exp_result) res = (long )status; -return (res == exp_result) ?0 : res; +return (res == exp_result) ?0 : (res ?: -EINVAL );
This actually points our more issues: timedlock64_thread, the only supplier of the status word, is not consistently returning some -errno. Needs to be fixed on top.
testsuite/smokey/y2038/syscall-tests.c static int run_thread(void *(*thread)(void *), void *arg, int exp_result) · line 163
Quoted 3 lines
testsuite/smokey/y2038/syscall-tests.c +0
-0}static int test_sc_cobalt_sem_timedwait64 (void )
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center
PATCH 2/2 smokey: y2038: Fix false success in sigtimedwait64 test
In reply to Guangfeng WangWhen the timed wait unexpectedly returns zero instead of -EAGAIN, the assertion fails but the test function returns success.
Return -EINVAL in this case to propagate the assertion failure to the test framework.
Verified using fault injection and regression testing.
--- testsuite/smokey/y2038/syscall-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testsuite/smokey/y2038/syscall-tests.c +1 -1
@@ -798,7 +798,7 @@ static int test_sc_cobalt_sigtimedwait64(void) ret =XENOMAI_SYSCALL3 (sc_nr, &set,NULL , &t1);if (!smokey_assert (ret == -EAGAIN )) -return ret; +return ret ? ret : -EINVAL ; t1.tv_sec = ts_nat.tv_sec; t1.tv_nsec = ts_nat.tv_nsec;
Signature · 1 line
2.47.3
Quoted 14 lines · Guangfeng Wang
This series fixes two cases where the y2038 tests may report success despite an unexpected system call or thread result.
In both cases, a zero return value is propagated to the test framework even though the actual result does not match the expected result.
Both fixes ensure that an unexpected zero result is converted to
-EINVAL.The issues were reproduced using fault injection, and both fixes were verified using regression testing on an LP64 Xenomai Cobalt environment.
Quoted 7 lines
Guangfeng Wang (2):
smokey: y2038: Fix false success inrun_thread()
smokey: y2038: Fix false success in sigtimedwait64 testtestsuite/smokey/y2038/syscall-tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks, both applied.
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center