Blame SOURCES/0159-tests-disable-tests-for-invalid-msgctl-commands-on-g.patch

242c1e
From b702ddfd448794f3ac5033c897a07da3de8f5fc7 Mon Sep 17 00:00:00 2001
242c1e
From: "Dmitry V. Levin" <ldv@altlinux.org>
242c1e
Date: Sun, 6 Dec 2020 08:00:00 +0000
242c1e
Subject: [PATCH 159/162] tests: disable tests for invalid msgctl commands on
242c1e
 glibc >= 2.32
242c1e
242c1e
Starting with commit glibc-2.32.9000-149-gbe9b0b9a012780a403a2,
242c1e
glibc skips msgctl syscall invocations and returns EINVAL
242c1e
for invalid msgctl commands.
242c1e
242c1e
* tests/ipc_msg.c [GLIBC_PREREQ_GE(2, 32)] (TEST_MSGCTL_BOGUS_CMD):
242c1e
Define to 0.
242c1e
[!TEST_MSGCTL_BOGUS_CMD] (TEST_MSGCTL_BOGUS_CMD): Define to 1.
242c1e
(main) [!TEST_MSGCTL_BOGUS_CMD] (bogus_cmd): Do not define and do not
242c1e
use.
242c1e
---
242c1e
 tests/ipc_msg.c | 21 ++++++++++++++++++++-
242c1e
 1 file changed, 20 insertions(+), 1 deletion(-)
242c1e
242c1e
diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
242c1e
index f7c36cd..6a96a5f 100644
242c1e
--- a/tests/ipc_msg.c
242c1e
+++ b/tests/ipc_msg.c
242c1e
@@ -21,6 +21,7 @@
242c1e
 #endif
242c1e
 
242c1e
 #undef TEST_MSGCTL_BOGUS_ADDR
242c1e
+#undef TEST_MSGCTL_BOGUS_CMD
242c1e
 
242c1e
 /*
242c1e
  * Starting with commit glibc-2.32~83, on every 32-bit architecture
242c1e
@@ -50,9 +51,21 @@
242c1e
 # define TEST_MSGCTL_BOGUS_ADDR 0
242c1e
 #endif
242c1e
 
242c1e
+/*
242c1e
+ * Starting with commit glibc-2.32.9000-149-gbe9b0b9a012780a403a2,
242c1e
+ * glibc skips msgctl syscall invocations and returns EINVAL
242c1e
+ * for invalid msgctl commands.
242c1e
+ */
242c1e
+#if GLIBC_PREREQ_GE(2, 32)
242c1e
+# define TEST_MSGCTL_BOGUS_CMD 0
242c1e
+#endif
242c1e
+
242c1e
 #ifndef TEST_MSGCTL_BOGUS_ADDR
242c1e
 # define TEST_MSGCTL_BOGUS_ADDR 1
242c1e
 #endif
242c1e
+#ifndef TEST_MSGCTL_BOGUS_CMD
242c1e
+# define TEST_MSGCTL_BOGUS_CMD 1
242c1e
+#endif
242c1e
 
242c1e
 #if XLAT_RAW
242c1e
 # define str_ipc_excl_nowait "0xface1c00"
242c1e
@@ -107,12 +120,16 @@ main(void)
242c1e
 	static const key_t private_key =
242c1e
 		(key_t) (0xffffffff00000000ULL | IPC_PRIVATE);
242c1e
 	static const key_t bogus_key = (key_t) 0xeca86420fdb9f531ULL;
242c1e
+	static const int bogus_flags = 0xface1e55 & ~IPC_CREAT;
242c1e
+#if TEST_MSGCTL_BOGUS_CMD || TEST_MSGCTL_BOGUS_ADDR
242c1e
 	static const int bogus_msgid = 0xfdb97531;
242c1e
+#endif
242c1e
+#if TEST_MSGCTL_BOGUS_CMD
242c1e
 	static const int bogus_cmd = 0xdeadbeef;
242c1e
+#endif
242c1e
 #if TEST_MSGCTL_BOGUS_ADDR
242c1e
 	static void * const bogus_addr = (void *) -1L;
242c1e
 #endif
242c1e
-	static const int bogus_flags = 0xface1e55 & ~IPC_CREAT;
242c1e
 
242c1e
 	int rc;
