From b4623939316807928680913ece9a6cefc23a73b2 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Tue, 10 Nov 2020 08:00:00 +0000
Subject: [PATCH 158/162] tests: disable TEST_MSGCTL_BOGUS_ADDR in ipc_msg test
on glibc >= 2.31
Starting with commit glibc-2.31~358, on every architecture where
__ASSUME_SYSVIPC_BROKEN_MODE_T is defined, glibc tries to modify 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, 31) && (__m68k__ || __s390__ ||
(WORDS_BIGENDIAN && (__arm__ || __microblaze__ || __sh__)))]
(TEST_MSGCTL_BOGUS_ADDR): Define to 0.
Reported-by: Sven Schnelle <svens@linux.ibm.com>
---
tests/ipc_msg.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
index 3ab8b90..f7c36cd 100644
--- a/tests/ipc_msg.c
+++ b/tests/ipc_msg.c
@@ -31,6 +31,17 @@
# define TEST_MSGCTL_BOGUS_ADDR 0
#endif
/*
+ * Starting with commit glibc-2.31~358, on every architecture where
+ * __ASSUME_SYSVIPC_BROKEN_MODE_T is defined, glibc tries to modify
+ * the data provided in the third argument of msgctl call.
+ */
+#if GLIBC_PREREQ_GE(2, 31) && \
+ (defined __m68k__ || defined __s390__ || \
+ (WORDS_BIGENDIAN && \
+ (defined __arm__ || defined __microblaze__ || defined __sh__)))
+# 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.
diff --git a/tests-m32/ipc_msg.c b/tests-m32/ipc_msg.c
index 3ab8b90..f7c36cd 100644
--- a/tests-m32/ipc_msg.c
+++ b/tests-m32/ipc_msg.c
@@ -31,6 +31,17 @@
# define TEST_MSGCTL_BOGUS_ADDR 0
#endif
/*
+ * Starting with commit glibc-2.31~358, on every architecture where
+ * __ASSUME_SYSVIPC_BROKEN_MODE_T is defined, glibc tries to modify
+ * the data provided in the third argument of msgctl call.
+ */
+#if GLIBC_PREREQ_GE(2, 31) && \
+ (defined __m68k__ || defined __s390__ || \
+ (WORDS_BIGENDIAN && \
+ (defined __arm__ || defined __microblaze__ || defined __sh__)))
+# 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.
diff --git a/tests-mx32/ipc_msg.c b/tests-mx32/ipc_msg.c
index 3ab8b90..f7c36cd 100644
--- a/tests-mx32/ipc_msg.c
+++ b/tests-mx32/ipc_msg.c
@@ -31,6 +31,17 @@
# define TEST_MSGCTL_BOGUS_ADDR 0
#endif
/*
+ * Starting with commit glibc-2.31~358, on every architecture where
+ * __ASSUME_SYSVIPC_BROKEN_MODE_T is defined, glibc tries to modify
+ * the data provided in the third argument of msgctl call.
+ */
+#if GLIBC_PREREQ_GE(2, 31) && \
+ (defined __m68k__ || defined __s390__ || \
+ (WORDS_BIGENDIAN && \
+ (defined __arm__ || defined __microblaze__ || defined __sh__)))
+# 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.
--
2.1.4