From a07fb60c4996955216ef9a331dae124374984b3a Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 16 Apr 2024 22:14:30 +0000 Subject: [PATCH] fix malloc-brk-fail RLIMIT_DATA was changed in linux 4.7 to include mmap as well, not just brk, however the test should work without the limit (unless the kernel reserves space after brk that is not available for mmap, but that does not seem to be the case). --- src/regression/malloc-brk-fail.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/regression/malloc-brk-fail.c b/src/regression/malloc-brk-fail.c index d0ccd35..420b000 100644 --- a/src/regression/malloc-brk-fail.c +++ b/src/regression/malloc-brk-fail.c @@ -21,8 +21,6 @@ int main(void) t_error("vmfill failed\n"); return 1; } - errno = 0; - T(t_setrlim(RLIMIT_DATA, 0)); // malloc should fail here errno = 0; @@ -32,8 +30,8 @@ int main(void) else if (errno != ENOMEM) t_error("malloc did not fail with ENOMEM, got %s\n", strerror(errno)); - // make some space available for mmap - T(munmap((char*)p+65536, 65536)); + // make space available for mmap, but ensure it's not contiguous with brk + T(munmap((char*)p+65536, n-65536)); // malloc should succeed now q = malloc(10000); -- 2.20.1