242c1e
 	struct msqid_ds ds;
242c1e
@@ -129,9 +146,11 @@ main(void)
242c1e
 	printf("msgget\\(%s, 0600\\) = %d\n", str_ipc_private, id);
242c1e
 	atexit(cleanup);
242c1e
 
242c1e
+#if TEST_MSGCTL_BOGUS_CMD
242c1e
 	rc = msgctl(bogus_msgid, bogus_cmd, NULL);
242c1e
 	printf("msgctl\\(%d, (%s\\|)?%s, NULL\\) = %s\n",
242c1e
 	       bogus_msgid, str_ipc_64, str_bogus_cmd, sprintrc_grep(rc));
242c1e
+#endif
242c1e
 
242c1e
 #if TEST_MSGCTL_BOGUS_ADDR
242c1e
 	rc = msgctl(bogus_msgid, IPC_SET, bogus_addr);
242c1e
diff --git a/tests-m32/ipc_msg.c b/tests-m32/ipc_msg.c
242c1e
index f7c36cd..6a96a5f 100644
242c1e
--- a/tests-m32/ipc_msg.c
242c1e
+++ b/tests-m32/ipc_msg.c
242c1e
@@ -21,6 +21,7 @@
242c1e
 #endif
242c1e
 
242c1e
 #undef TEST_MSGCTL_BOGUS_ADDR
242c1e
+#undef TEST_MSGCTL_BOGUS_CMD
242c1e
 
242c1e
 /*
242c1e
  * Starting with commit glibc-2.32~83, on every 32-bit architecture
242c1e
@@ -50,9 +51,21 @@
242c1e
 # define TEST_MSGCTL_BOGUS_ADDR 0
242c1e
 #endif
242c1e
 
242c1e
+/*
242c1e
+ * Starting with commit glibc-2.32.9000-149-gbe9b0b9a012780a403a2,
242c1e
+ * glibc skips msgctl syscall invocations and returns EINVAL
242c1e
+ * for invalid msgctl commands.
242c1e
+ */
242c1e
+#if GLIBC_PREREQ_GE(2, 32)
242c1e
+# define TEST_MSGCTL_BOGUS_CMD 0
242c1e
+#endif
242c1e
+
242c1e
 #ifndef TEST_MSGCTL_BOGUS_ADDR
242c1e
 # define TEST_MSGCTL_BOGUS_ADDR 1
242c1e
 #endif
242c1e
+#ifndef TEST_MSGCTL_BOGUS_CMD
242c1e
+# define TEST_MSGCTL_BOGUS_CMD 1
242c1e
+#endif
242c1e
 
242c1e
 #if XLAT_RAW
242c1e
 # define str_ipc_excl_nowait "0xface1c00"
242c1e
@@ -107,12 +120,16 @@ main(void)
242c1e
 	static const key_t private_key =
242c1e
 		(key_t) (0xffffffff00000000ULL | IPC_PRIVATE);
242c1e
 	static const key_t bogus_key = (key_t) 0xeca86420fdb9f531ULL;
242c1e
+	static const int bogus_flags = 0xface1e55 & ~IPC_CREAT;
242c1e
+#if TEST_MSGCTL_BOGUS_CMD || TEST_MSGCTL_BOGUS_ADDR
242c1e
 	static const int bogus_msgid = 0xfdb97531;
242c1e
+#endif
242c1e
+#if TEST_MSGCTL_BOGUS_CMD
242c1e
 	static const int bogus_cmd = 0xdeadbeef;
242c1e
+#endif
242c1e
 #if TEST_MSGCTL_BOGUS_ADDR
242c1e
 	static void * const bogus_addr = (void *) -1L;
242c1e
 #endif
242c1e
-	static const int bogus_flags = 0xface1e55 & ~IPC_CREAT;
242c1e
 
242c1e
 	int rc;
242c1e
 	struct msqid_ds ds;
242c1e
@@ -129,9 +146,11 @@ main(void)
242c1e
 	printf("msgget\\(%s, 0600\\) = %d\n", str_ipc_private, id);
242c1e
 	atexit(cleanup);
242c1e
 
242c1e
+#if TEST_MSGCTL_BOGUS_CMD
242c1e
 	rc = msgctl(bogus_msgid, bogus_cmd, NULL);
