xenomai.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation
@ 2023-05-05  7:20 Florian Bezdeka
  2023-05-05  7:20 ` [PATCH 01/17] y2038: cobalt: posix/sem: Remove compat syscall for sem_timedwait64 Florian Bezdeka
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:20 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

Hi all,

I'm trying to bring the remaining patches from my y2038 queue into Xenomai 
next/master branches. The full queue [1] holds ~40 patches. I'm trying to 
split that up to keep reviewing efforts low.

Part one of this series:
Basically removing some unnecessary compat syscalls. While initally evolving 
a pattern that we followed for all the necessary syscalls we overlooked an 
existing compat mechanism, so we accidentially implemented to much.

Part two of this series:
Minor refactorings, fixes and preparations for 64 bit time_t.

Best regards,
Florian

[1] https://gitlab.com/Xenomai/xenomai-hacker-space/-/tree/florian/y2038

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
Florian Bezdeka (17):
      y2038: cobalt: posix/sem: Remove compat syscall for sem_timedwait64
      y2038: cobalt: posix/clock: Remove compat syscall for clock_gettime64
      y2038: cobalt: posix/clock: Remove compat syscall for clock_settime64
      y2038: cobalt: posix/clock: Remove compat syscall for clock_nanosleep64
      y2038: cobalt: posix/clock: Remove compat syscall for clock_getres64
      y2038: cobalt: posix/clock: Remove compat syscall for clock_adjtime64
      y2038: cobalt: posix/mutex: Remove compat syscall for mutex_timedlock64
      y2038: cobalt: posix/mqueue: Remove compat syscall for mq_timedsend64
      y2038: cobalt: posix/monitor: Remove compat syscall for monitor_wait64
      y2038: cobalt: posix/event: Remove compat syscall for event_wait64
      y2038: cobalt: posix/cond: Remove compat syscall for cond_wait_prologue64
      y2038: cobalt: Cleanup code style of time.{c,h}
      y2038: posix/mq: Fix mq_timedsend syscall routing
      y2038: posix/mq: Harmonize mq_receive and mq_timedreceive
      y2038: testsuite/smokey/y2038: Fix a very unlikely resource leak
      y2038: cobalt/posix/clock: Use timespec64_valid() for validation
      y2038: Prepare code base for 64bit time_t

 demo/alchemy/altency.c                 | 26 +++++-----
 include/cobalt/kernel/time.h           |  2 +-
 kernel/cobalt/posix/clock.c            | 59 +++++------------------
 kernel/cobalt/posix/clock.h            | 16 -------
 kernel/cobalt/posix/cond.c             | 12 +----
 kernel/cobalt/posix/cond.h             |  5 --
 kernel/cobalt/posix/event.c            | 26 ++++------
 kernel/cobalt/posix/event.h            |  5 --
 kernel/cobalt/posix/monitor.c          | 26 ++++------
 kernel/cobalt/posix/monitor.h          |  5 --
 kernel/cobalt/posix/mqueue.c           | 10 +---
 kernel/cobalt/posix/mqueue.h           |  3 --
 kernel/cobalt/posix/mutex.c            | 10 +---
 kernel/cobalt/posix/mutex.h            |  3 --
 kernel/cobalt/posix/sem.c              | 22 ++++-----
 kernel/cobalt/posix/sem.h              |  3 --
 kernel/cobalt/posix/syscall32.c        | 86 ----------------------------------
 kernel/cobalt/posix/syscall32.h        | 55 ----------------------
 kernel/cobalt/time.c                   |  4 +-
 lib/cobalt/mq.c                        | 47 ++++++++++++-------
 testsuite/latency/latency.c            | 34 +++++++-------
 testsuite/smokey/y2038/syscall-tests.c |  7 +--
 testsuite/spitest/spitest.c            |  6 ++-
 23 files changed, 116 insertions(+), 356 deletions(-)
---
base-commit: 967cff01b071f2799db1de4d088c396a40a074b6
change-id: 20230428-florian-y2038-part-one-713ed4f37308

Best regards,
-- 
Florian Bezdeka <florian.bezdeka@siemens.com>


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 01/17] y2038: cobalt: posix/sem: Remove compat syscall for sem_timedwait64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
@ 2023-05-05  7:20 ` Florian Bezdeka
  2023-05-05  7:20 ` [PATCH 02/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_gettime64 Florian Bezdeka
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:20 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/sem.c       | 22 ++++++++--------------
 kernel/cobalt/posix/sem.h       |  3 ---
 kernel/cobalt/posix/syscall32.c |  7 -------
 kernel/cobalt/posix/syscall32.h |  4 ----
 4 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
index 71b8c52f5..aca03a555 100644
--- a/kernel/cobalt/posix/sem.c
+++ b/kernel/cobalt/posix/sem.c
@@ -360,18 +360,6 @@ int __cobalt_sem_timedwait(struct cobalt_sem_shadow __user *u_sem,
 	return ret;
 }
 
-int __cobalt_sem_timedwait64(struct cobalt_sem_shadow __user *u_sem,
-			     const struct __kernel_timespec __user *u_ts)
-{
-	int ret = 1;
-	struct timespec64 ts64;
-
-	if (u_ts)
-		ret = cobalt_get_timespec64(&ts64, u_ts);
-
-	return __cobalt_sem_timedwait(u_sem, ret ? NULL : &ts64);
-}
-
 static int sem_post(xnhandle_t handle)
 {
 	struct cobalt_sem *sem;
@@ -472,8 +460,8 @@ COBALT_SYSCALL(sem_timedwait, primary,
 	       (struct cobalt_sem_shadow __user *u_sem,
 		const struct __user_old_timespec __user *u_ts))
 {
-	int ret = 1;
 	struct timespec64 ts64;
+	int ret = 1;
 
 	if (u_ts)
 		ret = cobalt_get_u_timespec(&ts64, u_ts);
@@ -485,7 +473,13 @@ COBALT_SYSCALL(sem_timedwait64, primary,
 	       (struct cobalt_sem_shadow __user *u_sem,
 		const struct __kernel_timespec __user *u_ts))
 {
-	return __cobalt_sem_timedwait64(u_sem, u_ts);
+	struct timespec64 ts64;
+	int ret = 1;
+
+	if (u_ts)
+		ret = cobalt_get_timespec64(&ts64, u_ts);
+
+	return __cobalt_sem_timedwait(u_sem, ret ? NULL : &ts64);
 }
 
 COBALT_SYSCALL(sem_trywait, primary,
diff --git a/kernel/cobalt/posix/sem.h b/kernel/cobalt/posix/sem.h
index d7dbb9098..e1e4d68f0 100644
--- a/kernel/cobalt/posix/sem.h
+++ b/kernel/cobalt/posix/sem.h
@@ -66,9 +66,6 @@ __cobalt_sem_open(struct cobalt_sem_shadow __user *usm,
 int __cobalt_sem_timedwait(struct cobalt_sem_shadow __user *u_sem,
 			   const struct timespec64 *ts);
 
-int __cobalt_sem_timedwait64(struct cobalt_sem_shadow __user *u_sem,
-			     const struct __kernel_timespec __user *u_ts);
-
 int __cobalt_sem_destroy(xnhandle_t handle);
 
 void cobalt_nsem_reclaim(struct cobalt_process *process);
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index b65a0a760..2b4911c59 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -137,13 +137,6 @@ COBALT_SYSCALL32emu(sem_timedwait, primary,
 	return __cobalt_sem_timedwait(u_sem, ret ? NULL : &ts64);
 }
 
-COBALT_SYSCALL32emu(sem_timedwait64, primary,
-		    (struct cobalt_sem_shadow __user *u_sem,
-		     const struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_sem_timedwait64(u_sem, u_ts);
-}
-
 COBALT_SYSCALL32emu(clock_getres, current,
 		    (clockid_t clock_id,
 		     struct old_timespec32 __user *u_ts))
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index 55f08121c..f36fff272 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -293,8 +293,4 @@ COBALT_SYSCALL32emu_DECL(sem_timedwait,
 			 (struct cobalt_sem_shadow __user *u_sem,
 			  const struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(sem_timedwait64,
-			 (struct cobalt_sem_shadow __user *u_sem,
-			  const struct __kernel_timespec __user *u_ts));
-
 #endif /* !_COBALT_POSIX_SYSCALL32_H */

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 02/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_gettime64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
  2023-05-05  7:20 ` [PATCH 01/17] y2038: cobalt: posix/sem: Remove compat syscall for sem_timedwait64 Florian Bezdeka
