+2019-06-28 Florian Weimer <fweimer@redhat.com>
+
+ * sysdeps/unix/sysv/linux/tst-getdents64.c (large_buffer_checks):
+ Use mmap instead of malloc. malloc with M_PERTURB writes to the
+ entire allocated memory range.
+
2019-06-28 Tobias Klauser <tklauser@distanz.ch>
* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
#include <support/check.h>
#include <support/support.h>
#include <support/xunistd.h>
+#include <sys/mman.h>
#include <unistd.h>
/* Called by large_buffer_checks below. */
size_t large_buffer_size;
if (!__builtin_add_overflow (UINT_MAX, 2, &large_buffer_size))
{
- char *large_buffer = malloc (large_buffer_size);
- if (large_buffer == NULL)
+ int flags = MAP_ANONYMOUS | MAP_PRIVATE;
+#ifdef MAP_NORESERVE
+ flags |= MAP_NORESERVE;
+#endif
+ void *large_buffer = mmap (NULL, large_buffer_size,
+ PROT_READ | PROT_WRITE, flags, -1, 0);
+ if (large_buffer == MAP_FAILED)
printf ("warning: could not allocate %zu bytes of memory,"
" subtests skipped\n", large_buffer_size);
else
large_buffer_check (fd, large_buffer, UINT_MAX);
large_buffer_check (fd, large_buffer, (size_t) UINT_MAX + 1);
large_buffer_check (fd, large_buffer, (size_t) UINT_MAX + 2);
+ xmunmap (large_buffer, large_buffer_size);
}
- free (large_buffer);
}
}