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