diff --git a/lib/liblaunch/elf.c b/lib/liblaunch/elf.c index f4f350a..8508b33 100644 --- a/lib/liblaunch/elf.c +++ b/lib/liblaunch/elf.c @@ -233,13 +233,15 @@ static enum launch_status map_executable(struct elf_image *image) kern_handle_t vmo = image->e_image; vm_prot_t prot = VM_PROT_USER; + vm_flags_t flags = VM_SHARED; size_t offset = phdr.p_offset; - phdr.p_flags &PF_R && (prot |= VM_PROT_READ); - phdr.p_flags &PF_W && (prot |= VM_PROT_WRITE); - phdr.p_flags &PF_X && (prot |= VM_PROT_EXEC); + phdr.p_flags & PF_R && (prot |= VM_PROT_READ); + phdr.p_flags & PF_W && (prot |= VM_PROT_WRITE); + phdr.p_flags & PF_X && (prot |= VM_PROT_EXEC); if (phdr.p_flags & PF_W) { vmo = image->e_data; + flags = VM_PRIVATE; offset = data_offset; size_t tmp = 0; @@ -267,6 +269,7 @@ static enum launch_status map_executable(struct elf_image *image) vmo, offset, phdr.p_memsz, + flags, prot, NULL); } @@ -282,6 +285,7 @@ static enum launch_status map_executable(struct elf_image *image) vmo, offset, phdr.p_memsz, + flags, prot, NULL); } diff --git a/lib/liblaunch/launch.c b/lib/liblaunch/launch.c index 4d8051b..6a1d97e 100644 --- a/lib/liblaunch/launch.c +++ b/lib/liblaunch/launch.c @@ -183,6 +183,7 @@ enum launch_status launch_ctx_execute( stack_vmo, 0, STACK_SIZE, + VM_PRIVATE, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_USER, &remote_stack_buf); kstatus = address_space_map( @@ -191,6 +192,7 @@ enum launch_status launch_ctx_execute( stack_vmo, 0, STACK_SIZE, + VM_PRIVATE, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_USER, &local_stack_buf); kern_handle_close(stack_vmo);