Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20261030200430.239535-1-alex@alexrp.com>
Date: Fri, 30 Oct 2026 21:04:30 +0100
From: Alex Rønne Petersen <alex@...xrp.com>
To: musl@...ts.openwall.com
Cc: Alex Rønne Petersen <alex@...xrp.com>
Subject: [PATCH] x32: fix offsets of si_{u,s}time in siginfo_t

As a general rule, clock_t is a long, but the x32 kABI is the singular
exception where it's a long long. musl always makes clock_t a long, even
on x32, which means that the offsets of the si_{u,s}time fields in
siginfo_t were incorrect.

Rather than change clock_t, this commit fixes the bug by inserting a
couple of padding fields (which are really the high parts of the values).
---
 arch/x32/bits/signal.h | 2 ++
 include/signal.h       | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x32/bits/signal.h b/arch/x32/bits/signal.h
index 097be6f4..bae7873a 100644
--- a/arch/x32/bits/signal.h
+++ b/arch/x32/bits/signal.h
@@ -112,6 +112,8 @@ typedef struct __ucontext {
 #define SA_RESETHAND  0x80000000
 #define SA_RESTORER   0x04000000
 
+#define __SI_CLOCK_PAD
+
 #endif
 
 #define SIGHUP    1
diff --git a/include/signal.h b/include/signal.h
index c347f861..a3cd8c08 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -119,7 +119,14 @@ typedef struct {
 				union sigval si_value;
 				struct {
 					int si_status;
-					clock_t si_utime, si_stime;
+					clock_t si_utime;
+#ifdef __SI_CLOCK_PAD
+					long __si_utime_pad;
+#endif
+					clock_t si_stime;
+#ifdef __SI_CLOCK_PAD
+					long __si_stime_pad;
+#endif
 				} __sigchld;
 			} __second;
 		} __si_common;
-- 
2.53.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.