From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Cc: Linux Kernel Functional Testing <lkft@linaro.org>,
Manfred Spraul <manfred@colorfullife.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: [LTP] [PATCH v2] shmget02: reduce the shmmax test value in compat mode
Date: Thu, 1 Jun 2023 17:16:14 +0800 [thread overview]
Message-ID: <20230601091614.53228-1-liwang@redhat.com> (raw)
In-Reply-To: <8d3e09cc-3d3b-aa8f-1369-28476183b3c9@suse.cz>
As Arnd Bergmann pointed out that SHMMAX being defined as
(ULONG_MAX - (1UL << 24)), so the kernel would likely use
a large 64-bit value, while the 32-bit user space uses a
much smaller limit.
It finally results in ENOMEM failure:
shmget02.c:95: TFAIL: shmget(1644199826, 4278190080, 1536)
expected EINVAL: ENOMEM (12)
With suggest by Manfred Spraul we could reduce the value
of '/proc/sys/kernel/shmmax' in compat mode and only test
the overflow behavior with default+1.
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Manfred Spraul <manfred@colorfullife.com>
---
Notes:
v1 --> v2
* remove the conditional compilation for 32bit
testcases/kernel/syscalls/ipc/shmget/shmget02.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget02.c b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
index 7989ef33e..e053b98d2 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget02.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
@@ -56,7 +56,7 @@ static struct tcase {
{&shmkey1, SHM_SIZE, IPC_EXCL, 0, 0, ENOENT},
{&shmkey, SHM_SIZE, IPC_CREAT | IPC_EXCL, 0, 0, EEXIST},
{&shmkey1, SHMMIN - 1, IPC_CREAT | IPC_EXCL, 0, 0, EINVAL},
- {&shmkey1, SHMMAX + 1, IPC_CREAT | IPC_EXCL, 0, 0, EINVAL},
+ {&shmkey1, 8192 + 1, IPC_CREAT | IPC_EXCL, 0, 0, EINVAL},
{&shmkey, SHM_SIZE * 2, IPC_EXCL, 0, 0, EINVAL},
{&shmkey, SHM_SIZE, SHM_RD, 1, 0, EACCES},
{&shmkey1, SHM_SIZE, IPC_CREAT | SHM_HUGETLB, 0, 1, EPERM},
@@ -149,4 +149,8 @@ static struct tst_test test = {
.test = do_test,
.tcnt = ARRAY_SIZE(tcases),
.hugepages = {TST_NO_HUGEPAGES},
+ .save_restore = (const struct tst_path_val[]) {
+ {"/proc/sys/kernel/shmmax", "8192", TST_SR_TBROK},
+ {}
+ },
};
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-06-01 9:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 9:30 [LTP] [PATCH] shmget02: reduce the shmmax test value in compat mode Li Wang
2023-05-30 12:46 ` Martin Doucha
2023-05-30 12:56 ` Li Wang
2023-06-01 9:16 ` Li Wang [this message]
2023-06-01 14:51 ` [LTP] [PATCH v2] " Martin Doucha
2023-06-02 0:49 ` Li Wang
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=20230601091614.53228-1-liwang@redhat.com \
--to=liwang@redhat.com \
--cc=arnd@arndb.de \
--cc=lkft@linaro.org \
--cc=ltp@lists.linux.it \
--cc=manfred@colorfullife.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