No need to zero fill memory, mmapped anonymously. Kernel will
return pre-zeroed pages itself. Noticed by: jake
This commit is contained in:
parent
fb5caa50ab
commit
605f36fc1e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112242
@ -162,8 +162,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
|
||||
cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (cache == MAP_FAILED)
|
||||
cache = NULL;
|
||||
if (cache != NULL)
|
||||
memset(cache, 0, bytes);
|
||||
|
||||
/* Perform relocations without addend if there are any: */
|
||||
rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize);
|
||||
|
@ -125,8 +125,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
|
||||
cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (cache == MAP_FAILED)
|
||||
cache = NULL;
|
||||
if (cache != NULL)
|
||||
memset(cache, 0, bytes);
|
||||
|
||||
rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize);
|
||||
for (rel = obj->rel; rel < rellim; rel++) {
|
||||
|
@ -125,8 +125,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
|
||||
cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (cache == MAP_FAILED)
|
||||
cache = NULL;
|
||||
if (cache != NULL)
|
||||
memset(cache, 0, bytes);
|
||||
|
||||
rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize);
|
||||
for (rel = obj->rel; rel < rellim; rel++) {
|
||||
|
@ -231,8 +231,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
|
||||
cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (cache == MAP_FAILED)
|
||||
cache = NULL;
|
||||
if (cache != NULL)
|
||||
memset(cache, 0, bytes);
|
||||
|
||||
/*
|
||||
* When relocating rtld itself, we need to avoid using malloc.
|
||||
|
@ -233,12 +233,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
|
||||
* limited amounts of stack available so we cannot use alloca().
|
||||
*/
|
||||
cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (cache == MAP_FAILED) {
|
||||
if (cache == MAP_FAILED)
|
||||
cache = NULL;
|
||||
}
|
||||
if (cache != NULL) {
|
||||
memset(cache, 0, obj->nchains * sizeof(SymCache));
|
||||
}
|
||||
|
||||
/*
|
||||
* From the SVR4 PPC ABI:
|
||||
|
@ -261,8 +261,6 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
|
||||
cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (cache == MAP_FAILED)
|
||||
cache = NULL;
|
||||
if (cache != NULL)
|
||||
memset(cache, 0, obj->nchains * sizeof(SymCache));
|
||||
|
||||
relalim = (const Elf_Rela *)((caddr_t)obj->rela + obj->relasize);
|
||||
for (rela = obj->rela; rela < relalim; rela++) {
|
||||
|
Loading…
Reference in New Issue
Block a user