Skip to content

Commit

Permalink
libsel4vm: Proper error for map_vm_memory_res
Browse files Browse the repository at this point in the history
Currently, if the map_iterator function fails to find a frame for a
given address, then it breaks from the loop, but it does not return an
error and marks the reservation as mapped. Since it skipped some number
of reservations, that is not true and an error should be returned
instead.

Signed-off-by: Robbie VanVossen <[email protected]>
  • Loading branch information
Furao committed Apr 18, 2024
1 parent 9736082 commit 4394e68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libsel4vm/src/guest_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ int map_vm_memory_reservation(vm_t *vm, vm_memory_reservation_t *vm_reservation,
vm_frame_t reservation_frame = map_iterator(current_addr, map_cookie);
if (reservation_frame.cptr == seL4_CapNull) {
ZF_LOGE("Failed to get frame for reservation address 0x%lx", current_addr);
break;
return -1;
}
int ret = vspace_deferred_rights_map_pages_at_vaddr(&vm->mem.vm_vspace, &reservation_frame.cptr, NULL,
(void *)reservation_frame.vaddr, 1, reservation_frame.size_bits,
Expand Down

0 comments on commit 4394e68

Please sign in to comment.