Skip to contentSkip to conversation

smokey: y2038: Fix false success in syscall tests

PATCH In review Guangfeng Wang 2 participants 5 messages Nov 29 – Nov 30

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 4318712cc..594c9e323 100644
@@ -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
#2 lore raw

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 -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 +0 -0
index 4318712cc..594c9e323 100644

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
#3 lore raw

PATCH 2/2 smokey: y2038: Fix false success in sigtimedwait64 test

In reply to Guangfeng Wang

When 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
index 594c9e323..49903cb3a 100644
@@ -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
#4 lore raw
In reply to Guangfeng Wang
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 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(-)

Thanks, both applied.

Jan

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center