Skip to content

Commit

Permalink
runtime: memory-map: allow pkey_mprotect on any memory from any compa…
Browse files Browse the repository at this point in the history
…rtment at most once

we'll want to revisit this when #165 is solved and we can enforce stricter ownership over allocations
  • Loading branch information
fw-immunant committed Sep 12, 2023
1 parent 6c33044 commit 28a8450
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/memory-map/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ pub extern "C" fn memory_map_pkey_mprotect_region(
pkey: u8,
) -> bool {
if let Some(mut state) = map.split_out_region(range) {
if state.owner_pkey == pkey && state.pkey_mprotected == false {
/* forbid repeated pkey_mprotect */
if state.pkey_mprotected == false {
state.pkey_mprotected = true;
map.add_region(range, state)
} else {
Expand Down

0 comments on commit 28a8450

Please sign in to comment.