Skip to content

Commit

Permalink
Fix to permissions propagation up the stack with set_task_perms
Browse files Browse the repository at this point in the history
  • Loading branch information
rdaum committed Nov 24, 2024
1 parent da7bfa5 commit 80b991d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/kernel/src/vm/exec_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,14 @@ impl VMExecState {
/// Update the permissions of the current task, as called by the `set_task_perms`
/// built-in.
pub(crate) fn set_task_perms(&mut self, perms: Objid) {
self.top_mut().permissions = perms;
// Copy the stack perms up to the last non-builtin. That is, make sure builtin-frames
// get the permissions update, and the first non-builtin, too.
for activation in self.stack.iter_mut().rev() {
activation.permissions = perms;
if !activation.is_builtin_frame() {
break;
}
}
}

/// Push a value onto the value stack
Expand Down

0 comments on commit 80b991d

Please sign in to comment.