From: Cyril Hrubis <chrubis@suse.cz>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: ltp@lists.linux.it, Theodore Grey <theodore.grey@linaro.org>
Subject: Re: [LTP] shmctl03.c is broken for 32bit compat mode
Date: Mon, 11 Aug 2025 11:35:04 +0200 [thread overview]
Message-ID: <aJm5SBOaRoe1e0PB@yuki.lan> (raw)
In-Reply-To: <aJmj6kmNvgzbd1Zi@stanley.mountain>
Hi!
> To be honest, the correct thing with regards to shmall is to cap it at
> INT_MAX in the kernel as well. I didn't want to suggest this because it
> was Friday afternoon. Reporting whatever is in the low 32bits is sort
> of random. But that would make it even more tricky to handle in LTP.
We have tst_is_compat_mode() helper that returns true if we are running
in 32bit compatibility mode. So I suppose that we need a flag for the
TST_ASSERT_ULONG() that would tell it to do a saturated comparsion:
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
index a3291c37f..5e33b3a2c 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
@@ -16,6 +16,7 @@
static void verify_ipcinfo(void)
{
struct shminfo info;
+ int flag = 0;
TEST(shmctl(0, IPC_INFO, (struct shmid_ds *)&info));
@@ -30,9 +31,12 @@ static void verify_ipcinfo(void)
else
tst_res(TPASS, "shmmin = 1");
- TST_ASSERT_ULONG("/proc/sys/kernel/shmmax", info.shmmax);
- TST_ASSERT_ULONG("/proc/sys/kernel/shmmni", info.shmmni);
- TST_ASSERT_ULONG("/proc/sys/kernel/shmall", info.shmall);
+ if (tst_is_compat_mode())
+ flag = TST_ASSERT_ULONG_SATURATED;
+
+ TST_ASSERT_ULONG("/proc/sys/kernel/shmmax", info.shmmax, flag);
+ TST_ASSERT_ULONG("/proc/sys/kernel/shmmni", info.shmmni, flag);
+ TST_ASSERT_ULONG("/proc/sys/kernel/shmall", info.shmall, flag);
}
And the TST_ASSERT_ULONG() would read the syfs file as unsigned long
long and if the saturated flag is present cap it at ULONG_MAX.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-08-11 9:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 13:53 [LTP] shmctl03.c is broken for 32bit compat mode Dan Carpenter
2025-08-10 3:46 ` Li Wang via ltp
2025-08-11 8:03 ` Dan Carpenter
2025-08-11 9:35 ` Cyril Hrubis [this message]
2025-08-12 8:40 ` Li Wang 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=aJm5SBOaRoe1e0PB@yuki.lan \
--to=chrubis@suse.cz \
--cc=dan.carpenter@linaro.org \
--cc=ltp@lists.linux.it \
--cc=theodore.grey@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.