From: Wei Gao via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1] shmctl03: Fix 32-bit compat mode failure by forcing limits
Date: Wed, 28 Jan 2026 07:10:37 +0000 [thread overview]
Message-ID: <20260128071040.802-1-wegao@suse.com> (raw)
On 64-bit kernels, the default shmmax and shmall values often exceed
the range of a 32-bit unsigned long or are clipped differently by the
kernel's compat syscall layer than they appear in /proc.
Signed-off-by: Wei Gao <wegao@suse.com>
---
testcases/kernel/syscalls/ipc/shmctl/shmctl03.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
index a3291c37f..335a60980 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
@@ -13,6 +13,13 @@
#include "tst_safe_sysv_ipc.h"
#include "libnewipc.h"
+/* Force 32-bit limits to avoid overflow/mismatch on 64-bit kernels */
+#if __WORDSIZE == 32
+# define SET_SHM_LIMIT "2147483647"
+#else
+# define SET_SHM_LIMIT NULL
+#endif
+
static void verify_ipcinfo(void)
{
struct shminfo info;
@@ -37,4 +44,9 @@ static void verify_ipcinfo(void)
static struct tst_test test = {
.test_all = verify_ipcinfo,
+ .save_restore = (const struct tst_path_val[]) {
+ {"/proc/sys/kernel/shmmax", SET_SHM_LIMIT, TST_SR_TCONF_MISSING},
+ {"/proc/sys/kernel/shmall", SET_SHM_LIMIT, TST_SR_TCONF_MISSING},
+ {}
+ },
};
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2026-01-28 7:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 7:10 Wei Gao via ltp [this message]
2026-02-11 13:20 ` [LTP] [PATCH v1] shmctl03: Fix 32-bit compat mode failure by forcing limits Andrea Cervesato via ltp
-- strict thread matches above, loose matches on Subject: below --
2026-04-07 9:26 Wei Gao via ltp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260128071040.802-1-wegao@suse.com \
--to=ltp@lists.linux.it \
--cc=wegao@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox