|
Message-ID: <BD7773622145634B952E5B54ACA8E349AA2466D7@PUMAIL01.pu.imgtec.org>
Date: Thu, 10 Mar 2016 10:36:54 +0000
From: Jaydeep Patil <Jaydeep.Patil@...tec.com>
To: "nsz@...t70.net" <nsz@...t70.net>
CC: "musl@...ts.openwall.com" <musl@...ts.openwall.com>, "dalias@...c.org"
<dalias@...c.org>
Subject: [PATCH] malloc-brk-fail test
Hi Szabolcs,
Page size on the MIPS64 Linux (v4.4) system we are using to test MUSL is 64kb. The t_vmfill leaves up to 64kb memory, thus malloc of size 10000 (less than page size) after t_vmfill in this case succeeds.
Could you please consider this patch?
diff --git a/src/regression/malloc-brk-fail.c b/src/regression/malloc-brk-fail.c
index d0ccd35..a1c2f32 100644
--- a/src/regression/malloc-brk-fail.c
+++ b/src/regression/malloc-brk-fail.c
@@ -9,6 +9,10 @@
#define T(f) ((f)==0 || (t_error(#f " failed: %s\n", strerror(errno)), 0))
+#ifndef PAGE_SIZE
+ #define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
+#endif
+
int main(void)
{
void *p;
@@ -26,9 +30,9 @@ int main(void)
// malloc should fail here
errno = 0;
- q = malloc(10000);
+ q = malloc(PAGE_SIZE);
if (q)
- t_error("malloc(10000) succeeded after memory is filled\n");
+ t_error("malloc(PAGE_SIZE) succeeded after memory is filled\n");
else if (errno != ENOMEM)
t_error("malloc did not fail with ENOMEM, got %s\n", strerror(errno));
@@ -36,9 +40,9 @@ int main(void)
T(munmap((char*)p+65536, 65536));
// malloc should succeed now
- q = malloc(10000);
+ q = malloc(PAGE_SIZE);
if (!q)
- t_error("malloc(10000) failed (eventhough 64k is available to mmap): %s\n", strerror(errno));
+ t_error("malloc(PAGE_SIZE) failed (eventhough 64k is available to mmap): %s\n", strerror(errno));
return t_status;
}
Thanks,
Jaydeep
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.