Skip to content

Commit

Permalink
vm_map_inherit: handle VM_INHERIT_QUARANTINE
Browse files Browse the repository at this point in the history
Don't allow it to be set (that should only happen when a reservation
becomes fully unmapped) and don't allow map entries leave quarantine
(the entries must be destroyed after revocation is complete).
  • Loading branch information
brooksdavis committed Feb 14, 2023
1 parent bc4a211 commit 350757d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sys/vm/vm_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -3658,6 +3658,7 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_offset_t end,
case VM_INHERIT_COPY:
case VM_INHERIT_SHARE:
case VM_INHERIT_ZERO:
/* Don't allow VM_INHERIT_QUARANTINE */
break;
default:
return (KERN_INVALID_ARGUMENT);
Expand All @@ -3674,6 +3675,17 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_offset_t end,
if (rv != KERN_SUCCESS)
goto unlock;
}
#ifdef CHERI_CAPREVOKE
if (quarantine_unmapped_reservations) {
for (entry = start_entry; entry->start < end;
prev_entry = entry, entry = vm_map_entry_succ(entry)) {
if (entry->inheritance == VM_INHERIT_QUARANTINE) {
rv = KERN_PROTECTION_FAILURE;
goto unlock;
}
}
}
#endif
if (new_inheritance == VM_INHERIT_COPY) {
for (entry = start_entry; entry->start < end;
prev_entry = entry, entry = vm_map_entry_succ(entry)) {
Expand Down

0 comments on commit 350757d

Please sign in to comment.