liblaunch: implement private/shared mapping support

This commit is contained in:
2026-04-21 21:17:08 +01:00
parent 58e99b046d
commit 538904b7e4
2 changed files with 9 additions and 3 deletions
+7 -3
View File
@@ -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);
}
+2
View File
@@ -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);