From: Li Wang via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] cve-2017-17052: tolerate ENOMEM during test
Date: Thu, 29 Jan 2026 18:00:11 +0800 [thread overview]
Message-ID: <20260129100011.72437-1-liwang@redhat.com> (raw)
As each iteration of mmap_thread() grabs a fresh 16 MiB MAP_POPULATE
region and never releases it. As the loop runs, those regions
accumulate consuming both virtual address space and committed physical
memory right away instead of lazily.
Easily mmap() fails with ENOMEM on smaller/limit RAM resource system.
Error Log:
cve-2017-17052.c:48: TBROK: mmap((nil),16777216,PROT_READ(1),32802,-1,0) failed: ENOMEM (12)
tst_test.c:479: TINFO: Child process reported TBROK killing the test
tst_test.c:1909: TINFO: Killed the leftover descendant processes
Consider there is no practical upper bound on this allocation pattern,
so setting .test.min_mem_avail may not helps. Here we just tolerate
ENOMEM during the mmap_thread() looping.
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/cve/cve-2017-17052.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/testcases/cve/cve-2017-17052.c b/testcases/cve/cve-2017-17052.c
index 700eb782e..61032c197 100644
--- a/testcases/cve/cve-2017-17052.c
+++ b/testcases/cve/cve-2017-17052.c
@@ -44,9 +44,16 @@ static void cleanup(void)
static void *mmap_thread(void *arg)
{
+ void *ptr;
+
for (;;) {
- SAFE_MMAP(NULL, 0x1000000, PROT_READ,
+ ptr = mmap(NULL, 0x1000000, PROT_READ,
MAP_POPULATE|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+
+ if ((ptr == MAP_FAILED) && (errno == ENOMEM)) {
+ usleep(1000);
+ continue;
+ }
}
return arg;
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2026-01-29 10:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 10:00 Li Wang via ltp [this message]
2026-01-29 10:08 ` [LTP] [PATCH] cve-2017-17052: tolerate ENOMEM during test Li Wang via ltp
2026-01-29 13:28 ` Petr Vorel
2026-01-29 13:44 ` Li Wang via ltp
2026-01-29 14:24 ` Cyril Hrubis
2026-01-30 0:01 ` 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=20260129100011.72437-1-liwang@redhat.com \
--to=ltp@lists.linux.it \
--cc=liwang@redhat.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 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.