summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-11-23 21:35:34 -0500
committerMike Frysinger <vapier@gentoo.org>2009-11-23 21:35:34 -0500
commit00673f93826bf1fbde728d202c319a684bb87150 (patch)
tree2918312040781ebf7055ca83321605e7b110002d /ldso
parentc5bc75430dccfaef12220311aa4853176a8a911b (diff)
nommu: use MAP_UNINITIALIZE for mallocs
Now that the kernel supports MAP_UNINITIALIZE, have the malloc places use it to get real uninitialized memory on no-mmu systems. This avoids a lot of normally useless overhead involved in zeroing out all of the memory (sometimes multiple times). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/dl-elf.c2
-rw-r--r--ldso/ldso/ldso.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index e7cb138d4..6bf5bbd6a 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -376,7 +376,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
}
}
header = _dl_mmap((void *) 0, _dl_pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_UNINITIALIZE, -1, 0);
if (_dl_mmap_check_error(header)) {
_dl_dprintf(2, "%s:%i: can't map '%s'\n", _dl_progname, __LINE__, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 45d499574..01e707166 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -193,7 +193,7 @@ void *_dl_malloc(size_t size)
_dl_debug_early("mmapping more memory\n");
_dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, rounded_size,
- PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_UNINITIALIZE, -1, 0);
if (_dl_mmap_check_error(_dl_mmap_zero)) {
_dl_dprintf(_dl_debug_file, "%s: mmap of a spare page failed!\n", _dl_progname);
_dl_exit(20);