about summary refs log tree commit diff stats
path: root/src/elfs
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-02-09 17:33:00 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-02-09 17:33:00 +0100
commitd36f9e4dbb113ac6d7128bd76d482890358b7734 (patch)
tree0bf2516c0428bb69721f3ca57d8f0bfc16f875bd /src/elfs
parenta65f44885651df8b16c9c375d3b5ac837b2b8dc8 (diff)
downloadbox64-d36f9e4dbb113ac6d7128bd76d482890358b7734.tar.gz
box64-d36f9e4dbb113ac6d7128bd76d482890358b7734.zip
[ELFLOADER] Do not memset the remaining of page when mmap'ing, it's already done (and might not be possible depending on the protection)
Diffstat (limited to 'src/elfs')
-rw-r--r--src/elfs/elfloader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c
index 0b09f2db..9c5a9597 100644
--- a/src/elfs/elfloader.c
+++ b/src/elfs/elfloader.c
@@ -279,8 +279,8 @@ int AllocLoadElfMemory(box64context_t* context, elfheader_t* head, int mainbin)
                     try_mmap = 0;
                     printf_dump(log_level, "Mapping failed, using regular mmap+read");
                 } else {
-                    if(e->p_memsz>e->p_filesz)
-                        memset((void*)((uintptr_t)p + e->p_filesz), 0, e->p_memsz-e->p_filesz);
+                    /*if(e->p_memsz>e->p_filesz)
+                        memset((void*)((uintptr_t)p + e->p_filesz), 0, e->p_memsz-e->p_filesz);*/ // already zero'd by the mmap
                     setProtection_elf((uintptr_t)p, head->multiblocks[n].asize, prot);
                     head->multiblocks[n].p = p;