[LTP] [PATCH v2] syscalls/timer_getoverrun01: use kernel_timer_t type

Jan Stancek jstancek@redhat.com
Thu Mar 21 19:25:55 CET 2024


Testcase is failing on s390x, with glibc-2.39 and 6.9-rc0 (git commit
a4145ce1e7bc). Userspace defines timer_t as void * (8 bytes), while
__kernel_timer_t is defined as int (4 bytes).  This means that kernel
only populates 4 bytes, and other 4 can remain uninitialized, possibly
containing some non-zero garbage, e.g.:

  timer_create(CLOCK_REALTIME, {sigev_signo=SIGALRM, sigev_notify=SIGEV_SIGNAL},  <unfinished ...>
  <... timer_create resumed>[0]) = 0
  timer_getoverrun(1 <unfinished ...>
  timer_getoverrun resumed>) = -1 EINVAL (Invalid argument)
  timer_delete(1)    = -1 EINVAL (Invalid argument)

Since we are dealing with syscalls directly, use kernel_timer_t.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 .../kernel/syscalls/timer_getoverrun/timer_getoverrun01.c      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c b/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
index 5c444857aaa7..57c2147bf47f 100644
--- a/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
+++ b/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
@@ -19,10 +19,11 @@
 #include <time.h>
 #include "tst_safe_clocks.h"
 #include "lapi/syscalls.h"
+#include "lapi/common_timers.h"
 
 static void run(void)
 {
-	timer_t timer;
+	kernel_timer_t timer;
 	struct sigevent ev;
 
 	ev.sigev_value = (union sigval) 0;
-- 
2.39.3



More information about the ltp mailing list