aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--04_dynld_nostd/dynld.c2
-rw-r--r--lib/include/syscalls.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/04_dynld_nostd/dynld.c b/04_dynld_nostd/dynld.c
index 5193761..4de9ed5 100644
--- a/04_dynld_nostd/dynld.c
+++ b/04_dynld_nostd/dynld.c
@@ -324,7 +324,7 @@ static Dso map_dependency(const char* dependency) {
addr_end = (addr_end + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
// Reserve region big enough to map all `PT_LOAD` sections of `dependency`.
- uint8_t* map = mmap(0 /* addr */, addr_end - addr_start /* len */, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
+ uint8_t* map = mmap(0 /* addr */, addr_end - addr_start /* len */, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS,
-1 /* fd */, 0 /* file offset */);
ERROR_ON(map == MAP_FAILED, "Failed to mmap address space for dependency '%s'\n", dependency);
diff --git a/lib/include/syscalls.h b/lib/include/syscalls.h
index 7808e98..20362d6 100644
--- a/lib/include/syscalls.h
+++ b/lib/include/syscalls.h
@@ -25,6 +25,7 @@ ssize_t read(int fd, void* buf, size_t count);
ssize_t pread(int fd, void* buf, size_t count, off_t offset);
// mmap - prot:
+#define PROT_NONE 0x0
#define PROT_READ 0x1
#define PROT_WRITE 0x2
#define PROT_EXEC 0x4