Improve memory map tricks

- In `unmap_all`, replace readable pages atomically with mmap + mremap
- Create new function `remap_all` to replace pages with equivalent
  anonymous copies to prevent simple maps name scanning
This commit is contained in:
topjohnwu
2021-09-22 19:14:05 -07:00
parent da38f59e62
commit 12647dcf30
3 changed files with 39 additions and 19 deletions
+1
View File
@@ -106,6 +106,7 @@ static void first_stage_entry() {
// Load second stage
setenv(INJECT_ENV_2, "1", 1);
void *handle = dlopen(path, RTLD_LAZY);
remap_all(path);
// Revert path to 1st stage lib
*(strrchr(path, '.') - 1) = '1';