242c1e
 	printf("msgctl\\(%d, (%s\\|)?%s, NULL\\) = %s\n",
242c1e
 	       bogus_msgid, str_ipc_64, str_bogus_cmd, sprintrc_grep(rc));
242c1e
+#endif
242c1e
 
242c1e
 #if TEST_MSGCTL_BOGUS_ADDR
242c1e
 	rc = msgctl(bogus_msgid, IPC_SET, bogus_addr);
242c1e
diff --git a/tests-mx32/ipc_msg.c b/tests-mx32/ipc_msg.c
242c1e
index f7c36cd..6a96a5f 100644
242c1e
--- a/tests-mx32/ipc_msg.c
242c1e
+++ b/tests-mx32/ipc_msg.c
242c1e
@@ -21,6 +21,7 @@
242c1e
 #endif
242c1e
 
242c1e
 #undef TEST_MSGCTL_BOGUS_ADDR
242c1e
+#undef TEST_MSGCTL_BOGUS_CMD
242c1e
 
242c1e
 /*
242c1e
  * Starting with commit glibc-2.32~83, on every 32-bit architecture
242c1e
@@ -50,9 +51,21 @@
242c1e
 # define TEST_MSGCTL_BOGUS_ADDR 0
242c1e
 #endif
242c1e
 
242c1e
+/*
242c1e
+ * Starting with commit glibc-2.32.9000-149-gbe9b0b9a012780a403a2,
242c1e
+ * glibc skips msgctl syscall invocations and returns EINVAL
242c1e
+ * for invalid msgctl commands.
242c1e
+ */
242c1e
+#if GLIBC_PREREQ_GE(2, 32)
242c1e
+# define TEST_MSGCTL_BOGUS_CMD 0
242c1e
+#endif
242c1e
+
242c1e
 #ifndef TEST_MSGCTL_BOGUS_ADDR
242c1e
 # define TEST_MSGCTL_BOGUS_ADDR 1
242c1e
 #endif
242c1e
+#ifndef TEST_MSGCTL_BOGUS_CMD
242c1e
+# define TEST_MSGCTL_BOGUS_CMD 1
242c1e
+#endif
242c1e
 
242c1e
 #if XLAT_RAW
242c1e
 # define str_ipc_excl_nowait "0xface1c00"
242c1e
@@ -107,12 +120,16 @@ main(void)
242c1e
 	static const key_t private_key =
242c1e
 		(key_t) (0xffffffff00000000ULL | IPC_PRIVATE);
242c1e
 	static const key_t bogus_key = (key_t) 0xeca86420fdb9f531ULL;
242c1e
+	static const int bogus_flags = 0xface1e55 & ~IPC_CREAT;
242c1e
+#if TEST_MSGCTL_BOGUS_CMD || TEST_MSGCTL_BOGUS_ADDR
242c1e
 	static const int bogus_msgid = 0xfdb97531;
242c1e
+#endif
242c1e
+#if TEST_MSGCTL_BOGUS_CMD
242c1e
 	static const int bogus_cmd = 0xdeadbeef;
242c1e
+#endif
242c1e
 #if TEST_MSGCTL_BOGUS_ADDR
242c1e
 	static void * const bogus_addr = (void *) -1L;
242c1e
 #endif
242c1e
-	static const int bogus_flags = 0xface1e55 & ~IPC_CREAT;
242c1e
 
242c1e
 	int rc;
242c1e
 	struct msqid_ds ds;
242c1e
@@ -129,9 +146,11 @@ main(void)
242c1e
 	printf("msgget\\(%s, 0600\\) = %d\n", str_ipc_private, id);
242c1e
 	atexit(cleanup);
242c1e
 
242c1e
+#if TEST_MSGCTL_BOGUS_CMD
242c1e
 	rc = msgctl(bogus_msgid, bogus_cmd, NULL);
242c1e
 	printf("msgctl\\(%d, (%s\\|)?%s, NULL\\) = %s\n",
242c1e
 	       bogus_msgid, str_ipc_64, str_bogus_cmd, sprintrc_grep(rc));
242c1e
+#endif
242c1e
 
242c1e
 #if TEST_MSGCTL_BOGUS_ADDR
242c1e
 	rc = msgctl(bogus_msgid, IPC_SET, bogus_addr);
242c1e
-- 
242c1e
2.1.4
242c1e