@ 2023-05-05  7:20 ` Florian Bezdeka
  2023-05-05  7:20 ` [PATCH 03/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_settime64 Florian Bezdeka
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:20 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/clock.c     | 10 ++--------
 kernel/cobalt/posix/clock.h     |  3 ---
 kernel/cobalt/posix/syscall32.c |  7 -------
 kernel/cobalt/posix/syscall32.h |  4 ----
 4 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 16cc8b20a..bd393bb11 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -162,8 +162,8 @@ COBALT_SYSCALL(clock_gettime, current,
 	return 0;
 }
 
-int __cobalt_clock_gettime64(clockid_t clock_id,
-			struct __kernel_timespec __user *u_ts)
+COBALT_SYSCALL(clock_gettime64, current,
+	       (clockid_t clock_id, struct __kernel_timespec __user *u_ts))
 {
 	struct timespec64 ts;
 	int ret;
@@ -178,12 +178,6 @@ int __cobalt_clock_gettime64(clockid_t clock_id,
 	return 0;
 }
 
-COBALT_SYSCALL(clock_gettime64, current,
-	       (clockid_t clock_id, struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_clock_gettime64(clock_id, u_ts);
-}
-
 int __cobalt_clock_settime(clockid_t clock_id, const struct timespec64 *ts)
 {
 	int _ret, ret = 0;
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index e18373979..169d51e62 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -103,9 +103,6 @@ int __cobalt_clock_getres64(clockid_t clock_id,
 int __cobalt_clock_gettime(clockid_t clock_id,
 			   struct timespec64 *ts);
 
-int __cobalt_clock_gettime64(clockid_t clock_id,
-			struct __kernel_timespec __user *u_ts);
-
 int __cobalt_clock_settime(clockid_t clock_id,
 			   const struct timespec64 *ts);
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 2b4911c59..917a67625 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -172,13 +172,6 @@ COBALT_SYSCALL32emu(clock_gettime, current,
 	return sys32_put_timespec(u_ts, &ts);
 }
 
-COBALT_SYSCALL32emu(clock_gettime64, current,
-		    (clockid_t clock_id,
-		     struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_clock_gettime64(clock_id, u_ts);
-}
-
 COBALT_SYSCALL32emu(clock_settime, current,
 		    (clockid_t clock_id,
 		     const struct old_timespec32 __user *u_ts))
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index f36fff272..7d448d0ef 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -63,10 +63,6 @@ COBALT_SYSCALL32emu_DECL(clock_gettime,
 			 (clockid_t clock_id,
 			  struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(clock_gettime64,
-			 (clockid_t clock_id,
-			  struct __kernel_timespec __user *u_ts));
-
 COBALT_SYSCALL32emu_DECL(clock_settime,
 			 (clockid_t clock_id,
 			  const struct old_timespec32 __user *u_ts));

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 03/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_settime64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
  2023-05-05  7:20 ` [PATCH 01/17] y2038: cobalt: posix/sem: Remove compat syscall for sem_timedwait64 Florian Bezdeka
  2023-05-05  7:20 ` [PATCH 02/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_gettime64 Florian Bezdeka
@ 2023-05-05  7:20 ` Florian Bezdeka
  2023-05-05  7:20 ` [PATCH 04/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_nanosleep64 Florian Bezdeka
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:20 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/clock.c     | 11 +++--------
 kernel/cobalt/posix/clock.h     |  3 ---
 kernel/cobalt/posix/syscall32.c |  7 -------
 kernel/cobalt/posix/syscall32.h |  4 ----
 4 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index bd393bb11..c4457b6c9 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -232,8 +232,9 @@ COBALT_SYSCALL(clock_settime, current,
 	return __cobalt_clock_settime(clock_id, &ts);
 }
 
-int __cobalt_clock_settime64(clockid_t clock_id,
-			const struct __kernel_timespec __user *u_ts)
+COBALT_SYSCALL(clock_settime64, current,
+	       (clockid_t clock_id,
+		const struct __kernel_timespec __user *u_ts))
 {
 	struct timespec64 ts64;
 
@@ -243,12 +244,6 @@ int __cobalt_clock_settime64(clockid_t clock_id,
 	return __cobalt_clock_settime(clock_id, &ts64);
 }
 
-COBALT_SYSCALL(clock_settime64, current,
-	       (clockid_t clock_id, const struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_clock_settime64(clock_id, u_ts);
-}
-
 COBALT_SYSCALL(clock_adjtime, current,
 	       (clockid_t clock_id, struct __user_old_timex __user *u_tx))
 {
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index 169d51e62..2607522e8 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -106,9 +106,6 @@ int __cobalt_clock_gettime(clockid_t clock_id,
 int __cobalt_clock_settime(clockid_t clock_id,
 			   const struct timespec64 *ts);
 
-int __cobalt_clock_settime64(clockid_t clock_id,
-			const struct __kernel_timespec __user *u_ts);
-
 int __cobalt_clock_adjtime(clockid_t clock_id,
 			   struct __kernel_timex *tx);
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 917a67625..30d7e1bcd 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -186,13 +186,6 @@ COBALT_SYSCALL32emu(clock_settime, current,
 	return __cobalt_clock_settime(clock_id, &ts);
 }
 
-COBALT_SYSCALL32emu(clock_settime64, current,
-		    (clockid_t clock_id,
-		     const struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_clock_settime64(clock_id, u_ts);
-}
-
 COBALT_SYSCALL32emu(clock_adjtime, current,
 		    (clockid_t clock_id, struct old_timex32 __user *u_tx))
 {
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index 7d448d0ef..c016c904c 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -67,10 +67,6 @@ COBALT_SYSCALL32emu_DECL(clock_settime,
 			 (clockid_t clock_id,
 			  const struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(clock_settime64,
-			 (clockid_t clock_id,
-			  const struct __kernel_timespec __user *u_ts));
-
 COBALT_SYSCALL32emu_DECL(clock_adjtime,
 			 (clockid_t clock_id,
 			  struct old_timex32 __user *u_tx));

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 04/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_nanosleep64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (2 preceding siblings ...)
  2023-05-05  7:20 ` [PATCH 03/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_settime64 Florian Bezdeka
@ 2023-05-05  7:20 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 05/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_getres64 Florian Bezdeka
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:20 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/clock.c     | 13 +++----------
 kernel/cobalt/posix/clock.h     |  4 ----
 kernel/cobalt/posix/syscall32.c |  9 ---------
 kernel/cobalt/posix/syscall32.h |  6 ------
 4 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index c4457b6c9..7b1693612 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -385,9 +385,10 @@ COBALT_SYSCALL(clock_nanosleep, primary,
 	return ret;
 }
 
-int __cobalt_clock_nanosleep64(clockid_t clock_id, int flags,
+COBALT_SYSCALL(clock_nanosleep64, primary,
+	       (clockid_t clock_id, int flags,
 		const struct __kernel_timespec __user *u_rqt,
-		struct __kernel_timespec __user *u_rmt)
+		struct __kernel_timespec __user *u_rmt))
 {
 	struct timespec64 rqt, rmt, *rmtp = NULL;
 	int ret;
@@ -407,14 +408,6 @@ int __cobalt_clock_nanosleep64(clockid_t clock_id, int flags,
 	return ret;
 }
 
-COBALT_SYSCALL(clock_nanosleep64, primary,
-	       (clockid_t clock_id, int flags,
-		const struct __kernel_timespec __user *u_rqt,
-		struct __kernel_timespec __user *u_rmt))
-{
-	return __cobalt_clock_nanosleep64(clock_id, flags, u_rqt, u_rmt);
-}
-
 int cobalt_clock_register(struct xnclock *clock, const cpumask_t *affinity,
 			  clockid_t *clk_id)
 {
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index 2607522e8..b5ab39b44 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -116,10 +116,6 @@ int __cobalt_clock_nanosleep(clockid_t clock_id, int flags,
 			     const struct timespec64 *rqt,
 			     struct timespec64 *rmt);
 
-int __cobalt_clock_nanosleep64(clockid_t clock_id, int flags,
-		const struct __kernel_timespec __user *u_rqt,
-		struct __kernel_timespec __user *u_rmt);
-
 COBALT_SYSCALL_DECL(clock_getres,
 		    (clockid_t clock_id, struct __user_old_timespec __user *u_ts));
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 30d7e1bcd..a245e91af 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -232,15 +232,6 @@ COBALT_SYSCALL32emu(clock_nanosleep, primary,
 	return ret;
 }
 
-COBALT_SYSCALL32emu(clock_nanosleep64, nonrestartable,
-		    (clockid_t clock_id, int flags,
-		     const struct __kernel_timespec __user *u_rqt,
-		     struct __kernel_timespec __user *u_rmt))
-{
-	return __cobalt_clock_nanosleep64(clock_id, flags, u_rqt, u_rmt);
-}
-
-
 COBALT_SYSCALL32emu(mutex_timedlock, primary,
 		    (struct cobalt_mutex_shadow __user *u_mx,
 		     const struct old_timespec32 __user *u_ts))
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index c016c904c..0e06e12c1 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -80,12 +80,6 @@ COBALT_SYSCALL32emu_DECL(clock_nanosleep,
 			  const struct old_timespec32 __user *u_rqt,
 			  struct old_timespec32 __user *u_rmt));
 
-COBALT_SYSCALL32emu_DECL(clock_nanosleep64,
-			 (clockid_t clock_id, int flags,
-			  const struct __kernel_timespec __user *u_rqt,
-			  struct __kernel_timespec __user *u_rmt));
-
-
 COBALT_SYSCALL32emu_DECL(mutex_timedlock,
 			 (struct cobalt_mutex_shadow __user *u_mx,
 			  const struct old_timespec32 __user *u_ts));

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 05/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_getres64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (3 preceding siblings ...)
  2023-05-05  7:20 ` [PATCH 04/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_nanosleep64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 06/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_adjtime64 Florian Bezdeka
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/clock.c     | 10 ++--------
 kernel/cobalt/posix/clock.h     |  3 ---
 kernel/cobalt/posix/syscall32.c |  7 -------
 kernel/cobalt/posix/syscall32.h |  4 ----
 4 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 7b1693612..9de90c728 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -93,8 +93,8 @@ COBALT_SYSCALL(clock_getres, current,
 	return 0;
 }
 
-int __cobalt_clock_getres64(clockid_t clock_id,
-			struct __kernel_timespec __user *u_ts)
+COBALT_SYSCALL(clock_getres64, current,
+	       (clockid_t clock_id, struct __kernel_timespec __user *u_ts))
 {
 	struct timespec64 ts;
 	int ret;
@@ -111,12 +111,6 @@ int __cobalt_clock_getres64(clockid_t clock_id,
 	return 0;
 }
 
-COBALT_SYSCALL(clock_getres64, current,
-	       (clockid_t clock_id, struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_clock_getres64(clock_id, u_ts);
-}
-
 int __cobalt_clock_gettime(clockid_t clock_id, struct timespec64 *ts)
 {
 	xnticks_t ns;
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index b5ab39b44..305400148 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -97,9 +97,6 @@ static inline int clock_flag(int flag, clockid_t clock_id)
 int __cobalt_clock_getres(clockid_t clock_id,
 			  struct timespec64 *ts);
 
-int __cobalt_clock_getres64(clockid_t clock_id,
-			struct __kernel_timespec __user *u_ts);
-
 int __cobalt_clock_gettime(clockid_t clock_id,
 			   struct timespec64 *ts);
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index a245e91af..2e7c2fc93 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -151,13 +151,6 @@ COBALT_SYSCALL32emu(clock_getres, current,
 	return u_ts ? sys32_put_timespec(u_ts, &ts) : 0;
 }
 
-COBALT_SYSCALL32emu(clock_getres64, current,
-		    (clockid_t clock_id,
-		     struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_clock_getres64(clock_id, u_ts);
-}
-
 COBALT_SYSCALL32emu(clock_gettime, current,
 		    (clockid_t clock_id,
 		     struct old_timespec32 __user *u_ts))
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index 0e06e12c1..2711fb2c8 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -55,10 +55,6 @@ COBALT_SYSCALL32emu_DECL(clock_getres,
 			 (clockid_t clock_id,
 			  struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(clock_getres64,
-			 (clockid_t clock_id,
-			  struct __kernel_timespec __user *u_ts));
-
 COBALT_SYSCALL32emu_DECL(clock_gettime,
 			 (clockid_t clock_id,
 			  struct old_timespec32 __user *u_ts));

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 06/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_adjtime64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (4 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 05/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_getres64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 07/17] y2038: cobalt: posix/mutex: Remove compat syscall for mutex_timedlock64 Florian Bezdeka
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/clock.c     | 10 ++--------
 kernel/cobalt/posix/clock.h     |  3 ---
 kernel/cobalt/posix/syscall32.c |  7 -------
 kernel/cobalt/posix/syscall32.h |  4 ----
 4 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 9de90c728..266ccef52 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -254,8 +254,8 @@ COBALT_SYSCALL(clock_adjtime, current,
 	return cobalt_copy_to_user(u_tx, &tx, sizeof(tx));
 }
 
-int __cobalt_clock_adjtime64(clockid_t clock_id,
-			struct __kernel_timex __user *u_tx)
+COBALT_SYSCALL(clock_adjtime64, current,
+	       (clockid_t clock_id, struct __kernel_timex __user *u_tx))
 {
 	struct __kernel_timex tx;
 	int ret;
@@ -270,12 +270,6 @@ int __cobalt_clock_adjtime64(clockid_t clock_id,
 	return cobalt_copy_to_user(u_tx, &tx, sizeof(tx));
 }
 
-COBALT_SYSCALL(clock_adjtime64, current,
-	       (clockid_t clock_id, struct __kernel_timex __user *u_tx))
-{
-	return __cobalt_clock_adjtime64(clock_id, u_tx);
-}
-
 int __cobalt_clock_nanosleep(clockid_t clock_id, int flags,
 			     const struct timespec64 *rqt,
 			     struct timespec64 *rmt)
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index 305400148..dbaabbc5d 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -106,9 +106,6 @@ int __cobalt_clock_settime(clockid_t clock_id,
 int __cobalt_clock_adjtime(clockid_t clock_id,
 			   struct __kernel_timex *tx);
 
-int __cobalt_clock_adjtime64(clockid_t clock_id,
-			struct __kernel_timex __user *u_tx);
-
 int __cobalt_clock_nanosleep(clockid_t clock_id, int flags,
 			     const struct timespec64 *rqt,
 			     struct timespec64 *rmt);
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 2e7c2fc93..245ddb2f0 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -196,13 +196,6 @@ COBALT_SYSCALL32emu(clock_adjtime, current,
 	return sys32_put_timex(u_tx, &tx);
 }
 
-COBALT_SYSCALL32emu(clock_adjtime64, current,
-		    (clockid_t clock_id, struct __kernel_timex __user *u_tx))
-{
-	return __cobalt_clock_adjtime64(clock_id, u_tx);
-}
-
-
 COBALT_SYSCALL32emu(clock_nanosleep, primary,
 		    (clockid_t clock_id, int flags,
 		     const struct old_timespec32 __user *u_rqt,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index 2711fb2c8..b7baee94d 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -67,10 +67,6 @@ COBALT_SYSCALL32emu_DECL(clock_adjtime,
 			 (clockid_t clock_id,
 			  struct old_timex32 __user *u_tx));
 
-COBALT_SYSCALL32emu_DECL(clock_adjtime64,
-			 (clockid_t clock_id,
-			  struct __kernel_timex __user *u_tx));
-
 COBALT_SYSCALL32emu_DECL(clock_nanosleep,
 			 (clockid_t clock_id, int flags,
 			  const struct old_timespec32 __user *u_rqt,

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 07/17] y2038: cobalt: posix/mutex: Remove compat syscall for mutex_timedlock64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (5 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 06/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_adjtime64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 08/17] y2038: cobalt: posix/mqueue: Remove compat syscall for mq_timedsend64 Florian Bezdeka
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/mutex.c     | 10 ++--------
 kernel/cobalt/posix/mutex.h     |  3 ---
 kernel/cobalt/posix/syscall32.c |  7 -------
 kernel/cobalt/posix/syscall32.h |  4 ----
 4 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c
index 0f1c01851..2bdb66d17 100644
--- a/kernel/cobalt/posix/mutex.c
+++ b/kernel/cobalt/posix/mutex.c
@@ -364,13 +364,6 @@ static inline int mutex_fetch_timeout64(struct timespec64 *ts,
 	return u_ts == NULL ? -EFAULT : cobalt_get_timespec64(ts, u_ts);
 }
 
-int __cobalt_mutex_timedlock64(struct cobalt_mutex_shadow __user *u_mx,
-			       const void __user *u_ts)
-{
-	return __cobalt_mutex_timedlock_break(u_mx, u_ts,
-					      mutex_fetch_timeout64);
-}
-
 COBALT_SYSCALL(mutex_timedlock, primary,
 	       (struct cobalt_mutex_shadow __user *u_mx,
 		const struct __user_old_timespec __user *u_ts))
@@ -382,7 +375,8 @@ COBALT_SYSCALL(mutex_timedlock64, primary,
 	       (struct cobalt_mutex_shadow __user *u_mx,
 		const struct __kernel_timespec __user *u_ts))
 {
-	return __cobalt_mutex_timedlock64(u_mx, u_ts);
+	return __cobalt_mutex_timedlock_break(u_mx, u_ts,
+					      mutex_fetch_timeout64);
 }
 
 COBALT_SYSCALL(mutex_unlock, nonrestartable,
diff --git a/kernel/cobalt/posix/mutex.h b/kernel/cobalt/posix/mutex.h
index d7fede27d..800515a69 100644
--- a/kernel/cobalt/posix/mutex.h
+++ b/kernel/cobalt/posix/mutex.h
@@ -40,9 +40,6 @@ int __cobalt_mutex_timedlock_break(struct cobalt_mutex_shadow __user *u_mx,
 				   int (*fetch_timeout)(struct timespec64 *ts,
 							const void __user *u_ts));
 
-int __cobalt_mutex_timedlock64(struct cobalt_mutex_shadow __user *u_mx,
-				   const void __user *u_ts);
-
 int __cobalt_mutex_acquire_unchecked(struct xnthread *cur,
 				     struct cobalt_mutex *mutex,
 				     const struct timespec64 *ts);
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 245ddb2f0..d3cc79878 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -225,13 +225,6 @@ COBALT_SYSCALL32emu(mutex_timedlock, primary,
 	return __cobalt_mutex_timedlock_break(u_mx, u_ts, sys32_fetch_timeout);
 }
 
-COBALT_SYSCALL32emu(mutex_timedlock64, primary,
-		    (struct cobalt_mutex_shadow __user *u_mx,
-		     const struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_mutex_timedlock64(u_mx, u_ts);
-}
-
 COBALT_SYSCALL32emu(cond_wait_prologue, nonrestartable,
 		    (struct cobalt_cond_shadow __user *u_cnd,
 		     struct cobalt_mutex_shadow __user *u_mx,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index b7baee94d..ab7dbb945 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -76,10 +76,6 @@ COBALT_SYSCALL32emu_DECL(mutex_timedlock,
 			 (struct cobalt_mutex_shadow __user *u_mx,
 			  const struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(mutex_timedlock64,
-			 (struct cobalt_mutex_shadow __user *u_mx,
-			  const struct __kernel_timespec __user *u_ts));
-
 COBALT_SYSCALL32emu_DECL(cond_wait_prologue,
 			 (struct cobalt_cond_shadow __user *u_cnd,
 			  struct cobalt_mutex_shadow __user *u_mx,

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 08/17] y2038: cobalt: posix/mqueue: Remove compat syscall for mq_timedsend64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (6 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 07/17] y2038: cobalt: posix/mutex: Remove compat syscall for mutex_timedlock64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 09/17] y2038: cobalt: posix/monitor: Remove compat syscall for monitor_wait64 Florian Bezdeka
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/mqueue.c    | 10 ++--------
 kernel/cobalt/posix/mqueue.h    |  3 ---
 kernel/cobalt/posix/syscall32.c |  8 --------
 kernel/cobalt/posix/syscall32.h |  5 -----
 4 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/kernel/cobalt/posix/mqueue.c b/kernel/cobalt/posix/mqueue.c
index 3514ba1b0..4487e23de 100644
--- a/kernel/cobalt/posix/mqueue.c
+++ b/kernel/cobalt/posix/mqueue.c
@@ -974,13 +974,6 @@ out:
 	return ret;
 }
 
-int __cobalt_mq_timedsend64(mqd_t uqd, const void __user *u_buf, size_t len,
-			    unsigned int prio, const void __user *u_ts)
-{
-	return __cobalt_mq_timedsend(uqd, u_buf, len, prio, u_ts,
-				     u_ts ? mq_fetch_timeout64 : NULL);
-}
-
 COBALT_SYSCALL(mq_timedsend, primary,
 	       (mqd_t uqd, const void __user *u_buf, size_t len,
 		unsigned int prio, const struct __user_old_timespec __user *u_ts))
@@ -993,7 +986,8 @@ COBALT_SYSCALL(mq_timedsend64, primary,
 	       (mqd_t uqd, const void __user *u_buf, size_t len,
 		unsigned int prio, const struct __kernel_timespec __user *u_ts))
 {
-	return __cobalt_mq_timedsend64(uqd, u_buf, len, prio, u_ts);
+	return __cobalt_mq_timedsend(uqd, u_buf, len, prio, u_ts,
+				     u_ts ? mq_fetch_timeout64 : NULL);
 }
 
 int __cobalt_mq_timedreceive(mqd_t uqd, void __user *u_buf,
diff --git a/kernel/cobalt/posix/mqueue.h b/kernel/cobalt/posix/mqueue.h
index d9223866a..755623f47 100644
--- a/kernel/cobalt/posix/mqueue.h
+++ b/kernel/cobalt/posix/mqueue.h
@@ -40,9 +40,6 @@ int __cobalt_mq_timedsend(mqd_t uqd, const void __user *u_buf, size_t len,
 			  int (*fetch_timeout)(struct timespec64 *ts,
 					       const void __user *u_ts));
 
-int __cobalt_mq_timedsend64(mqd_t uqd, const void __user *u_buf, size_t len,
-			    unsigned int prio, const void __user *u_ts);
-
 int __cobalt_mq_timedreceive(mqd_t uqd, void __user *u_buf,
 			     ssize_t *lenp,
 			     unsigned int __user *u_prio,
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index d3cc79878..0197c749b 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -285,14 +285,6 @@ COBALT_SYSCALL32emu(mq_timedsend, primary,
 				     u_ts, u_ts ? sys32_fetch_timeout : NULL);
 }
 
-COBALT_SYSCALL32emu(mq_timedsend64, primary,
-		    (mqd_t uqd, const void __user *u_buf, size_t len,
-		     unsigned int prio,
-		     const struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_mq_timedsend64(uqd, u_buf, len, prio, u_ts);
-}
-
 COBALT_SYSCALL32emu(mq_timedreceive, primary,
 		    (mqd_t uqd, void __user *u_buf,
 		     compat_ssize_t __user *u_len,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index ab7dbb945..5569af7d8 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -102,11 +102,6 @@ COBALT_SYSCALL32emu_DECL(mq_timedsend,
 			  unsigned int prio,
 			  const struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(mq_timedsend64,
-			 (mqd_t uqd, const void __user *u_buf, size_t len,
-			  unsigned int prio,
-			  const struct __kernel_timespec __user *u_ts));
-
 COBALT_SYSCALL32emu_DECL(mq_timedreceive,
 			 (mqd_t uqd, void __user *u_buf,
 			  compat_ssize_t __user *u_len,

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 09/17] y2038: cobalt: posix/monitor: Remove compat syscall for monitor_wait64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (7 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 08/17] y2038: cobalt: posix/mqueue: Remove compat syscall for mq_timedsend64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 10/17] y2038: cobalt: posix/event: Remove compat syscall for event_wait64 Florian Bezdeka
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/monitor.c   | 26 +++++++++-----------------
 kernel/cobalt/posix/monitor.h   |  5 -----
 kernel/cobalt/posix/syscall32.c |  8 --------
 kernel/cobalt/posix/syscall32.h |  6 ------
 4 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c
index 1e7128352..c266b8b3b 100644
--- a/kernel/cobalt/posix/monitor.c
+++ b/kernel/cobalt/posix/monitor.c
@@ -294,17 +294,17 @@ out:
 	return ret;
 }
 
-int __cobalt_monitor_wait64(struct cobalt_monitor_shadow __user *u_mon,
-			    int event,
-			    const struct __kernel_timespec __user *u_ts,
-			    int __user *u_ret)
+COBALT_SYSCALL(monitor_wait, nonrestartable,
+	       (struct cobalt_monitor_shadow __user *u_mon,
+	       int event, const struct __user_old_timespec __user *u_ts,
+	       int __user *u_ret))
 {
 	struct timespec64 ts, *tsp = NULL;
 	int ret;
 
 	if (u_ts) {
 		tsp = &ts;
-		ret = cobalt_get_timespec64(&ts, u_ts);
+		ret = cobalt_get_u_timespec(&ts, u_ts);
 		if (ret)
 			return ret;
 	}
@@ -312,17 +312,16 @@ int __cobalt_monitor_wait64(struct cobalt_monitor_shadow __user *u_mon,
 	return __cobalt_monitor_wait(u_mon, event, tsp, u_ret);
 }
 
-COBALT_SYSCALL(monitor_wait, nonrestartable,
-	       (struct cobalt_monitor_shadow __user *u_mon,
-	       int event, const struct __user_old_timespec __user *u_ts,
-	       int __user *u_ret))
+COBALT_SYSCALL(monitor_wait64, nonrestartable,
+	       (struct cobalt_monitor_shadow __user *u_mon, int event,
+		const struct __kernel_timespec __user *u_ts, int __user *u_ret))
 {
 	struct timespec64 ts, *tsp = NULL;
 	int ret;
 
 	if (u_ts) {
 		tsp = &ts;
-		ret = cobalt_get_u_timespec(&ts, u_ts);
+		ret = cobalt_get_timespec64(&ts, u_ts);
 		if (ret)
 			return ret;
 	}
@@ -330,13 +329,6 @@ COBALT_SYSCALL(monitor_wait, nonrestartable,
 	return __cobalt_monitor_wait(u_mon, event, tsp, u_ret);
 }
 
-COBALT_SYSCALL(monitor_wait64, nonrestartable,
-	       (struct cobalt_monitor_shadow __user *u_mon, int event,
-		const struct __kernel_timespec __user *u_ts, int __user *u_ret))
-{
-	return __cobalt_monitor_wait64(u_mon, event, u_ts, u_ret);
-}
-
 COBALT_SYSCALL(monitor_sync, nonrestartable,
 	       (struct cobalt_monitor_shadow __user *u_mon))
 {
diff --git a/kernel/cobalt/posix/monitor.h b/kernel/cobalt/posix/monitor.h
index bf8794e36..3c76a036b 100644
--- a/kernel/cobalt/posix/monitor.h
+++ b/kernel/cobalt/posix/monitor.h
@@ -42,11 +42,6 @@ int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon,
 			  int event, const struct timespec64 *ts,
 			  int __user *u_ret);
 
-int __cobalt_monitor_wait64(struct cobalt_monitor_shadow __user *u_mon,
-			    int event,
-			    const struct __kernel_timespec __user *u_ts,
-			    int __user *u_ret);
-
 COBALT_SYSCALL_DECL(monitor_init,
 		    (struct cobalt_monitor_shadow __user *u_monsh,
 		     clockid_t clk_id,
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 0197c749b..dfa4d31ec 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -733,14 +733,6 @@ COBALT_SYSCALL32emu(monitor_wait, nonrestartable,
 	return __cobalt_monitor_wait(u_mon, event, tsp, u_ret);
 }
 
-COBALT_SYSCALL32emu(monitor_wait64, nonrestartable,
-		    (struct cobalt_monitor_shadow __user *u_mon, int event,
-		     const struct __kernel_timespec __user *u_ts,
-		     int __user *u_ret))
-{
-	return __cobalt_monitor_wait64(u_mon, event, u_ts, u_ret);
-}
-
 COBALT_SYSCALL32emu(event_wait, primary,
 		    (struct cobalt_event_shadow __user *u_event,
 		     unsigned int bits,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index 5569af7d8..973a0befc 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -195,12 +195,6 @@ COBALT_SYSCALL32emu_DECL(monitor_wait,
 			  int event, const struct old_timespec32 __user *u_ts,
 			  int __user *u_ret));
 
-COBALT_SYSCALL32emu_DECL(monitor_wait64,
-			 (struct cobalt_monitor_shadow __user *u_mon,
-			  int event,
-			  const struct __kernel_timespec __user *u_ts,
-			  int __user *u_ret));
-
 COBALT_SYSCALL32emu_DECL(event_wait,
 			 (struct cobalt_event_shadow __user *u_event,
 			  unsigned int bits,

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 10/17] y2038: cobalt: posix/event: Remove compat syscall for event_wait64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (8 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 09/17] y2038: cobalt: posix/monitor: Remove compat syscall for monitor_wait64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 11/17] y2038: cobalt: posix/cond: Remove compat syscall for cond_wait_prologue64 Florian Bezdeka
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/event.c     | 26 +++++++++-----------------
 kernel/cobalt/posix/event.h     |  5 -----
 kernel/cobalt/posix/syscall32.c |  9 ---------
 kernel/cobalt/posix/syscall32.h |  7 -------
 4 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/kernel/cobalt/posix/event.c b/kernel/cobalt/posix/event.c
index 052c68605..a5fa45db8 100644
--- a/kernel/cobalt/posix/event.c
+++ b/kernel/cobalt/posix/event.c
@@ -190,17 +190,18 @@ out:
 	return ret;
 }
 
-int __cobalt_event_wait64(struct cobalt_event_shadow __user *u_event,
-			  unsigned int bits,
-			  unsigned int __user *u_bits_r,
-			  int mode, const struct __kernel_timespec __user *u_ts)
+COBALT_SYSCALL(event_wait, primary,
+	       (struct cobalt_event_shadow __user *u_event,
+		unsigned int bits,
+		unsigned int __user *u_bits_r,
+		int mode, const struct __user_old_timespec __user *u_ts))
 {
 	struct timespec64 ts, *tsp = NULL;
 	int ret;
 
 	if (u_ts) {
 		tsp = &ts;
-		ret = cobalt_get_timespec64(&ts, u_ts);
+		ret = cobalt_get_u_timespec(&ts, u_ts);
 		if (ret)
 			return ret;
 	}
@@ -208,18 +209,18 @@ int __cobalt_event_wait64(struct cobalt_event_shadow __user *u_event,
 	return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
 }
 
-COBALT_SYSCALL(event_wait, primary,
+COBALT_SYSCALL(event_wait64, primary,
 	       (struct cobalt_event_shadow __user *u_event,
 		unsigned int bits,
 		unsigned int __user *u_bits_r,
-		int mode, const struct __user_old_timespec __user *u_ts))
+		int mode, const struct __kernel_timespec __user *u_ts))
 {
 	struct timespec64 ts, *tsp = NULL;
 	int ret;
 
 	if (u_ts) {
 		tsp = &ts;
-		ret = cobalt_get_u_timespec(&ts, u_ts);
+		ret = cobalt_get_timespec64(&ts, u_ts);
 		if (ret)
 			return ret;
 	}
@@ -227,15 +228,6 @@ COBALT_SYSCALL(event_wait, primary,
 	return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
 }
 
-COBALT_SYSCALL(event_wait64, primary,
-	       (struct cobalt_event_shadow __user *u_event,
-		unsigned int bits,
-		unsigned int __user *u_bits_r,
-		int mode, const struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_event_wait64(u_event, bits, u_bits_r, mode, u_ts);
-}
-
 COBALT_SYSCALL(event_sync, current,
 	       (struct cobalt_event_shadow __user *u_event))
 {
diff --git a/kernel/cobalt/posix/event.h b/kernel/cobalt/posix/event.h
index 919774c9a..a67141f2b 100644
--- a/kernel/cobalt/posix/event.h
+++ b/kernel/cobalt/posix/event.h
@@ -41,11 +41,6 @@ int __cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
 			unsigned int __user *u_bits_r,
 			int mode, const struct timespec64 *ts);
 
-int __cobalt_event_wait64(struct cobalt_event_shadow __user *u_event,
-			  unsigned int bits, unsigned int __user *u_bits_r,
-			  int mode,
-			  const struct __kernel_timespec __user *u_ts);
-
 COBALT_SYSCALL_DECL(event_init,
 		    (struct cobalt_event_shadow __user *u_evtsh,
 		     unsigned int value,
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index dfa4d31ec..97981bda9 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -752,15 +752,6 @@ COBALT_SYSCALL32emu(event_wait, primary,
 	return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
 }
 
-COBALT_SYSCALL32emu(event_wait64, primary,
-		    (struct cobalt_event_shadow __user *u_event,
-		     unsigned int bits,
-		     unsigned int __user *u_bits_r,
-		     int mode, const struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_event_wait64(u_event, bits, u_bits_r, mode, u_ts);
-}
-
 COBALT_SYSCALL32emu(select, primary,
 		    (int nfds,
 		     compat_fd_set __user *u_rfds,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index 973a0befc..c96fa1379 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -201,13 +201,6 @@ COBALT_SYSCALL32emu_DECL(event_wait,
 			  unsigned int __user *u_bits_r,
 			  int mode, const struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(event_wait64,
-			 (struct cobalt_event_shadow __user *u_event,
-			  unsigned int bits,
-			  unsigned int __user *u_bits_r,
-			  int mode,
-			  const struct __kernel_timespec __user *u_ts));
-
 COBALT_SYSCALL32emu_DECL(select,
 			 (int nfds,
 			  compat_fd_set __user *u_rfds,

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 11/17] y2038: cobalt: posix/cond: Remove compat syscall for cond_wait_prologue64
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (9 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 10/17] y2038: cobalt: posix/event: Remove compat syscall for event_wait64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 12/17] y2038: cobalt: Cleanup code style of time.{c,h} Florian Bezdeka
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

There is no difference between the native and the compat entry point,
so let's keep it simple. The native entrypoint is already linked into
the syscall table at the right offset.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/cond.c      | 12 ++----------
 kernel/cobalt/posix/cond.h      |  5 -----
 kernel/cobalt/posix/syscall32.c | 10 ----------
 kernel/cobalt/posix/syscall32.h |  7 -------
 4 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c
index 95d1e75bc..7b87fe908 100644
--- a/kernel/cobalt/posix/cond.c
+++ b/kernel/cobalt/posix/cond.c
@@ -354,15 +354,6 @@ int __cobalt_cond_wait_prologue(struct cobalt_cond_shadow __user *u_cnd,
 	return err == 0 ? perr : err;
 }
 
-int __cobalt_cond_wait_prologue64(struct cobalt_cond_shadow __user *u_cnd,
-				  struct cobalt_mutex_shadow __user *u_mx,
-				  int __user *u_err, unsigned int timed,
-				  void __user *u_ts)
-{
-	return __cobalt_cond_wait_prologue(u_cnd, u_mx, u_err, u_ts,
-					   timed ? cond_fetch_timeout64 : NULL);
-}
-
 /* pthread_cond_wait_prologue(cond, mutex, count_ptr, timed, timeout) */
 COBALT_SYSCALL(cond_wait_prologue, nonrestartable,
 	       (struct cobalt_cond_shadow __user *u_cnd,
@@ -382,7 +373,8 @@ COBALT_SYSCALL(cond_wait_prologue64, nonrestartable,
 		unsigned int timed,
 		struct __kernel_timespec __user *u_ts))
 {
-	return __cobalt_cond_wait_prologue64(u_cnd, u_mx, u_err, timed, u_ts);
+	return __cobalt_cond_wait_prologue(u_cnd, u_mx, u_err, u_ts,
+					   timed ? cond_fetch_timeout64 : NULL);
 }
 
 COBALT_SYSCALL(cond_wait_epilogue, primary,
diff --git a/kernel/cobalt/posix/cond.h b/kernel/cobalt/posix/cond.h
index 1fd4256ce..c2fdd40e0 100644
--- a/kernel/cobalt/posix/cond.h
+++ b/kernel/cobalt/posix/cond.h
@@ -46,11 +46,6 @@ int __cobalt_cond_wait_prologue(struct cobalt_cond_shadow __user *u_cnd,
 				int (*fetch_timeout)(struct timespec64 *ts,
 						     const void __user *u_ts));
 
-int __cobalt_cond_wait_prologue64(struct cobalt_cond_shadow __user *u_cnd,
-				  struct cobalt_mutex_shadow __user *u_mx,
-				  int __user *u_err, unsigned int timed,
-				  void __user *u_ts);
-
 COBALT_SYSCALL_DECL(cond_init,
 		    (struct cobalt_cond_shadow __user *u_cnd,
 		     const struct cobalt_condattr __user *u_attr));
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 97981bda9..10b080dfd 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -236,16 +236,6 @@ COBALT_SYSCALL32emu(cond_wait_prologue, nonrestartable,
 					   timed ? sys32_fetch_timeout : NULL);
 }
 
-COBALT_SYSCALL32emu(cond_wait_prologue64, nonrestartable,
-		    (struct cobalt_cond_shadow __user *u_cnd,
-		     struct cobalt_mutex_shadow __user *u_mx,
-		     int __user *u_err,
-		     unsigned int timed,
-		     struct __kernel_timespec __user *u_ts))
-{
-	return __cobalt_cond_wait_prologue64(u_cnd, u_mx, u_err, timed, u_ts);
-}
-
 COBALT_SYSCALL32emu(mq_open, lostage,
 		    (const char __user *u_name, int oflags,
 		     mode_t mode, struct compat_mq_attr __user *u_attr))
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index c96fa1379..3df6224b7 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -83,13 +83,6 @@ COBALT_SYSCALL32emu_DECL(cond_wait_prologue,
 			  unsigned int timed,
 			  struct old_timespec32 __user *u_ts));
 
-COBALT_SYSCALL32emu_DECL(cond_wait_prologue64,
-			 (struct cobalt_cond_shadow __user *u_cnd,
-			  struct cobalt_mutex_shadow __user *u_mx,
-			  int __user *u_err,
-			  unsigned int timed,
-			  struct __kernel_timespec __user *u_ts));
-
 COBALT_SYSCALL32emu_DECL(mq_open,
 			 (const char __user *u_name, int oflags,
 			  mode_t mode, struct compat_mq_attr __user *u_attr));

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 12/17] y2038: cobalt: Cleanup code style of time.{c,h}
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (10 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 11/17] y2038: cobalt: posix/cond: Remove compat syscall for cond_wait_prologue64 Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 13/17] y2038: posix/mq: Fix mq_timedsend syscall routing Florian Bezdeka
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

No functional changes. Fixing some code style issues.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 include/cobalt/kernel/time.h | 2 +-
 kernel/cobalt/time.c         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/cobalt/kernel/time.h b/include/cobalt/kernel/time.h
index e48022f87..a55398068 100644
--- a/include/cobalt/kernel/time.h
+++ b/include/cobalt/kernel/time.h
@@ -26,6 +26,6 @@ int cobalt_get_timespec64(struct timespec64 *ts,
  * @return 0 on success, -EFAULT otherwise
  */
 int cobalt_put_timespec64(const struct timespec64 *ts,
-			   struct __kernel_timespec __user *uts);
+			  struct __kernel_timespec __user *uts);
 
 #endif //_COBALT_KERNEL_TIME_H
diff --git a/kernel/cobalt/time.c b/kernel/cobalt/time.c
index cb152fc7a..27dbf8290 100644
--- a/kernel/cobalt/time.c
+++ b/kernel/cobalt/time.c
@@ -27,11 +27,11 @@ int cobalt_get_timespec64(struct timespec64 *ts,
 }
 
 int cobalt_put_timespec64(const struct timespec64 *ts,
-		   struct __kernel_timespec __user *uts)
+			  struct __kernel_timespec __user *uts)
 {
 	struct __kernel_timespec kts = {
 		.tv_sec = ts->tv_sec,
-		.tv_nsec = ts->tv_nsec
+		.tv_nsec = ts->tv_nsec,
 	};
 
 	return cobalt_copy_to_user(uts, &kts, sizeof(kts)) ? -EFAULT : 0;

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 13/17] y2038: posix/mq: Fix mq_timedsend syscall routing
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (11 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 12/17] y2038: cobalt: Cleanup code style of time.{c,h} Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 14/17] y2038: posix/mq: Harmonize mq_receive and mq_timedreceive Florian Bezdeka
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

The sc_cobalt_mq_timedsend syscall was used twice, once for the
mq_timedsend service and once for the mq_send service which re-uses the
same cobalt service without supplying a timeout.

The mq_timedsend case - which actually counts y2038 wise - has been
overlooked by Song when introducing y2038 support for some reason.

Both services fall back to the same helper now, so we can handle them
the same way.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/mq.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lib/cobalt/mq.c b/lib/cobalt/mq.c
index a8c88b406..88a74095b 100644
--- a/lib/cobalt/mq.c
+++ b/lib/cobalt/mq.c
@@ -289,6 +289,18 @@ COBALT_IMPL(int, mq_setattr, (mqd_t mqd,
 	return -1;
 }
 
+static inline int __do_mq_timesend(mqd_t q, const char *buffer, size_t len,
+				   unsigned int prio, const struct timespec *to)
+{
+#ifdef __USE_TIME_BITS64
+	long sc_nr = sc_cobalt_mq_timedsend64;
+#else
+	long sc_nr = sc_cobalt_mq_timedsend;
+#endif
+
+	return XENOMAI_SYSCALL5(sc_nr, q, buffer, len, prio, to);
+}
+
 /**
  * Send a message to a message queue.
  *
@@ -332,13 +344,7 @@ COBALT_IMPL(int, mq_send, (mqd_t q, const char *buffer, size_t len, unsigned pri
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
 
-#ifdef __USE_TIME_BITS64
-	err = XENOMAI_SYSCALL5(sc_cobalt_mq_timedsend64,
-			       q, buffer, len, prio, NULL);
-#else
-	err = XENOMAI_SYSCALL5(sc_cobalt_mq_timedsend,
-			       q, buffer, len, prio, NULL);
-#endif
+	err = __do_mq_timesend(q, buffer, len, prio, NULL);
 
 	pthread_setcanceltype(oldtype, NULL);
 
@@ -397,8 +403,7 @@ COBALT_IMPL(int, mq_timedsend, (mqd_t q,
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
 
-	err = XENOMAI_SYSCALL5(sc_cobalt_mq_timedsend,
-			       q, buffer, len, prio, timeout);
+	err = __do_mq_timesend(q, buffer, len, prio, timeout);
 
 	pthread_setcanceltype(oldtype, NULL);
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 14/17] y2038: posix/mq: Harmonize mq_receive and mq_timedreceive
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (12 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 13/17] y2038: posix/mq: Fix mq_timedsend syscall routing Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 15/17] y2038: testsuite/smokey/y2038: Fix a very unlikely resource leak Florian Bezdeka
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

Let both callers of the cobalt_mq_timedcreceive service care about
y2038 safety. The old code was correct but confusing. The mq_receive
service is not y2038 affected because it does not forward a timeout,
but it still calls the same service.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/mq.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/cobalt/mq.c b/lib/cobalt/mq.c
index 88a74095b..365a28e7a 100644
--- a/lib/cobalt/mq.c
+++ b/lib/cobalt/mq.c
@@ -414,6 +414,19 @@ COBALT_IMPL(int, mq_timedsend, (mqd_t q,
 	return -1;
 }
 
+static inline int __do_mq_timedreceive(mqd_t q, char *buffer, ssize_t *len,
+				       unsigned int *prio,
+				       const struct timespec *timeout)
+{
+#ifdef __USE_TIME_BITS64
+	long sc_nr = sc_cobalt_mq_timedreceive64;
+#else
+	long sc_nr = sc_cobalt_mq_timedreceive;
+#endif
+
+	return XENOMAI_SYSCALL5(sc_nr, q, buffer, len, prio, timeout);
+}
+
 /**
  * Receive a message from a message queue.
  *
@@ -461,8 +474,7 @@ COBALT_IMPL(ssize_t, mq_receive, (mqd_t q, char *buffer, size_t len, unsigned *p
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
 
-	err = XENOMAI_SYSCALL5(sc_cobalt_mq_timedreceive,
-			       q, buffer, &rlen, prio, NULL);
+	err = __do_mq_timedreceive(q, buffer, &rlen, prio, NULL);
 
 	pthread_setcanceltype(oldtype, NULL);
 
@@ -526,13 +538,7 @@ COBALT_IMPL(ssize_t, mq_timedreceive, (mqd_t q,
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
 
-#ifdef __USE_TIME_BITS64
-	err = XENOMAI_SYSCALL5(sc_cobalt_mq_timedreceive64,
-			       q, buffer, &rlen, prio, timeout);
-#else
-	err = XENOMAI_SYSCALL5(sc_cobalt_mq_timedreceive,
-			       q, buffer, &rlen, prio, timeout);
-#endif
+	err = __do_mq_timedreceive(q, buffer, &rlen, prio, timeout);
 
 	pthread_setcanceltype(oldtype, NULL);
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 15/17] y2038: testsuite/smokey/y2038: Fix a very unlikely resource leak
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (13 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 14/17] y2038: posix/mq: Harmonize mq_receive and mq_timedreceive Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 16/17] y2038: cobalt/posix/clock: Use timespec64_valid() for validation Florian Bezdeka
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

In case we had no kernel support for the cond_wait_prologue64 service
we would leak some thread resources. Fixed now.

While at it: Adding the "64" suffix to the test name. All other tests
have it as well.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 testsuite/smokey/y2038/syscall-tests.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
index b1abec260..ef8c72225 100644
--- a/testsuite/smokey/y2038/syscall-tests.c
+++ b/testsuite/smokey/y2038/syscall-tests.c
@@ -1117,7 +1117,7 @@ out:
 	return ret;
 }
 
-static int test_sc_cobalt_cond_wait_prologue(void)
+static int test_sc_cobalt_cond_wait_prologue64(void)
 {
 	int ret = 0;
 	int err = 0;
@@ -1142,7 +1142,8 @@ static int test_sc_cobalt_cond_wait_prologue(void)
 	if (ret == -ENOSYS) {
 		smokey_note(
 			"cond_wait_prologue64: skipped. (no kernel support)");
-		return 0; // Not implemented, nothing to test, success
+		ret = 0;
+		goto out; // Not implemented, nothing to test, success
 	}
 	if (!smokey_assert(ret == -EINVAL))
 		return ret ? ret : -EINVAL;
@@ -1296,7 +1297,7 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 	if (ret)
 		return ret;
 
-	ret = test_sc_cobalt_cond_wait_prologue();
+	ret = test_sc_cobalt_cond_wait_prologue64();
 	if (ret)
 		return ret;
 

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 16/17] y2038: cobalt/posix/clock: Use timespec64_valid() for validation
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (14 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 15/17] y2038: testsuite/smokey/y2038: Fix a very unlikely resource leak Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05  7:21 ` [PATCH 17/17] y2038: Prepare code base for 64bit time_t Florian Bezdeka
  2023-05-05 21:20 ` [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Jan Kiszka
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

No need to re-code the timespec validation, we can just use the
available helper.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 kernel/cobalt/posix/clock.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 266ccef52..48cd87aef 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -286,10 +286,7 @@ int __cobalt_clock_nanosleep(clockid_t clock_id, int flags,
 	    clock_id != CLOCK_REALTIME)
 		return -EOPNOTSUPP;
 
-	if (rqt->tv_sec < 0)
-		return -EINVAL;
-
-	if ((unsigned long)rqt->tv_nsec >= ONE_BILLION)
+	if (!timespec64_valid(rqt))
 		return -EINVAL;
 
 	if (flags & ~TIMER_ABSTIME)

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 17/17] y2038: Prepare code base for 64bit time_t
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (15 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 16/17] y2038: cobalt/posix/clock: Use timespec64_valid() for validation Florian Bezdeka
@ 2023-05-05  7:21 ` Florian Bezdeka
  2023-05-05 21:20 ` [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Jan Kiszka
  17 siblings, 0 replies; 19+ messages in thread
From: Florian Bezdeka @ 2023-05-05  7:21 UTC (permalink / raw)
  To: xenomai, jan.kiszka; +Cc: Florian Bezdeka

Compiling the Xenomai code base with CFLAGS set to
"-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" - which is the requirement for
y2038 safety on 32 bit platforms - failed. We had some problems with
printf format specifiers which are now too small when time_t is lifted
to 64 bit.

Casting to (long long) should do it on all platforms we support.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 demo/alchemy/altency.c      | 26 +++++++++++++-------------
 testsuite/latency/latency.c | 34 ++++++++++++++++++----------------
 testsuite/spitest/spitest.c |  6 ++++--
 3 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/demo/alchemy/altency.c b/demo/alchemy/altency.c
index e7c31d7c1..b15930567 100644
--- a/demo/alchemy/altency.c
+++ b/demo/alchemy/altency.c
@@ -258,12 +258,12 @@ static void display(void *cookie)
 				time_t now, dt;
 				time(&now);
 				dt = now - start - WARMUP_TIME;
-				printf
-				    ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
-				     "priority %d)\n", dt / 3600,
-				     (dt / 60) % 60, dt % 60,
-				     test_mode_names[test_mode],
-				     period_ns / 1000, priority);
+				printf("RTT|  %.2lld:%.2lld:%.2lld  (%s, %lld us period, priority %d)\n",
+				       (long long)(dt / 3600),
+				       (long long)((dt / 60) % 60),
+				       (long long)(dt % 60),
+				       test_mode_names[test_mode],
+				       period_ns / 1000, priority);
 				printf("RTH|%11s|%11s|%11s|%8s|%6s|%11s|%11s\n",
 				       "----lat min", "----lat avg",
 				       "----lat max", "-overrun", "---msw",
@@ -413,13 +413,13 @@ static void cleanup(void)
 	if (!test_duration)
 		test_duration = actual_duration;
 
-	printf
-	    ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
-	     (double)gminj / 1000, (double)gavgj / 1000, (double)gmaxj / 1000,
-	     goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
-	     actual_duration % 60, test_duration / 3600,
-	     (test_duration / 60) % 60, test_duration % 60);
+	printf("---|-----------|-----------|-----------|--------|------|-------------------------\n"
+	       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2lld:%.2lld:%.2lld/%.2d:%.2d:%.2d\n",
+	       (double)gminj / 1000, (double)gavgj / 1000, (double)gmaxj / 1000,
+	       goverrun, max_relaxed, (long long)(actual_duration / 3600),
+	       (long long)((actual_duration / 60) % 60),
+	       (long long)(actual_duration % 60), test_duration / 3600,
+	       (test_duration / 60) % 60, test_duration % 60);
 	if (max_relaxed > 0)
 		printf(
 "Warning! some latency peaks may have been due to involuntary mode switches.\n"
diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index 6cd3a28b4..7856b48b8 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -322,12 +322,12 @@ static void *display(void *cookie)
 				time_t now, dt;
 				time(&now);
 				dt = now - start - WARMUP_TIME;
-				printf
-				    ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
-				     "priority %d)\n", dt / 3600,
-				     (dt / 60) % 60, dt % 60,
-				     test_mode_names[test_mode],
-				     period_ns / 1000, priority);
+				printf("RTT|  %.2lld:%.2lld:%.2lld  (%s, %lld us period, priority %d)\n",
+				       (long long)(dt / 3600),
+				       (long long)((dt / 60) % 60),
+				       (long long)(dt % 60),
+				       test_mode_names[test_mode],
+				       period_ns / 1000, priority);
 				printf("RTH|%11s|%11s|%11s|%8s|%6s|%11s|%11s\n",
 				       "----lat min", "----lat avg",
 				       "----lat max", "-overrun", "---msw",
@@ -386,9 +386,10 @@ static void dump_histo_gnuplot(int32_t *histogram, time_t duration)
 			return;
 	}
 
-	fprintf(ofp, "# %.2ld:%.2ld:%.2ld (%s, %Ld us period, priority %d)\n",
-		duration / 3600, (duration / 60) % 60, duration % 60,
-		test_mode_names[test_mode],
+	fprintf(ofp,
+		"# %.2lld:%.2lld:%.2lld (%s, %lld us period, priority %d)\n",
+		(long long)duration / 3600, (long long)((duration / 60) % 60),
+		(long long)(duration % 60), test_mode_names[test_mode],
 		period_ns / 1000, priority);
 	fprintf(ofp, "# %11s|%11s|%11s|%8s|%6s|\n",
 		"----lat min", "----lat avg",
@@ -515,13 +516,14 @@ static void cleanup(void)
 	if (need_histo())
 		dump_hist_stats(actual_duration);
 
-	printf
-	    ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
-	     (double)gminjitter / 1000, (double)gavgjitter / 1000, (double)gmaxjitter / 1000,
-	     goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
-	     actual_duration % 60, test_duration / 3600,
-	     (test_duration / 60) % 60, test_duration % 60);
+	printf("---|-----------|-----------|-----------|--------|------|-------------------------\n"
+	       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2lld:%.2lld:%.2lld/%.2d:%.2d:%.2d\n",
+	       (double)gminjitter / 1000, (double)gavgjitter / 1000,
+	       (double)gmaxjitter / 1000, goverrun, max_relaxed,
+	       (long long)(actual_duration / 3600),
+	       (long long)((actual_duration / 60) % 60),
+	       (long long)(actual_duration % 60), test_duration / 3600,
+	       (test_duration / 60) % 60, test_duration % 60);
 	if (max_relaxed > 0)
 		printf(
 "Warning! some latency peaks may have been due to involuntary mode switches.\n"
diff --git a/testsuite/spitest/spitest.c b/testsuite/spitest/spitest.c
index 6163e54bf..99d609403 100644
--- a/testsuite/spitest/spitest.c
+++ b/testsuite/spitest/spitest.c
@@ -233,8 +233,10 @@ static void *display_thread(void *arg)
 		if (data_lines && (n++ % data_lines) == 0) {
 			time(&now);
 			dt = now - start;
-			printf("RTT|  %.2ld:%.2ld:%.2ld  (%Ld us period)\n",
-			       dt / 3600, (dt / 60) % 60, dt % 60,
+			printf("RTT|  %.2lld:%.2lld:%.2lld  (%lld us period)\n",
+			       (long long)(dt / 3600),
+			       (long long)((dt / 60) % 60),
+			       (long long)(dt % 60),
 			       (long long)period_ns / 1000);
 			printf("RTH|%11s|%11s|%11s|%8s|%8s|%11s|%11s\n",
 			       "----lat min", "----lat avg",

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation
  2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
                   ` (16 preceding siblings ...)
  2023-05-05  7:21 ` [PATCH 17/17] y2038: Prepare code base for 64bit time_t Florian Bezdeka
@ 2023-05-05 21:20 ` Jan Kiszka
  17 siblings, 0 replies; 19+ messages in thread
From: Jan Kiszka @ 2023-05-05 21:20 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai

On 05.05.23 09:20, Florian Bezdeka wrote:
> Hi all,
> 
> I'm trying to bring the remaining patches from my y2038 queue into Xenomai 
> next/master branches. The full queue [1] holds ~40 patches. I'm trying to 
> split that up to keep reviewing efforts low.
> 
> Part one of this series:
> Basically removing some unnecessary compat syscalls. While initally evolving 
> a pattern that we followed for all the necessary syscalls we overlooked an 
> existing compat mechanism, so we accidentially implemented to much.
> 
> Part two of this series:
> Minor refactorings, fixes and preparations for 64 bit time_t.
> 
> Best regards,
> Florian
> 
> [1] https://gitlab.com/Xenomai/xenomai-hacker-space/-/tree/florian/y2038
> 
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
> Florian Bezdeka (17):
>       y2038: cobalt: posix/sem: Remove compat syscall for sem_timedwait64
>       y2038: cobalt: posix/clock: Remove compat syscall for clock_gettime64
>       y2038: cobalt: posix/clock: Remove compat syscall for clock_settime64
>       y2038: cobalt: posix/clock: Remove compat syscall for clock_nanosleep64
>       y2038: cobalt: posix/clock: Remove compat syscall for clock_getres64
>       y2038: cobalt: posix/clock: Remove compat syscall for clock_adjtime64
>       y2038: cobalt: posix/mutex: Remove compat syscall for mutex_timedlock64
>       y2038: cobalt: posix/mqueue: Remove compat syscall for mq_timedsend64
>       y2038: cobalt: posix/monitor: Remove compat syscall for monitor_wait64
>       y2038: cobalt: posix/event: Remove compat syscall for event_wait64
>       y2038: cobalt: posix/cond: Remove compat syscall for cond_wait_prologue64
>       y2038: cobalt: Cleanup code style of time.{c,h}
>       y2038: posix/mq: Fix mq_timedsend syscall routing
>       y2038: posix/mq: Harmonize mq_receive and mq_timedreceive
>       y2038: testsuite/smokey/y2038: Fix a very unlikely resource leak
>       y2038: cobalt/posix/clock: Use timespec64_valid() for validation
>       y2038: Prepare code base for 64bit time_t
> 
>  demo/alchemy/altency.c                 | 26 +++++-----
>  include/cobalt/kernel/time.h           |  2 +-
>  kernel/cobalt/posix/clock.c            | 59 +++++------------------
>  kernel/cobalt/posix/clock.h            | 16 -------
>  kernel/cobalt/posix/cond.c             | 12 +----
>  kernel/cobalt/posix/cond.h             |  5 --
>  kernel/cobalt/posix/event.c            | 26 ++++------
>  kernel/cobalt/posix/event.h            |  5 --
>  kernel/cobalt/posix/monitor.c          | 26 ++++------
>  kernel/cobalt/posix/monitor.h          |  5 --
>  kernel/cobalt/posix/mqueue.c           | 10 +---
>  kernel/cobalt/posix/mqueue.h           |  3 --
>  kernel/cobalt/posix/mutex.c            | 10 +---
>  kernel/cobalt/posix/mutex.h            |  3 --
>  kernel/cobalt/posix/sem.c              | 22 ++++-----
>  kernel/cobalt/posix/sem.h              |  3 --
>  kernel/cobalt/posix/syscall32.c        | 86 ----------------------------------
>  kernel/cobalt/posix/syscall32.h        | 55 ----------------------
>  kernel/cobalt/time.c                   |  4 +-
>  lib/cobalt/mq.c                        | 47 ++++++++++++-------
>  testsuite/latency/latency.c            | 34 +++++++-------
>  testsuite/smokey/y2038/syscall-tests.c |  7 +--
>  testsuite/spitest/spitest.c            |  6 ++-
>  23 files changed, 116 insertions(+), 356 deletions(-)
> ---
> base-commit: 967cff01b071f2799db1de4d088c396a40a074b6
> change-id: 20230428-florian-y2038-part-one-713ed4f37308
> 
> Best regards,

Thanks, applied.

Jan
-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-05-05 21:20 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05  7:20 [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Florian Bezdeka
2023-05-05  7:20 ` [PATCH 01/17] y2038: cobalt: posix/sem: Remove compat syscall for sem_timedwait64 Florian Bezdeka
2023-05-05  7:20 ` [PATCH 02/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_gettime64 Florian Bezdeka
2023-05-05  7:20 ` [PATCH 03/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_settime64 Florian Bezdeka
2023-05-05  7:20 ` [PATCH 04/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_nanosleep64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 05/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_getres64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 06/17] y2038: cobalt: posix/clock: Remove compat syscall for clock_adjtime64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 07/17] y2038: cobalt: posix/mutex: Remove compat syscall for mutex_timedlock64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 08/17] y2038: cobalt: posix/mqueue: Remove compat syscall for mq_timedsend64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 09/17] y2038: cobalt: posix/monitor: Remove compat syscall for monitor_wait64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 10/17] y2038: cobalt: posix/event: Remove compat syscall for event_wait64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 11/17] y2038: cobalt: posix/cond: Remove compat syscall for cond_wait_prologue64 Florian Bezdeka
2023-05-05  7:21 ` [PATCH 12/17] y2038: cobalt: Cleanup code style of time.{c,h} Florian Bezdeka
2023-05-05  7:21 ` [PATCH 13/17] y2038: posix/mq: Fix mq_timedsend syscall routing Florian Bezdeka
2023-05-05  7:21 ` [PATCH 14/17] y2038: posix/mq: Harmonize mq_receive and mq_timedreceive Florian Bezdeka
2023-05-05  7:21 ` [PATCH 15/17] y2038: testsuite/smokey/y2038: Fix a very unlikely resource leak Florian Bezdeka
2023-05-05  7:21 ` [PATCH 16/17] y2038: cobalt/posix/clock: Use timespec64_valid() for validation Florian Bezdeka
2023-05-05  7:21 ` [PATCH 17/17] y2038: Prepare code base for 64bit time_t Florian Bezdeka
2023-05-05 21:20 ` [PATCH 00/17] y2038: Part one - Cleanup existing implementation + general preparation Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).