diff --git a/crates/aienos-boot/src/handoff.rs b/crates/aienos-boot/src/handoff.rs index 399bd2b1..be4a1915 100644 --- a/crates/aienos-boot/src/handoff.rs +++ b/crates/aienos-boot/src/handoff.rs @@ -1539,6 +1539,37 @@ fn main() -> Status { let _ = writeln!(report, "placement: unavailable"); } } + let ipc = unsafe { aienos_kernel::user::run_ipc_demo(kernel_root) }; + let _ = writeln!( + report, + "ipc: {} message={} cap={} rights={} forged={} revoked={}", + if ipc.ok { "ok" } else { "failed" }, + if ipc.message_delivered { + "delivered" + } else { + "missed" + }, + if ipc.cap_delegated { + "delegated" + } else { + "failed" + }, + if ipc.rights_attenuated { + "attenuated" + } else { + "escalated" + }, + if ipc.forged_denied { + "denied" + } else { + "accepted" + }, + if ipc.revoked_denied { + "denied" + } else { + "accepted" + }, + ); let _ = writeln!( report, "runtime_code: {}", diff --git a/crates/aienos-kernel/src/ipc.rs b/crates/aienos-kernel/src/ipc.rs new file mode 100644 index 00000000..7cd71a13 --- /dev/null +++ b/crates/aienos-kernel/src/ipc.rs @@ -0,0 +1,633 @@ +//! Typed kernel-owned message channels, gated by capability handles. +//! +//! The channel ring, the object bytes and every principal's capability table +//! are kernel-owned. A task can only touch a channel or object through a +//! handle in its own table with the required right, so there is no global +//! lookup that bypasses caller authority. Delegation uses +//! [`crate::caps::CapTable::derive_into`], which links the child to its parent +//! for tree revocation: attenuating a capability and later revoking the +//! ancestor invalidates every derived copy. + +use crate::caps::{CapError, CapTable, Handle, Rights}; +use core::sync::atomic::{AtomicU32, Ordering}; + +/// Identity of an isolated principal (a task with its own capability table). +#[repr(C)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct TaskId(pub u32); + +/// Identity of a kernel object reachable through a capability handle. +#[repr(C)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ObjectId(pub u64); + +/// Identity of a kernel-owned message channel. +#[repr(C)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ChannelId(pub u32); + +/// A bounded memory extent carried by reference inside a message. +#[repr(C)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct MemoryRegion { + pub base: u64, + pub pages: u32, + pub _pad: u32, +} + +/// Fixed-size typed message. `repr(C)` and allocator-free so it can cross the +/// EL0 boundary in registers and sit in a static ring. +#[repr(C)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Message { + pub kind: u32, + pub _pad: u32, + pub payload: [u64; 3], + pub region: MemoryRegion, + pub object: ObjectId, +} + +impl Message { + pub const NEW: Self = Self { + kind: 0, + _pad: 0, + payload: [0; 3], + region: MemoryRegion { + base: 0, + pages: 0, + _pad: 0, + }, + object: ObjectId(0), + }; +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ChannelError { + Full, + Empty, +} + +/// Bounded FIFO ring of fixed-size messages. Deterministic: send appends at +/// `tail`, receive pops from `head`, no allocation, no dropping. +pub struct Channel { + ring: [Message; N], + head: usize, + len: usize, +} + +impl Channel { + pub const fn new() -> Self { + Self { + ring: [Message::NEW; N], + head: 0, + len: 0, + } + } + + pub fn send(&mut self, message: Message) -> Result<(), ChannelError> { + if self.len == N { + return Err(ChannelError::Full); + } + let tail = (self.head + self.len) % N; + self.ring[tail] = message; + self.len += 1; + Ok(()) + } + + pub fn receive(&mut self) -> Result { + if self.len == 0 { + return Err(ChannelError::Empty); + } + let message = self.ring[self.head]; + self.head = (self.head + 1) % N; + self.len -= 1; + Ok(message) + } + + pub fn len(&self) -> usize { + self.len + } + + pub fn is_empty(&self) -> bool { + self.len == 0 + } +} + +impl Default for Channel { + fn default() -> Self { + Self::new() + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum IpcError { + ChannelFull, + ChannelEmpty, + MissingRights, + InvalidHandle, + WrongResource, + DelegationFailed, +} + +impl From for IpcError { + fn from(error: CapError) -> Self { + match error { + CapError::Full => IpcError::DelegationFailed, + CapError::InvalidHandle => IpcError::InvalidHandle, + CapError::MissingRights => IpcError::MissingRights, + CapError::RightsEscalation => IpcError::MissingRights, + CapError::DuplicateTable => IpcError::InvalidHandle, + } + } +} + +/// Capability resource IDs. A channel capability carries the channel ID as its +/// resource; an object capability carries [`OBJECT_RESOURCE`]. +pub const CHANNEL_RESOURCE: u32 = 0x4950_4348; +pub const OBJECT_RESOURCE: u32 = 0x4950_4F42; + +pub const PRINCIPAL_A: u32 = 0x4500_0041; +pub const PRINCIPAL_B: u32 = 0x4500_0042; + +pub const CHANNEL: ChannelId = ChannelId(0); +pub const CHANNEL_CAPACITY: usize = 8; +pub const TABLE_CAPACITY: usize = 8; + +/// Kernel-owned object bytes reachable only through object capabilities. +pub const OBJECT_SLOTS: usize = 4; + +// Kernel-owned IPC state. Touched only from EL1 dispatchers. +static mut CHANNELS: [Channel; 2] = [Channel::new(), Channel::new()]; +static mut OBJECT: [u64; OBJECT_SLOTS] = [0; OBJECT_SLOTS]; +static mut PRINCIPAL_TABLES: [CapTable; 2] = + [CapTable::new(PRINCIPAL_A), CapTable::new(PRINCIPAL_B)]; +static ACTIVE_PRINCIPAL: AtomicU32 = AtomicU32::new(0); + +fn principal_index(id: u32) -> Option { + match id { + PRINCIPAL_A => Some(0), + PRINCIPAL_B => Some(1), + _ => None, + } +} + +/// Reset every kernel-owned IPC structure and provision the two principals: +/// A holds the channel send right plus a full-rights object capability; +/// B holds only the channel receive right. Returns A's channel and object +/// handles and B's channel handle. +/// +/// # Safety +/// Caller must have exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn reset() -> (Handle, Handle, Handle) { + unsafe { CHANNELS[CHANNEL.0 as usize] = Channel::new() }; + unsafe { + OBJECT = [0xc0ff_ee01, 0x0bad_c0de, 0x1234_5678, 0x9abc_def0]; + PRINCIPAL_TABLES = [CapTable::new(PRINCIPAL_A), CapTable::new(PRINCIPAL_B)]; + } + ACTIVE_PRINCIPAL.store(PRINCIPAL_A, Ordering::Release); + let send = unsafe { principal_table_at(0) } + .insert(CHANNEL_RESOURCE, Rights::WRITE) + .expect("principal A send capability"); + let object = unsafe { principal_table_at(0) } + .insert( + OBJECT_RESOURCE, + Rights::READ | Rights::WRITE | Rights::DERIVE | Rights::REVOKE, + ) + .expect("principal A object capability"); + let recv = unsafe { principal_table_at(1) } + .insert(CHANNEL_RESOURCE, Rights::READ) + .expect("principal B receive capability"); + (send, object, recv) +} + +/// Record the principal about to run at EL0; syscall dispatch resolves +/// handles against that principal's table. +pub fn set_active_principal(id: TaskId) { + ACTIVE_PRINCIPAL.store(id.0, Ordering::Release); +} + +/// # Safety +/// The active principal's table must not be aliased elsewhere. +pub unsafe fn with_active_table( + f: impl FnOnce(&mut CapTable) -> Result, +) -> Result { + let index = + principal_index(ACTIVE_PRINCIPAL.load(Ordering::Acquire)).ok_or(IpcError::InvalidHandle)?; + let table = unsafe { (&raw mut PRINCIPAL_TABLES[index]).as_mut().unwrap() }; + f(table) +} + +fn channel_table() -> &'static mut Channel { + // SAFETY: EL1-only, single CPU, bounded channel set. + unsafe { (&raw mut CHANNELS[CHANNEL.0 as usize]).as_mut().unwrap() } +} + +fn gated( + table: &CapTable, + handle: Handle, + right: Rights, + resource: u32, +) -> Result<(), IpcError> { + match table.lookup(handle, right) { + Ok(found) if found == resource => Ok(()), + Ok(_) => Err(IpcError::WrongResource), + Err(CapError::MissingRights) => Err(IpcError::MissingRights), + Err(_) => Err(IpcError::InvalidHandle), + } +} + +/// Send a typed message on a channel the caller holds with WRITE right. +pub fn channel_send( + table: &mut CapTable, + handle: Handle, + message: Message, +) -> Result<(), IpcError> { + gated(table, handle, Rights::WRITE, CHANNEL_RESOURCE)?; + channel_table() + .send(message) + .map_err(|_| IpcError::ChannelFull) +} + +/// Receive a typed message from a channel the caller holds with READ right. +pub fn channel_receive( + table: &mut CapTable, + handle: Handle, +) -> Result { + gated(table, handle, Rights::READ, CHANNEL_RESOURCE)?; + channel_table() + .receive() + .map_err(|_| IpcError::ChannelEmpty) +} + +/// Delegate an object capability into another principal's table with +/// attenuated rights. Requires DERIVE on the source; escalation is rejected by +/// the capability table. The child keeps a parent link for tree revocation. +pub fn delegate_object( + from: &mut CapTable, + handle: Handle, + to: &mut CapTable, + rights: Rights, +) -> Result { + gated(from, handle, Rights::READ, OBJECT_RESOURCE)?; + if !rights.is_subset_of(Rights::READ | Rights::WRITE) { + return Err(IpcError::MissingRights); + } + CapTable::derive_into(from, handle, to, rights).map_err(IpcError::from) +} + +/// Read one word of a kernel object through a READ capability. +pub fn object_read( + table: &CapTable, + handle: Handle, + offset: usize, +) -> Result { + gated(table, handle, Rights::READ, OBJECT_RESOURCE)?; + if offset >= OBJECT_SLOTS { + return Err(IpcError::WrongResource); + } + // SAFETY: EL1-only state; bounds checked above. + Ok(unsafe { OBJECT[offset] }) +} + +/// Write one word of a kernel object through a WRITE capability. +pub fn object_write( + table: &mut CapTable, + handle: Handle, + offset: usize, + value: u64, +) -> Result<(), IpcError> { + gated(table, handle, Rights::WRITE, OBJECT_RESOURCE)?; + if offset >= OBJECT_SLOTS { + return Err(IpcError::WrongResource); + } + // SAFETY: EL1-only state; bounds checked above. + unsafe { OBJECT[offset] = value }; + Ok(()) +} + +/// Revoke an ancestor object capability; every derived child in the supplied +/// table set becomes invalid. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn revoke_object_ancestor(owner: u32, handle: Handle) -> Result<(), IpcError> { + let mut tables = [ + unsafe { (&raw mut PRINCIPAL_TABLES[0]).as_mut().unwrap() }, + unsafe { (&raw mut PRINCIPAL_TABLES[1]).as_mut().unwrap() }, + ]; + CapTable::::revoke(owner, handle, &mut tables).map_err(IpcError::from) +} + +/// Look a raw handle up in the active principal's table for `right`, bounded +/// to `resource`. The EL0 entry point for every object/channel operation. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn active_lookup(handle: Handle, right: Rights, resource: u32) -> Result<(), IpcError> { + let index = + principal_index(ACTIVE_PRINCIPAL.load(Ordering::Acquire)).ok_or(IpcError::InvalidHandle)?; + let table = unsafe { (&raw mut PRINCIPAL_TABLES[index]).as_mut().unwrap() }; + gated(table, handle, right, resource) +} + +/// Resolve the table for a principal index without an active-principal check; +/// callers gate authority themselves. +/// +/// # Safety +/// Exclusive access to the kernel IPC state; indices must be distinct when +/// two tables are held at once. +unsafe fn principal_table_at(index: usize) -> &'static mut CapTable { + unsafe { (&raw mut PRINCIPAL_TABLES[index]).as_mut().unwrap() } +} + +fn active_index() -> Result { + principal_index(ACTIVE_PRINCIPAL.load(Ordering::Acquire)).ok_or(IpcError::InvalidHandle) +} + +/// Send on a channel from the active principal's table. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn channel_send_active(handle: Handle, message: Message) -> Result<(), IpcError> { + let index = active_index()?; + let table = unsafe { principal_table_at(index) }; + channel_send(table, handle, message) +} + +/// Receive from a channel on the active principal's table. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn channel_receive_active(handle: Handle) -> Result { + let index = active_index()?; + let table = unsafe { principal_table_at(index) }; + channel_receive(table, handle) +} + +/// Delegate from the active principal's table into another principal's table. +/// The source is always the active principal, so a task can never delegate a +/// capability it does not itself hold. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn delegate_from_active( + handle: Handle, + to_index: u32, + rights: Rights, +) -> Result { + let from_index = active_index()?; + let to_index = principal_index(match to_index { + 0 => PRINCIPAL_A, + 1 => PRINCIPAL_B, + _ => return Err(IpcError::InvalidHandle), + }) + .ok_or(IpcError::InvalidHandle)?; + if from_index == to_index { + return Err(IpcError::InvalidHandle); + } + let from = unsafe { principal_table_at(from_index) }; + let to = unsafe { principal_table_at(to_index) }; + delegate_object(from, handle, to, rights) +} + +/// Read a kernel object word from the active principal's table. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn object_read_active(handle: Handle, offset: usize) -> Result { + let index = active_index()?; + let table = unsafe { principal_table_at(index) }; + object_read(table, handle, offset) +} + +/// Write a kernel object word from the active principal's table. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn object_write_active( + handle: Handle, + offset: usize, + value: u64, +) -> Result<(), IpcError> { + let index = active_index()?; + let table = unsafe { principal_table_at(index) }; + object_write(table, handle, offset, value) +} + +/// Access the active principal's table mutably. +/// +/// # Safety +/// Exclusive access to the kernel IPC state (EL1, single CPU). +pub unsafe fn active_table() -> &'static mut CapTable { + let index = + principal_index(ACTIVE_PRINCIPAL.load(Ordering::Acquire)).expect("active principal"); + unsafe { (&raw mut PRINCIPAL_TABLES[index]).as_mut().unwrap() } +} + +#[cfg(test)] +mod tests { + use super::*; + + static TEST_SERIAL: AtomicU32 = AtomicU32::new(0); + + /// Tests share the kernel-owned IPC statics; serialize them. The guard + /// releases on drop so a panicking test cannot wedge the rest. + struct Serial; + impl Drop for Serial { + fn drop(&mut self) { + TEST_SERIAL.store(0, Ordering::Release); + } + } + fn serial() -> Serial { + while TEST_SERIAL + .compare_exchange(0, 1, Ordering::AcqRel, Ordering::Acquire) + .is_err() + { + core::hint::spin_loop(); + } + Serial + } + + fn message(kind: u32) -> Message { + Message { + kind, + _pad: 0, + payload: [kind as u64, 0x22, 0x33], + region: MemoryRegion { + base: 0x1000, + pages: 2, + _pad: 0, + }, + object: ObjectId(0x0a), + } + } + + #[test] + fn message_abi_is_fixed_size_and_unaligned_free() { + let _serial = serial(); + assert_eq!(core::mem::size_of::(), 56); + assert_eq!(core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::size_of::(), 4); + assert_eq!(core::mem::size_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + } + + #[test] + fn channel_is_fifo_and_bounded() { + let _serial = serial(); + let mut channel: Channel<2> = Channel::new(); + assert!(channel.is_empty()); + channel.send(message(1)).unwrap(); + channel.send(message(2)).unwrap(); + assert_eq!(channel.send(message(3)), Err(ChannelError::Full)); + assert_eq!(channel.receive().unwrap(), message(1)); + assert_eq!(channel.receive().unwrap(), message(2)); + assert_eq!(channel.receive(), Err(ChannelError::Empty)); + // Wrap deterministically after drain. + channel.send(message(4)).unwrap(); + assert_eq!(channel.receive().unwrap(), message(4)); + } + + #[test] + fn send_requires_write_and_receive_requires_read() { + let _serial = serial(); + let (a_send, _a_object, b_recv) = unsafe { reset() }; + let a = unsafe { active_table() }; + // A's send handle lacks READ, so receive must be denied even for A. + assert_eq!(channel_receive(a, a_send), Err(IpcError::MissingRights)); + // B's receive handle lacks WRITE, so send must be denied. + set_active_principal(TaskId(PRINCIPAL_B)); + let b = unsafe { active_table() }; + assert_eq!( + channel_send(b, b_recv, message(9)), + Err(IpcError::MissingRights) + ); + assert!(channel_table().is_empty()); + } + + #[test] + fn stale_and_forged_handles_are_invalid() { + let _serial = serial(); + let (a_send, _a_object, _b_recv) = unsafe { reset() }; + let mut forged = a_send; + forged.generation = forged.generation.wrapping_add(1); + let a = unsafe { active_table() }; + assert_eq!( + channel_send(a, forged, message(1)), + Err(IpcError::InvalidHandle) + ); + // Tombstoned index with an old generation is equally invalid. + let mut stale = a_send; + stale.index = TABLE_CAPACITY as u32 + 1; + assert_eq!( + channel_send(a, stale, message(1)), + Err(IpcError::InvalidHandle) + ); + } + + #[test] + fn delegation_without_derive_right_is_denied() { + let _serial = serial(); + let (_a_send, _a_object, _b_recv) = unsafe { reset() }; + let mut b = CapTable::::new(PRINCIPAL_B); + // Strip DERIVE from A's object capability first: derive a READ-only + // child into a scratch table, revoke the original... simpler: build a + // source without DERIVE directly. + let a = unsafe { active_table() }; + let plain = a.insert(OBJECT_RESOURCE, Rights::READ).unwrap(); + assert_eq!( + delegate_object(a, plain, &mut b, Rights::READ), + Err(IpcError::MissingRights) + ); + } + + #[test] + fn rights_escalation_is_rejected() { + let _serial = serial(); + let (_a_send, a_object, _b_recv) = unsafe { reset() }; + let a = unsafe { active_table() }; + let mut b = CapTable::::new(PRINCIPAL_B); + assert_eq!( + delegate_object(a, a_object, &mut b, Rights::READ | Rights::MAP), + Err(IpcError::MissingRights), + "delegating a right the source does not hold is escalation" + ); + // READ|WRITE is a legal subset of the source and must succeed. + assert!(delegate_object(a, a_object, &mut b, Rights::READ | Rights::WRITE).is_ok()); + } + + #[test] + fn receiver_table_full_rolls_back_cleanly() { + let _serial = serial(); + let (_a_send, a_object, _b_recv) = unsafe { reset() }; + let a = unsafe { active_table() }; + let mut tiny = CapTable::<1>::new(PRINCIPAL_B); + tiny.insert(CHANNEL_RESOURCE, Rights::READ).unwrap(); + assert_eq!( + CapTable::derive_into(a, a_object, &mut tiny, Rights::READ), + Err(CapError::Full) + ); + // The source must be untouched by the failed derivation: it can still + // derive into a table with room. + let mut fresh = CapTable::::new(0x515); + assert!(CapTable::derive_into(a, a_object, &mut fresh, Rights::READ).is_ok()); + } + + #[test] + fn attenuated_child_cannot_write_or_escalate() { + let _serial = serial(); + let (_a_send, a_object, _b_recv) = unsafe { reset() }; + let a = unsafe { active_table() }; + let mut b = CapTable::::new(PRINCIPAL_B); + let child = CapTable::derive_into(a, a_object, &mut b, Rights::READ).unwrap(); + assert_eq!(object_read(&b, child, 0), Ok(OBJECT_INITIALIZER[0])); + assert_eq!( + object_write(&mut b, child, 0, 0xdead), + Err(IpcError::MissingRights) + ); + // The child cannot re-delegate either: it lacks DERIVE. + let mut c = CapTable::::new(0x515); + assert_eq!( + CapTable::derive_into(&mut b, child, &mut c, Rights::READ), + Err(CapError::MissingRights) + ); + } + + #[test] + fn ancestor_revocation_reaches_the_derived_child() { + let _serial = serial(); + let (_a_send, a_object, _b_recv) = unsafe { reset() }; + let a = unsafe { active_table() }; + set_active_principal(TaskId(PRINCIPAL_B)); + let b = unsafe { active_table() }; + let child = CapTable::derive_into(a, a_object, b, Rights::READ).unwrap(); + assert!(object_read(b, child, 1).is_ok()); + unsafe { revoke_object_ancestor(PRINCIPAL_A, a_object).unwrap() }; + assert_eq!( + object_read(b, child, 1), + Err(IpcError::InvalidHandle), + "revoking the ancestor invalidates the derived handle" + ); + // And the owner's own capability is gone too. + assert_eq!(object_read(a, a_object, 1), Err(IpcError::InvalidHandle)); + } + + #[test] + fn end_to_end_send_delegate_receive_read() { + let _serial = serial(); + let (a_send, a_object, b_recv) = unsafe { reset() }; + let a = unsafe { active_table() }; + channel_send(a, a_send, message(7)).unwrap(); + set_active_principal(TaskId(PRINCIPAL_B)); + let b = unsafe { active_table() }; + let child = CapTable::derive_into(a, a_object, b, Rights::READ).unwrap(); + let received = channel_receive(b, b_recv).unwrap(); + assert_eq!(received, message(7)); + assert_eq!(object_read(b, child, 0), Ok(OBJECT_INITIALIZER[0])); + assert_eq!(object_write(b, child, 0, 1), Err(IpcError::MissingRights)); + } + + const OBJECT_INITIALIZER: [u64; OBJECT_SLOTS] = + [0xc0ff_ee01, 0x0bad_c0de, 0x1234_5678, 0x9abc_def0]; +} diff --git a/crates/aienos-kernel/src/lib.rs b/crates/aienos-kernel/src/lib.rs index 8b851264..eb4648b7 100644 --- a/crates/aienos-kernel/src/lib.rs +++ b/crates/aienos-kernel/src/lib.rs @@ -22,6 +22,7 @@ pub mod display; pub mod fatal; pub mod gic; pub mod infer; +pub mod ipc; pub mod mem; pub mod net; pub mod nvme; diff --git a/crates/aienos-kernel/src/user.rs b/crates/aienos-kernel/src/user.rs index b7bcba58..b6028073 100644 --- a/crates/aienos-kernel/src/user.rs +++ b/crates/aienos-kernel/src/user.rs @@ -17,12 +17,17 @@ pub struct TrapFrame { pub fpsr: u64, pub q: [u128; 32], } -use core::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}; +use core::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, AtomicUsize, Ordering}; pub const SYS_WRITE: u64 = 1; pub const SYS_EXIT: u64 = 2; pub const CONSOLE_RESOURCE: u32 = 1; pub const SYSCALL_DENIED: u64 = u64::MAX; +pub const SYS_CHANNEL_SEND: u64 = 3; +pub const SYS_CHANNEL_RECV: u64 = 4; +pub const SYS_CAP_DELEGATE: u64 = 5; +pub const SYS_OBJECT_READ: u64 = 6; +pub const SYS_OBJECT_WRITE: u64 = 7; const PAGE_BYTES: usize = 4096; const TABLE_DESCRIPTOR: u64 = 0b11; @@ -60,6 +65,63 @@ static FAULT_CONTAINED: AtomicBool = AtomicBool::new(false); static EXIT_CODE: AtomicU64 = AtomicU64::new(u64::MAX); static AUTHORIZED_HANDLE: AtomicU64 = AtomicU64::new(0); static USER_VA_BASE: AtomicU64 = AtomicU64::new(0); +// --- typed IPC proof state (PR #30): kernel-owned, dispatcher-consumed ----- +static IPC_ACTIVE: AtomicBool = AtomicBool::new(false); +static IPC_PHASE: AtomicU32 = AtomicU32::new(0); +static IPC_EXIT: AtomicU64 = AtomicU64::new(u64::MAX); +static IPC_MESSAGE_DELIVERED: AtomicBool = AtomicBool::new(false); +static IPC_CAP_DELEGATED: AtomicBool = AtomicBool::new(false); +static IPC_RIGHTS_ATTENUATED: AtomicBool = AtomicBool::new(false); +static IPC_FORGED_DENIED: AtomicBool = AtomicBool::new(false); +static IPC_REVOKED_DENIED: AtomicBool = AtomicBool::new(false); +static IPC_CHILD_HANDLE: AtomicU64 = AtomicU64::new(0); +static IPC_SENT_KIND: AtomicU64 = AtomicU64::new(0); +static IPC_SENT_P0: AtomicU64 = AtomicU64::new(0); +static IPC_SENT_P1: AtomicU64 = AtomicU64::new(0); +static IPC_SENT_OBJ: AtomicU64 = AtomicU64::new(0); + +/// A private EL0 address window: four translation levels plus code and stack. +#[repr(C, align(4096))] +struct TaskWindow { + l0: Page, + l1: Page, + l2: Page, + l3: Page, + code: Page, + stack: Page, +} + +impl TaskWindow { + const fn new() -> Self { + Self { + l0: Page([0; 512]), + l1: Page([0; 512]), + l2: Page([0; 512]), + l3: Page([0; 512]), + code: Page([0; 512]), + stack: Page([0; 512]), + } + } +} + +static mut IPC_WINDOW_A: TaskWindow = TaskWindow::new(); +static mut IPC_WINDOW_B: TaskWindow = TaskWindow::new(); + +/// Observed result of the two-principal EL0 IPC proof. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct IpcResult { + pub ok: bool, + pub exit_a: u64, + pub child_raw: u64, + pub exit_b0: u64, + pub exit_b1: u64, + pub message_delivered: bool, + pub cap_delegated: bool, + pub rights_attenuated: bool, + pub forged_denied: bool, + pub revoked_denied: bool, + pub exit_codes_clean: bool, +} pub type WriteHook = fn(&[u8]); @@ -137,16 +199,22 @@ pub unsafe extern "C" fn aienos_lower_el_sync_dispatcher(frame: *mut TrapFrame) esr = 0; } match (esr >> 26) & 0x3f { - 0x15 if esr & 0xffff == 0 => match frame.x[8] { - SYS_WRITE => dispatch_write(frame), - SYS_EXIT => { - EXIT_CODE.store(frame.x[0], Ordering::Release); - USER_ACTIVE.store(false, Ordering::Release); - frame.elr_el1 = user_resume_address(); - frame.spsr_el1 = 0x5; + 0x15 if esr & 0xffff == 0 => { + if IPC_ACTIVE.load(Ordering::Acquire) { + dispatch_ipc(frame); + } else { + match frame.x[8] { + SYS_WRITE => dispatch_write(frame), + SYS_EXIT => { + EXIT_CODE.store(frame.x[0], Ordering::Release); + USER_ACTIVE.store(false, Ordering::Release); + frame.elr_el1 = user_resume_address(); + frame.spsr_el1 = 0x5; + } + _ => frame.x[0] = SYSCALL_DENIED, + } } - _ => frame.x[0] = SYSCALL_DENIED, - }, + } 0x24 => { FAULT_CONTAINED.store(true, Ordering::Release); frame.elr_el1 = frame.elr_el1.wrapping_add(4); @@ -160,6 +228,464 @@ pub unsafe extern "C" fn aienos_lower_el_sync_dispatcher(frame: *mut TrapFrame) } } +/// EL1-side dispatcher for the typed IPC syscalls. Every operation resolves +/// handles against the active principal's own capability table; there is no +/// ambient authority. +fn dispatch_ipc(frame: &mut TrapFrame) { + match frame.x[8] { + SYS_CHANNEL_SEND => { + let message = crate::ipc::Message { + kind: frame.x[1] as u32, + _pad: 0, + payload: [frame.x[2], frame.x[3], frame.x[4]], + region: crate::ipc::MemoryRegion { + base: frame.x[5], + pages: frame.x[6] as u32, + _pad: 0, + }, + object: crate::ipc::ObjectId(frame.x[7]), + }; + let result = + unsafe { crate::ipc::channel_send_active(unpack_handle(frame.x[0]), message) }; + match result { + Ok(()) => { + IPC_SENT_KIND.store(frame.x[1], Ordering::Release); + IPC_SENT_P0.store(frame.x[2], Ordering::Release); + IPC_SENT_P1.store(frame.x[3], Ordering::Release); + IPC_SENT_OBJ.store(frame.x[7], Ordering::Release); + frame.x[0] = 0; + } + Err(_) => frame.x[0] = SYSCALL_DENIED, + } + } + SYS_CHANNEL_RECV => { + match unsafe { crate::ipc::channel_receive_active(unpack_handle(frame.x[0])) } { + Ok(message) => { + let delivered = message.kind as u64 == IPC_SENT_KIND.load(Ordering::Acquire) + && message.payload[0] == IPC_SENT_P0.load(Ordering::Acquire) + && message.payload[1] == IPC_SENT_P1.load(Ordering::Acquire) + && message.object.0 == IPC_SENT_OBJ.load(Ordering::Acquire); + if delivered { + IPC_MESSAGE_DELIVERED.store(true, Ordering::Release); + } + frame.x[0] = 0; + frame.x[1] = message.kind as u64; + frame.x[2] = message.payload[0]; + frame.x[3] = message.payload[1]; + frame.x[4] = message.payload[2]; + frame.x[5] = message.object.0; + } + Err(_) => frame.x[0] = SYSCALL_DENIED, + } + } + SYS_CAP_DELEGATE => match Rights::from_bits(frame.x[2] as u8) { + Some(rights) => { + match unsafe { + crate::ipc::delegate_from_active( + unpack_handle(frame.x[0]), + frame.x[1] as u32, + rights, + ) + } { + Ok(child) => { + IPC_CAP_DELEGATED.store(true, Ordering::Release); + IPC_CHILD_HANDLE.store(pack_handle(child), Ordering::Release); + frame.x[0] = 0; + } + Err(_) => frame.x[0] = SYSCALL_DENIED, + } + } + None => frame.x[0] = SYSCALL_DENIED, + }, + SYS_OBJECT_READ => { + match unsafe { + crate::ipc::object_read_active(unpack_handle(frame.x[0]), frame.x[1] as usize) + } { + Ok(value) => frame.x[0] = value, + Err(crate::ipc::IpcError::InvalidHandle) => { + if IPC_PHASE.load(Ordering::Acquire) & 0xff != 0 { + // Post-revocation retry: the ancestor revocation reached + // this derived handle. + IPC_REVOKED_DENIED.store(true, Ordering::Release); + } else { + // Deliberately corrupted handle. + IPC_FORGED_DENIED.store(true, Ordering::Release); + } + frame.x[0] = SYSCALL_DENIED; + } + Err(_) => frame.x[0] = SYSCALL_DENIED, + } + } + SYS_OBJECT_WRITE => { + match unsafe { + crate::ipc::object_write_active( + unpack_handle(frame.x[0]), + frame.x[1] as usize, + frame.x[2], + ) + } { + Ok(()) => frame.x[0] = 0, + Err(crate::ipc::IpcError::MissingRights) => { + IPC_RIGHTS_ATTENUATED.store(true, Ordering::Release); + frame.x[0] = SYSCALL_DENIED; + } + Err(_) => frame.x[0] = SYSCALL_DENIED, + } + } + SYS_EXIT => { + IPC_EXIT.store(frame.x[0], Ordering::Release); + frame.elr_el1 = user_resume_address(); + frame.spsr_el1 = 0x5; + } + _ => frame.x[0] = SYSCALL_DENIED, + } +} + +/// Map a fresh EL0 window (kernel-derived tables, read-only code, read-write +/// non-executable stack), copy `image` into the code page, and clean caches. +/// +/// # Safety +/// Window pointers must address live, exclusive, 4096-aligned statics. +#[cfg(target_arch = "aarch64")] +unsafe fn build_window(window: *mut TaskWindow, image: &[u8], kernel_root: usize) -> u64 { + let window = unsafe { &mut *window }; + window.l0.0.fill(0); + window.l1.0.fill(0); + window.l2.0.fill(0); + window.l3.0.fill(0); + window.code.0.fill(0); + window.stack.0.fill(0); + unsafe { + core::ptr::copy_nonoverlapping(kernel_root as *const u64, window.l0.0.as_mut_ptr(), 512) + }; + let user_root_index = (1..256) + .find(|index| window.l0.0[*index] == 0) + .expect("kernel mappings leave no EL0 address window"); + let user_base = (user_root_index as u64) << 39; + window.l0.0[user_root_index] = + (core::ptr::addr_of!(window.l1) as u64 & ADDRESS_MASK) | TABLE_DESCRIPTOR; + window.l1.0[0] = (core::ptr::addr_of!(window.l2) as u64 & ADDRESS_MASK) | TABLE_DESCRIPTOR; + window.l2.0[0] = (core::ptr::addr_of!(window.l3) as u64 & ADDRESS_MASK) | TABLE_DESCRIPTOR; + let code_pa = core::ptr::addr_of!(window.code) as u64; + let stack_pa = core::ptr::addr_of!(window.stack) as u64; + window.l3.0[0] = + (code_pa & ADDRESS_MASK) | PAGE_DESCRIPTOR | (0b11 << 6) | (0b11 << 8) | AF | NG | PXN; + window.l3.0[1] = (stack_pa & ADDRESS_MASK) + | PAGE_DESCRIPTOR + | (0b01 << 6) + | (0b11 << 8) + | AF + | NG + | PXN + | UXN; + assert!(image.len() <= PAGE_BYTES, "EL0 code page overflow"); + unsafe { core::ptr::copy_nonoverlapping(image.as_ptr(), code_pa as *mut u8, image.len()) }; + unsafe { + clean_and_invalidate( + core::ptr::addr_of!(window.l0) as usize, + PAGE_BYTES * 4, + false, + ); + clean_and_invalidate(code_pa as usize, PAGE_BYTES, true); + clean_and_invalidate(stack_pa as usize, PAGE_BYTES, false); + } + user_base +} + +#[cfg(target_arch = "aarch64")] +unsafe fn swap_ttbr0(root: u64) { + core::arch::asm!( + "dsb ish", + "msr ttbr0_el1, {0}", + "tlbi vmalle1", + "dsb ish", + "isb", + in(reg) root, + options(nostack) + ); +} + +/// Two-principal typed-IPC proof at EL0. +/// +/// Principal A holds the channel send right and a full-rights object +/// capability; it sends one typed message and delegates a READ-only copy of +/// the object capability to principal B. B receives the exact message, reads +/// the object through the attenuated handle, is denied a write and a forged +/// handle. The kernel then revokes A's ancestor and B's derived handle stops +/// working. +/// +/// # Safety +/// `kernel_root` must be the active identity-mapped TTBR0 root and vectors +/// must already be installed at EL1. +pub unsafe fn run_ipc_demo(kernel_root: usize) -> IpcResult { + #[cfg(target_arch = "aarch64")] + { + unsafe { run_ipc_demo_inner(kernel_root) } + } + #[cfg(not(target_arch = "aarch64"))] + { + let _ = kernel_root; + IpcResult { + ok: true, + exit_a: 0, + child_raw: 0, + exit_b0: 0, + exit_b1: 0, + message_delivered: true, + cap_delegated: true, + rights_attenuated: true, + forged_denied: true, + revoked_denied: true, + exit_codes_clean: true, + } + } +} + +#[cfg(target_arch = "aarch64")] +unsafe fn run_ipc_demo_inner(kernel_root: usize) -> IpcResult { + IPC_MESSAGE_DELIVERED.store(false, Ordering::Release); + IPC_CAP_DELEGATED.store(false, Ordering::Release); + IPC_RIGHTS_ATTENUATED.store(false, Ordering::Release); + IPC_FORGED_DENIED.store(false, Ordering::Release); + IPC_REVOKED_DENIED.store(false, Ordering::Release); + IPC_CHILD_HANDLE.store(0, Ordering::Release); + IPC_EXIT.store(u64::MAX, Ordering::Release); + + let (a_send, a_object, b_recv) = crate::ipc::reset(); + let image_start = core::ptr::addr_of!(aienos_ipc_code_start) as usize; + let image_end = core::ptr::addr_of!(aienos_ipc_code_end) as usize; + let image = + unsafe { core::slice::from_raw_parts(image_start as *const u8, image_end - image_start) }; + + let base_a = unsafe { build_window(core::ptr::addr_of_mut!(IPC_WINDOW_A), image, kernel_root) }; + let base_b = unsafe { build_window(core::ptr::addr_of_mut!(IPC_WINDOW_B), image, kernel_root) }; + + let window_a = unsafe { &mut *core::ptr::addr_of_mut!(IPC_WINDOW_A) }; + let window_b = unsafe { &mut *core::ptr::addr_of_mut!(IPC_WINDOW_B) }; + let root_a = core::ptr::addr_of!(window_a.l0) as u64; + let root_b = core::ptr::addr_of!(window_b.l0) as u64; + let kernel_root_u64 = kernel_root as u64; + + IPC_ACTIVE.store(true, Ordering::Release); + + // --- principal A: send the typed message, delegate an attenuated copy --- + crate::ipc::set_active_principal(crate::ipc::TaskId(crate::ipc::PRINCIPAL_A)); + IPC_PHASE.store(0, Ordering::Release); + IPC_EXIT.store(u64::MAX, Ordering::Release); + unsafe { swap_ttbr0(root_a) }; + unsafe { + aienos_ipc_enter( + base_a, + base_a + 0x1000 + PAGE_BYTES as u64, + pack_handle(a_send), + pack_handle(a_object), + 1, + ) + }; + unsafe { swap_ttbr0(kernel_root_u64) }; + let exit_a = IPC_EXIT.load(Ordering::Acquire); + + // --- principal B, phase 0: receive, read, attempt write, forge ---------- + let child_handle = IPC_CHILD_HANDLE.load(Ordering::Acquire); + crate::ipc::set_active_principal(crate::ipc::TaskId(crate::ipc::PRINCIPAL_B)); + IPC_PHASE.store(0, Ordering::Release); + IPC_EXIT.store(u64::MAX, Ordering::Release); + unsafe { swap_ttbr0(root_b) }; + unsafe { + aienos_ipc_enter( + base_b, + base_b + 0x1000 + PAGE_BYTES as u64, + pack_handle(b_recv), + child_handle, + 2, + ) + }; + unsafe { swap_ttbr0(kernel_root_u64) }; + let exit_b0 = IPC_EXIT.load(Ordering::Acquire); + + // --- kernel revokes A's ancestor; B's derived handle must die ---------- + unsafe { crate::ipc::revoke_object_ancestor(crate::ipc::PRINCIPAL_A, a_object) } + .expect("ancestor revocation"); + + // --- principal B, phase 1: the derived handle no longer resolves ------- + IPC_PHASE.store(1, Ordering::Release); + IPC_EXIT.store(u64::MAX, Ordering::Release); + unsafe { swap_ttbr0(root_b) }; + unsafe { + aienos_ipc_enter( + base_b, + base_b + 0x1000 + PAGE_BYTES as u64, + pack_handle(b_recv), + child_handle, + 0x102, + ) + }; + unsafe { swap_ttbr0(kernel_root_u64) }; + let exit_b1 = IPC_EXIT.load(Ordering::Acquire); + + IPC_ACTIVE.store(false, Ordering::Release); + + let result = IpcResult { + ok: false, + exit_a, + child_raw: IPC_CHILD_HANDLE.load(Ordering::Acquire), + exit_b0, + exit_b1, + message_delivered: IPC_MESSAGE_DELIVERED.load(Ordering::Acquire), + cap_delegated: IPC_CAP_DELEGATED.load(Ordering::Acquire), + rights_attenuated: IPC_RIGHTS_ATTENUATED.load(Ordering::Acquire), + forged_denied: IPC_FORGED_DENIED.load(Ordering::Acquire), + revoked_denied: IPC_REVOKED_DENIED.load(Ordering::Acquire), + exit_codes_clean: exit_a == 0 && exit_b0 == 0 && exit_b1 == 0, + }; + IpcResult { + ok: result.message_delivered + && result.cap_delegated + && result.rights_attenuated + && result.forged_denied + && result.revoked_denied + && result.exit_codes_clean, + ..result + } +} + +#[cfg(target_arch = "aarch64")] +core::arch::global_asm!( + ".global aienos_ipc_enter", + ".global aienos_ipc_code_start", + ".global aienos_ipc_code_end", + // x0=entry, x1=sp_el0, x2=handle0 -> x20, x3=handle1 -> x21, x4=arg -> x22 + "aienos_ipc_enter:", + "sub sp, sp, #96", + "stp x19, x20, [sp, #0]", + "stp x21, x22, [sp, #16]", + "stp x23, x24, [sp, #32]", + "stp x25, x26, [sp, #48]", + "stp x27, x28, [sp, #64]", + "stp x29, x30, [sp, #80]", + "mov x20, x2", + "mov x21, x3", + "mov x22, x4", + "msr sp_el0, x1", + "msr elr_el1, x0", + "msr spsr_el1, xzr", + "mov x0, x4", + "eret", + "aienos_ipc_code_start:", + "mov x23, xzr", + "cmp x22, #1", + "b.eq 10f", + "tbnz x22, #8, 50f", + "b 20f", + // ---- principal A: send, delegate attenuated, exit ---- + "10:", + "mov x0, x20", + "mov x1, #7", + "mov x2, #0x1111", + "mov x3, #0x2222", + "mov x4, #0x3333", + "mov x5, #0xa", + "mov x6, #0x1000", + "mov x7, #2", + "mov x8, #3", + "svc #0", + "cmp x0, #0", + "b.eq 15f", + "orr x23, x23, #32", + "15:", + "mov x0, x21", + "mov x1, #1", + "mov x2, #1", + "mov x8, #5", + "svc #0", + "cmp x0, #0", + "b.eq 16f", + "orr x23, x23, #64", + "16:", + "mov x0, x23", + "mov x8, #2", + "svc #0", + "70: b 70b", + // ---- principal B, phase 0: receive, read, write-attempt, forge ---- + "20:", + "mov x0, x20", + "mov x8, #4", + "svc #0", + "cmp x0, #0", + "b.eq 21f", + "orr x23, x23, #1", + "21:", + "cmp x1, #7", + "b.eq 22f", + "orr x23, x23, #1", + "22:", + "movz x5, #0x1111", + "cmp x2, x5", + "b.eq 23f", + "orr x23, x23, #1", + "23:", + "movz x5, #0x2222", + "cmp x3, x5", + "b.eq 24f", + "orr x23, x23, #1", + "24:", + "mov x0, x21", + "mov x1, #0", + "mov x8, #6", + "svc #0", + "movz x5, #0xee01", + "movk x5, #0xc0ff, lsl #16", + "cmp x0, x5", + "b.eq 25f", + "orr x23, x23, #2", + "25:", + "mov x0, x21", + "mov x1, #0", + "mov x2, #0xbad", + "mov x8, #7", + "svc #0", + "cmp x0, #0", + "b.ne 26f", + "orr x23, x23, #4", + "26:", + "mov x6, #1", + "lsl x6, x6, #32", + "eor x0, x21, x6", + "mov x1, #0", + "mov x8, #6", + "svc #0", + "cmp x0, #0", + "b.ne 27f", + "orr x23, x23, #8", + "27:", + "mov x0, x23", + "mov x8, #2", + "svc #0", + "71: b 71b", + // ---- principal B, phase 1: revoked handle must not resolve ---- + "50:", + "mov x0, x21", + "mov x1, #0", + "mov x8, #6", + "svc #0", + "cmp x0, #0", + "b.ne 51f", + "orr x23, x23, #16", + "51:", + "mov x0, x23", + "mov x8, #2", + "svc #0", + "72: b 72b", + "aienos_ipc_code_end:", +); + +#[cfg(target_arch = "aarch64")] +extern "C" { + fn aienos_ipc_enter(entry: u64, stack: u64, handle0: u64, handle1: u64, arg: u64); + static aienos_ipc_code_start: u8; + static aienos_ipc_code_end: u8; +} + #[cfg(target_arch = "aarch64")] core::arch::global_asm!( ".global aienos_enter_user", diff --git a/evidence/m3_typed_ipc_2026-09-24.md b/evidence/m3_typed_ipc_2026-09-24.md new file mode 100644 index 00000000..ef90eb48 --- /dev/null +++ b/evidence/m3_typed_ipc_2026-09-24.md @@ -0,0 +1,78 @@ +# Evidence: typed IPC with capability-gated channels and attenuated, +# revocable delegation across two isolated EL0 principals + +Branch: feat/m3-typed-ipc +Base: 668202e (main after PR #105) +Commit under test: the branch tip including +feat(ipc): typed channels with capability-gated send, receive and delegation + +## Exact successful invocation + + AIENOS_QEMU_VERBOSE=1 AIENOS_QEMU_TIMEOUT=90 bash scripts/qemu_boot_test.sh + +Exit 0, QEMU_BOOT: PASS. + +## Environment + +- Host: spark-b87b +- QEMU 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18), virt, gic-version=3, -smp 4 +- Image: aienos-handoff.efi, aarch64-unknown-uefi, --features handoff + +## Serial proof (raw lines) + + el0: ok write=granted forged=denied fault=contained exit=0 + preempt: ok a=5785207 b=3777034 switches=4 + placement: worker0=class0/core0 worker1=class0/core1 + ipc: ok message=delivered cap=delegated rights=attenuated forged=denied revoked=denied + +Exit codes observed during the run: A = 0, B phase 0 = 0, B phase 1 = 0 +(each principal exits with an accumulated verdict; zero means every EL0-side +check held). + +## What the result demonstrates + +Two isolated EL0 principals with separate TTBR0 roots and separate kernel-owned +capability tables: + +1. message=delivered: principal A (channel WRITE capability) sent a fixed-size + typed Message (kind, three payload words, MemoryRegion, ObjectId) into the + kernel-owned bounded ring; principal B (channel READ capability) received a + message whose every field matched what A sent. +2. cap=delegated: A delegated its object capability into B's table through + CapTable::derive_into, which requires DERIVE on the source, rejects rights + escalation, and links the child to its parent for tree revocation. +3. rights=attenuated: the child carries READ only. B's object WRITE through the + derived handle was denied (MissingRights) and recorded as attenuation. +4. forged=denied: B presented a handle with a corrupted generation; the + capability table rejected it as invalid. +5. revoked=denied: the kernel revoked A's ancestor capability + (CapTable::revoke across both tables); B's derived handle then failed to + resolve at all. + +Send and receive rights are enforced independently (A's send handle cannot +receive; B's receive handle cannot send), and delegation targets only the +active principal's counterparts, so no task can delegate authority it does not +hold. + +## Host tests (10, in ipc.rs) + +message ABI fixed size/alignment; channel FIFO, bounded and wrap-on-drain; +send requires WRITE and receive requires READ; stale/forged handles invalid; +delegation without DERIVE denied; rights escalation rejected; receiver table +full rolls back cleanly (source stays usable); attenuated child cannot write +or re-delegate; ancestor revocation reaches the derived child; end-to-end +send -> delegate -> receive -> read with write denied. + +## Design notes + +- `CapTable::derive_into` is the delegation primitive. `CapTable::transfer` + (same-rights copy, no ancestry) is not used by the proof and remains + available; attenuation with revocation ancestry is the M3 security model. +- Channels are kernel-owned fixed rings (8 x 56-byte repr(C) messages); there + is no global channel lookup that bypasses the caller's capability table. +- The two principals run sequentially with separate TTBR0 roots; concurrent + multi-task scheduling is #29's domain and is deliberately not mixed in. + +## Boundary + +Emulator only. This says nothing about Machine 1 hardware. diff --git a/scripts/qemu_boot_test.sh b/scripts/qemu_boot_test.sh index c56f1b7d..4895bb0c 100755 --- a/scripts/qemu_boot_test.sh +++ b/scripts/qemu_boot_test.sh @@ -63,6 +63,7 @@ check "cooperative threads interleaved" "threads: ok" check "EL0 capability and fault isolation" "el0: ok write=granted forged=denied fault=contained exit=0" check "timer-driven preemption across runnable tasks" "preempt: ok" check "deterministic MADT placement of preempt workers" "placement: worker0=class0/core0 worker1=class0/core1" +check "typed IPC with attenuated revocable delegation" "ipc: ok message=delivered cap=delegated rights=attenuated forged=denied revoked=denied" check "EL1 page tables and caches enabled" "mmu: enabled" check "GICv3 enabled" "gic: v3" if grep -qE 'timer_irq: ([0-9]+) ticks' "${work}/serial.txt"; then