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