Blob Blame History Raw
From af1e2888699afc985d7f354b875c517531dff4ea Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Sat, 12 Sep 2020 08:00:00 +0000
Subject: [PATCH 157/162] tests/ipc_msg.c: disable TEST_MSGCTL_BOGUS_ADDR on
 glibc >= 2.32

Starting with commit glibc-2.32~83, on every 32-bit architecture where
32-bit time_t support is enabled, glibc tries to retrieve the data
provided in the third argument of msgctl call.  This results to
segfaults inside glibc if TEST_MSGCTL_BOGUS_ADDR is enabled.

* tests/ipc_msg.c [GLIBC_PREREQ_GE(2, 32) && __TIMESIZE != 64]
(TEST_MSGCTL_BOGUS_ADDR): Define to 0.

Reported-by: Ruinland ChuanTzu Tsai <ruinland@andestech.com>
---
 tests/ipc_msg.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
index dd0f303..3ab8b90 100644
--- a/tests/ipc_msg.c
+++ b/tests/ipc_msg.c
@@ -20,12 +20,21 @@
 # define MSG_STAT_ANY 13
 #endif
 
+#undef TEST_MSGCTL_BOGUS_ADDR
+
+/*
+ * Starting with commit glibc-2.32~83, on every 32-bit architecture
+ * where 32-bit time_t support is enabled, glibc tries to retrieve
+ * the data provided in the third argument of msgctl call.
+ */
+#if GLIBC_PREREQ_GE(2, 32) && defined __TIMESIZE && __TIMESIZE != 64
+# define TEST_MSGCTL_BOGUS_ADDR 0
+#endif
 /*
  * Before glibc-2.22-122-gbe48165, ppc64 code tried to retrieve data
  * provided in third argument of msgctl call (in case of IPC_SET cmd)
  * which led to segmentation fault.
  */
-#undef TEST_MSGCTL_BOGUS_ADDR
 #if GLIBC_PREREQ_LT(2, 23) && (defined POWERPC64 || defined POWERPC64LE)
 # define TEST_MSGCTL_BOGUS_ADDR 0
 #endif
diff --git a/tests-m32/ipc_msg.c b/tests-m32/ipc_msg.c
index dd0f303..3ab8b90 100644
--- a/tests-m32/ipc_msg.c
+++ b/tests-m32/ipc_msg.c
@@ -20,12 +20,21 @@
 # define MSG_STAT_ANY 13
 #endif
 
+#undef TEST_MSGCTL_BOGUS_ADDR
+
+/*
+ * Starting with commit glibc-2.32~83, on every 32-bit architecture
+ * where 32-bit time_t support is enabled, glibc tries to retrieve
+ * the data provided in the third argument of msgctl call.
+ */
+#if GLIBC_PREREQ_GE(2, 32) && defined __TIMESIZE && __TIMESIZE != 64
+# define TEST_MSGCTL_BOGUS_ADDR 0
+#endif
 /*
  * Before glibc-2.22-122-gbe48165, ppc64 code tried to retrieve data
  * provided in third argument of msgctl call (in case of IPC_SET cmd)
  * which led to segmentation fault.
  */
-#undef TEST_MSGCTL_BOGUS_ADDR
 #if GLIBC_PREREQ_LT(2, 23) && (defined POWERPC64 || defined POWERPC64LE)
 # define TEST_MSGCTL_BOGUS_ADDR 0
 #endif
diff --git a/tests-mx32/ipc_msg.c b/tests-mx32/ipc_msg.c
index dd0f303..3ab8b90 100644
--- a/tests-mx32/ipc_msg.c
+++ b/tests-mx32/ipc_msg.c
@@ -20,12 +20,21 @@
 # define MSG_STAT_ANY 13
 #endif
 
+#undef TEST_MSGCTL_BOGUS_ADDR
+
+/*
+ * Starting with commit glibc-2.32~83, on every 32-bit architecture
+ * where 32-bit time_t support is enabled, glibc tries to retrieve
+ * the data provided in the third argument of msgctl call.
+ */
+#if GLIBC_PREREQ_GE(2, 32) && defined __TIMESIZE && __TIMESIZE != 64
+# define TEST_MSGCTL_BOGUS_ADDR 0
+#endif
 /*
  * Before glibc-2.22-122-gbe48165, ppc64 code tried to retrieve data
  * provided in third argument of msgctl call (in case of IPC_SET cmd)
  * which led to segmentation fault.
  */
-#undef TEST_MSGCTL_BOGUS_ADDR
 #if GLIBC_PREREQ_LT(2, 23) && (defined POWERPC64 || defined POWERPC64LE)
 # define TEST_MSGCTL_BOGUS_ADDR 0
 #endif
-- 
2.1.4