feat(kernel): add Revoke syscall for generation-based capability revocation
This commit is contained in:
@@ -44,4 +44,22 @@ impl<P: Platform> Kernel<P> {
|
||||
Err(e) => SyscallOutcome::Complete(SyscallResult::Error(e)),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn handle_revoke(
|
||||
&mut self,
|
||||
caller_pid: types::id::ProcessId,
|
||||
slot: types::bounded::CapSlot,
|
||||
) -> SyscallOutcome {
|
||||
let resource = match self.check_cap(
|
||||
caller_pid,
|
||||
slot,
|
||||
types::permission::Permission::Revoke,
|
||||
) {
|
||||
Ok(cap) => cap.resource().clone(),
|
||||
Err(e) => return SyscallOutcome::Complete(SyscallResult::Error(e)),
|
||||
};
|
||||
|
||||
self.revoke_resource(&resource);
|
||||
SyscallOutcome::Complete(SyscallResult::Ok)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user