Skip to contentSkip to conversation

y2038: lib/cobalt: Fix __STD() macro usage for some services

PATCH In review Florian Bezdeka 2 participants 5 messages Oct 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 y2038: lib/cobalt: Fix __STD() macro usage for some services

The macro usage was broken for the following services:
- recvmmsg
- mq_timedsend
- mq_timedreceive

The message queue services were forwarded to wrong libc functions, the recvmmsg was missing the correct routing.

Detected while trying to remove the function wrapping at all.

---
 include/cobalt/mqueue.h     | 4 ++--
 include/cobalt/sys/socket.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
include/cobalt/mqueue.h +2 -2
index 89d4bff79..9fd502c04 100644
@@ -42,14 +42,14 @@ COBALT_DECL(int, mq_setattr,
 COBALT_DECL(int, mq_send,
 	    (mqd_t qd, const char *buffer, size_t len, unsigned prio));
 
-COBALT_DECL_TIME64(int, mq_timedsend, __mq_timedsend64,
+COBALT_DECL_TIME64(int, mq_timedsend, __mq_timedsend_time64,
 		   (mqd_t q, const char *buffer, size_t len, unsigned prio,
 		    const struct timespec *timeout));
 
 COBALT_DECL(ssize_t, mq_receive,
 	    (mqd_t q, char *buffer, size_t len, unsigned *prio));
 
-COBALT_DECL_TIME64(ssize_t, mq_timedreceive, __mq_timedsend_time64,
+COBALT_DECL_TIME64(ssize_t, mq_timedreceive, __mq_timedreceive_time64,
 	    (mqd_t q, char *__restrict__ buffer, size_t len,
 	     unsigned *__restrict__ prio,
 	     const struct timespec *__restrict__ timeout));
include/cobalt/sys/socket.h +3 -3
index d5e81e5bd..9095594c6 100644
@@ -31,9 +31,9 @@ COBALT_DECL(int, socket, (int protocol_family, int socket_type, int protocol));
 
 COBALT_DECL(ssize_t, recvmsg, (int fd, struct msghdr *msg, int flags));
 
-COBALT_DECL(int, recvmmsg,
-	    (int fd, struct mmsghdr *msgvec, unsigned int vlen,
-	     unsigned int flags, struct timespec *timeout));
+COBALT_DECL_TIME64(int, recvmmsg, __recvmmsg64,
+		   (int fd, struct mmsghdr *msgvec, unsigned int vlen,
+		    unsigned int flags, struct timespec *timeout));
 
 COBALT_DECL(ssize_t, sendmsg, (int fd, const struct msghdr *msg, int flags));
 
Signature · 1 line
2.39.5
#1 lore raw
Quoted 10 lines · Florian Bezdeka

The macro usage was broken for the following services:
- recvmmsg
- mq_timedsend
- mq_timedreceive

The message queue services were forwarded to wrong libc functions, the recvmmsg was missing the correct routing.

Detected while trying to remove the function wrapping at all.

Can you elaborate a bit on the visible impact for users? And it affects 3.3 only?

Jan

Quoted 44 lines
---
 include/cobalt/mqueue.h     | 4 ++--
 include/cobalt/sys/socket.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
include/cobalt/mqueue.h +2 -2
index 89d4bff79..9fd502c04 100644
@@ -42,14 +42,14 @@ COBALT_DECL(int, mq_setattr,
 COBALT_DECL(int, mq_send,
 	    (mqd_t qd, const char *buffer, size_t len, unsigned prio));
 
-COBALT_DECL_TIME64(int, mq_timedsend, __mq_timedsend64,
+COBALT_DECL_TIME64(int, mq_timedsend, __mq_timedsend_time64,
 		   (mqd_t q, const char *buffer, size_t len, unsigned prio,
 		    const struct timespec *timeout));
 
 COBALT_DECL(ssize_t, mq_receive,
 	    (mqd_t q, char *buffer, size_t len, unsigned *prio));
 
-COBALT_DECL_TIME64(ssize_t, mq_timedreceive, __mq_timedsend_time64,
+COBALT_DECL_TIME64(ssize_t, mq_timedreceive, __mq_timedreceive_time64,
 	    (mqd_t q, char *__restrict__ buffer, size_t len,
 	     unsigned *__restrict__ prio,
 	     const struct timespec *__restrict__ timeout));
include/cobalt/sys/socket.h +3 -3
index d5e81e5bd..9095594c6 100644
@@ -31,9 +31,9 @@ COBALT_DECL(int, socket, (int protocol_family, int socket_type, int protocol));
 
 COBALT_DECL(ssize_t, recvmsg, (int fd, struct msghdr *msg, int flags));
 
-COBALT_DECL(int, recvmmsg,
-	    (int fd, struct mmsghdr *msgvec, unsigned int vlen,
-	     unsigned int flags, struct timespec *timeout));
+COBALT_DECL_TIME64(int, recvmmsg, __recvmmsg64,
+		   (int fd, struct mmsghdr *msgvec, unsigned int vlen,
+		    unsigned int flags, struct timespec *timeout));
 
 COBALT_DECL(ssize_t, sendmsg, (int fd, const struct msghdr *msg, int flags));
 
Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#2 lore raw
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Florian Bezdeka

The macro usage was broken for the following services:
- recvmmsg
- mq_timedsend
- mq_timedreceive

Quoted 8 lines
Quoted 5 lines

The message queue services were forwarded to wrong libc functions, the recvmmsg was missing the correct routing.

Detected while trying to remove the function wrapping at all.

Can you elaborate a bit on the visible impact for users? And it affects 3.3 only?

Yes, this is 3.3 only.

Something like __STD(recvmmsg()) had not the desired effect on compat applications with y2038 support enabled - which is the default for compat applications now.

Rare use case but still relevant I would say.

Florian

Quoted 51 lines

Jan

Quoted 44 lines
---
 include/cobalt/mqueue.h     | 4 ++--
 include/cobalt/sys/socket.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
include/cobalt/mqueue.h +2 -2
index 89d4bff79..9fd502c04 100644
@@ -42,14 +42,14 @@ COBALT_DECL(int, mq_setattr,
 COBALT_DECL(int, mq_send,
 	    (mqd_t qd, const char *buffer, size_t len, unsigned prio));
 
-COBALT_DECL_TIME64(int, mq_timedsend, __mq_timedsend64,
+COBALT_DECL_TIME64(int, mq_timedsend, __mq_timedsend_time64,
 		   (mqd_t q, const char *buffer, size_t len, unsigned prio,
 		    const struct timespec *timeout));
 
 COBALT_DECL(ssize_t, mq_receive,
 	    (mqd_t q, char *buffer, size_t len, unsigned *prio));
 
-COBALT_DECL_TIME64(ssize_t, mq_timedreceive, __mq_timedsend_time64,
+COBALT_DECL_TIME64(ssize_t, mq_timedreceive, __mq_timedreceive_time64,
 	    (mqd_t q, char *__restrict__ buffer, size_t len,
 	     unsigned *__restrict__ prio,
 	     const struct timespec *__restrict__ timeout));
include/cobalt/sys/socket.h +3 -3
index d5e81e5bd..9095594c6 100644
@@ -31,9 +31,9 @@ COBALT_DECL(int, socket, (int protocol_family, int socket_type, int protocol));
 
 COBALT_DECL(ssize_t, recvmsg, (int fd, struct msghdr *msg, int flags));
 
-COBALT_DECL(int, recvmmsg,
-	    (int fd, struct mmsghdr *msgvec, unsigned int vlen,
-	     unsigned int flags, struct timespec *timeout));
+COBALT_DECL_TIME64(int, recvmmsg, __recvmmsg64,
+		   (int fd, struct mmsghdr *msgvec, unsigned int vlen,
+		    unsigned int flags, struct timespec *timeout));
 
 COBALT_DECL(ssize_t, sendmsg, (int fd, const struct msghdr *msg, int flags));
 
Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#3 lore raw
Quoted 16 lines · Florian Bezdeka
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Florian Bezdeka

The macro usage was broken for the following services:
- recvmmsg
- mq_timedsend
- mq_timedreceive

Quoted 8 lines
Quoted 5 lines

The message queue services were forwarded to wrong libc functions, the recvmmsg was missing the correct routing.

Detected while trying to remove the function wrapping at all.

Can you elaborate a bit on the visible impact for users? And it affects 3.3 only?

Quoted 8 lines

Yes, this is 3.3 only.

Something like __STD(recvmmsg()) had not the desired effect on compat applications with y2038 support enabled - which is the default for compat applications now.

Rare use case but still relevant I would say.

So, I wrote "The __STD macro usage was broken..." in the commit message while merging.

Thanks,
Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#4 lore raw
Quoted 23 lines · Jan Kiszka
Quoted 22 lines · Florian Bezdeka
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Florian Bezdeka

The macro usage was broken for the following services:
- recvmmsg
- mq_timedsend
- mq_timedreceive

Quoted 8 lines
Quoted 5 lines

The message queue services were forwarded to wrong libc functions, the recvmmsg was missing the correct routing.

Detected while trying to remove the function wrapping at all.

Can you elaborate a bit on the visible impact for users? And it affects 3.3 only?

Yes, this is 3.3 only.

Something like __STD(recvmmsg()) had not the desired effect on compat applications with y2038 support enabled - which is the default for compat applications now.

Quoted 6 lines
Quoted 2 lines

Rare use case but still relevant I would say.

So, I wrote "The __STD macro usage was broken..." in the commit message while merging.

...which was already mentioned in the subject - missed that.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center