feat(compiler): support retained link-register pointer authentication
This commit is contained in:
1 parent
8c22eae2ef
commit
7ed97fddd6
44 files changed
+4654
-297
No files matched your search
+198
-145
@@ -15,6 +15,7 @@ use crate::{
|
||||
use serde::Serialize;
|
||||
|
||||
pub mod memory;
|
||||
pub mod pauth_lr;
|
||||
pub mod pauth_memory;
|
||||
pub use memory::{CheckedMemoryProfile, ORDINARY_GPR_PROCESS_MEMORY_PROFILE_ID};
|
||||
pub mod system;
|
||||
@@ -236,6 +237,14 @@ pub enum PointerAuthenticationModifier {
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PointerAuthenticationOperation {
|
||||
// Preserve the original descriptor representation for existing consumers.
|
||||
/// Exact HINT source identity: general PACIA X17,X16 remains distinct.
|
||||
Sign1716 {
|
||||
key: PointerAuthenticationKey,
|
||||
},
|
||||
Authenticate1716 {
|
||||
key: PointerAuthenticationKey,
|
||||
},
|
||||
LinkRegister(pauth_lr::Instruction),
|
||||
SignIbSp,
|
||||
AuthenticateIbSp,
|
||||
ReturnIbSp,
|
||||
@@ -267,6 +276,7 @@ pub enum PointerAuthenticationOperation {
|
||||
impl PointerAuthenticationOperation {
|
||||
pub const fn is_return(self) -> bool {
|
||||
matches!(self, Self::ReturnIbSp | Self::ReturnIaSp)
|
||||
|| matches!(self, Self::LinkRegister(instruction) if instruction.is_return())
|
||||
}
|
||||
|
||||
pub const fn is_transfer(self) -> bool {
|
||||
@@ -279,9 +289,16 @@ impl PointerAuthenticationOperation {
|
||||
Some(PointerAuthenticationKey::Ib)
|
||||
}
|
||||
Self::ReturnIaSp => Some(PointerAuthenticationKey::Ia),
|
||||
Self::Sign { key, .. } | Self::Authenticate { key, .. } | Self::Branch { key, .. } => {
|
||||
Some(key)
|
||||
}
|
||||
Self::Sign { key, .. }
|
||||
| Self::Authenticate { key, .. }
|
||||
| Self::Sign1716 { key }
|
||||
| Self::Authenticate1716 { key }
|
||||
| Self::Branch { key, .. } => Some(key),
|
||||
Self::LinkRegister(instruction) => match instruction.key() {
|
||||
Some(pauth_lr::Key::Ia) => Some(PointerAuthenticationKey::Ia),
|
||||
Some(pauth_lr::Key::Ib) => Some(PointerAuthenticationKey::Ib),
|
||||
None => None,
|
||||
},
|
||||
Self::Load(load) => Some(match load.key {
|
||||
pauth_memory::DataKey::A => PointerAuthenticationKey::Da,
|
||||
pauth_memory::DataKey::B => PointerAuthenticationKey::Db,
|
||||
@@ -302,7 +319,9 @@ pub struct PointerAuthentication {
|
||||
|
||||
/// June2026 PAC/AUT integer and HINT forms, XPAC, PACGA and authenticated
|
||||
/// transfers. Process keys and PAuth1/PAuth2/FPAC policy belong to the
|
||||
/// explicit runtime context; PAuth_LR/PACM, GCS and dynamic controls decline.
|
||||
/// explicit runtime context. LR descriptors require actual LR/control/PACM
|
||||
/// ownership; key-only consumers continue to decline them. GCS and general
|
||||
/// dynamic-control effects remain separate unsupported requirements.
|
||||
/// Runtime consumers revalidate this descriptor against immutable source bytes.
|
||||
pub fn decode_pointer_authentication(
|
||||
pc: GuestAddress,
|
||||
@@ -316,131 +335,119 @@ pub fn decode_pointer_authentication(
|
||||
"PAC instruction PC must be aligned to 4 bytes".into(),
|
||||
));
|
||||
}
|
||||
let operation = match word {
|
||||
0xd503237f => PointerAuthenticationOperation::SignIbSp,
|
||||
0xd50323ff => PointerAuthenticationOperation::AuthenticateIbSp,
|
||||
0xd65f0fff => PointerAuthenticationOperation::ReturnIbSp,
|
||||
0xd65f0bff => PointerAuthenticationOperation::ReturnIaSp,
|
||||
0xd503211f => Sign {
|
||||
key: Ia,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
0xd503215f => Sign {
|
||||
key: Ib,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
0xd503219f => Authenticate {
|
||||
key: Ia,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
0xd50321df => Authenticate {
|
||||
key: Ib,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
0xd503233f => Sign {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: StackPointer,
|
||||
},
|
||||
0xd50323bf => Authenticate {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: StackPointer,
|
||||
},
|
||||
0xd503231f => Sign {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd503235f => Sign {
|
||||
key: Ib,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd503239f => Authenticate {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd50323df => Authenticate {
|
||||
key: Ib,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd50320ff => Strip {
|
||||
data: false,
|
||||
destination: 30,
|
||||
},
|
||||
_ if word & 0xffffc000 == 0xdac10000 => {
|
||||
let rn = ((word >> 5) & 31) as u8;
|
||||
let modifier = if word & (1 << 13) != 0 {
|
||||
// The Z forms fix Rn=11111. Do not admit unallocated neighbors.
|
||||
if rn != 31 {
|
||||
return Ok(None);
|
||||
let operation = if let Some(instruction) = pauth_lr::decode(word) {
|
||||
PointerAuthenticationOperation::LinkRegister(instruction)
|
||||
} else {
|
||||
match word {
|
||||
0xd503237f => PointerAuthenticationOperation::SignIbSp,
|
||||
0xd50323ff => PointerAuthenticationOperation::AuthenticateIbSp,
|
||||
0xd65f0fff => PointerAuthenticationOperation::ReturnIbSp,
|
||||
0xd65f0bff => PointerAuthenticationOperation::ReturnIaSp,
|
||||
0xd503211f => PointerAuthenticationOperation::Sign1716 { key: Ia },
|
||||
0xd503215f => PointerAuthenticationOperation::Sign1716 { key: Ib },
|
||||
0xd503219f => PointerAuthenticationOperation::Authenticate1716 { key: Ia },
|
||||
0xd50321df => PointerAuthenticationOperation::Authenticate1716 { key: Ib },
|
||||
0xd503233f => Sign {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: StackPointer,
|
||||
},
|
||||
0xd50323bf => Authenticate {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: StackPointer,
|
||||
},
|
||||
0xd503231f => Sign {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd503235f => Sign {
|
||||
key: Ib,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd503239f => Authenticate {
|
||||
key: Ia,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd50323df => Authenticate {
|
||||
key: Ib,
|
||||
destination: 30,
|
||||
modifier: Zero,
|
||||
},
|
||||
0xd50320ff => Strip {
|
||||
data: false,
|
||||
destination: 30,
|
||||
},
|
||||
_ if word & 0xffffc000 == 0xdac10000 => {
|
||||
let rn = ((word >> 5) & 31) as u8;
|
||||
let modifier = if word & (1 << 13) != 0 {
|
||||
// The Z forms fix Rn=11111. Do not admit unallocated neighbors.
|
||||
if rn != 31 {
|
||||
return Ok(None);
|
||||
}
|
||||
Zero
|
||||
} else if rn == 31 {
|
||||
StackPointer
|
||||
} else {
|
||||
Register(rn)
|
||||
};
|
||||
let key = match (word >> 10) & 3 {
|
||||
0 => Ia,
|
||||
1 => Ib,
|
||||
2 => Da,
|
||||
_ => Db,
|
||||
};
|
||||
let destination = (word & 31) as u8;
|
||||
if word & (1 << 12) == 0 {
|
||||
Sign {
|
||||
key,
|
||||
destination,
|
||||
modifier,
|
||||
}
|
||||
} else {
|
||||
Authenticate {
|
||||
key,
|
||||
destination,
|
||||
modifier,
|
||||
}
|
||||
}
|
||||
Zero
|
||||
} else if rn == 31 {
|
||||
StackPointer
|
||||
} else {
|
||||
Register(rn)
|
||||
};
|
||||
let key = match (word >> 10) & 3 {
|
||||
0 => Ia,
|
||||
1 => Ib,
|
||||
2 => Da,
|
||||
_ => Db,
|
||||
};
|
||||
let destination = (word & 31) as u8;
|
||||
if word & (1 << 12) == 0 {
|
||||
Sign {
|
||||
key,
|
||||
destination,
|
||||
modifier,
|
||||
}
|
||||
} else {
|
||||
Authenticate {
|
||||
key,
|
||||
destination,
|
||||
}
|
||||
_ if word & 0xfffffbe0 == 0xdac143e0 => Strip {
|
||||
data: word & (1 << 10) != 0,
|
||||
destination: (word & 31) as u8,
|
||||
},
|
||||
_ if word & 0xfedff800 == 0xd61f0800 => {
|
||||
let rm = (word & 31) as u8;
|
||||
let modifier = if word & (1 << 24) == 0 {
|
||||
if rm != 31 {
|
||||
return Ok(None);
|
||||
}
|
||||
Zero
|
||||
} else if rm == 31 {
|
||||
StackPointer
|
||||
} else {
|
||||
Register(rm)
|
||||
};
|
||||
PointerAuthenticationOperation::Branch {
|
||||
key: if word & (1 << 10) == 0 { Ia } else { Ib },
|
||||
target: ((word >> 5) & 31) as u8,
|
||||
modifier,
|
||||
link: word & (1 << 21) != 0,
|
||||
}
|
||||
}
|
||||
_ => match pauth_memory::decode(word) {
|
||||
Some(pauth_memory::Instruction::GenericCode(code)) => {
|
||||
PointerAuthenticationOperation::GenericCode(code)
|
||||
}
|
||||
Some(pauth_memory::Instruction::Load(load)) => {
|
||||
PointerAuthenticationOperation::Load(load)
|
||||
}
|
||||
None => return Ok(None),
|
||||
},
|
||||
}
|
||||
_ if word & 0xfffffbe0 == 0xdac143e0 => Strip {
|
||||
data: word & (1 << 10) != 0,
|
||||
destination: (word & 31) as u8,
|
||||
},
|
||||
_ if word & 0xfedff800 == 0xd61f0800 => {
|
||||
let rm = (word & 31) as u8;
|
||||
let modifier = if word & (1 << 24) == 0 {
|
||||
if rm != 31 {
|
||||
return Ok(None);
|
||||
}
|
||||
Zero
|
||||
} else if rm == 31 {
|
||||
StackPointer
|
||||
} else {
|
||||
Register(rm)
|
||||
};
|
||||
PointerAuthenticationOperation::Branch {
|
||||
key: if word & (1 << 10) == 0 { Ia } else { Ib },
|
||||
target: ((word >> 5) & 31) as u8,
|
||||
modifier,
|
||||
link: word & (1 << 21) != 0,
|
||||
}
|
||||
}
|
||||
_ => match pauth_memory::decode(word) {
|
||||
Some(pauth_memory::Instruction::GenericCode(code)) => {
|
||||
PointerAuthenticationOperation::GenericCode(code)
|
||||
}
|
||||
Some(pauth_memory::Instruction::Load(load)) => {
|
||||
PointerAuthenticationOperation::Load(load)
|
||||
}
|
||||
None => return Ok(None),
|
||||
},
|
||||
};
|
||||
Ok(Some(PointerAuthentication {
|
||||
operation,
|
||||
@@ -1631,44 +1638,89 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn link_register_helpers_preserve_canonical_source_and_legacy_distinctions() {
|
||||
let pc = GuestAddress(0x4000);
|
||||
for (word, id) in [
|
||||
(0xdac1bbfe, "AUTIA171615_64LR_dp_1src"),
|
||||
(0xdac1901e, "AUTIASPPCR_64LRR_dp_1src"),
|
||||
(0xf380001f, "AUTIASPPC_only_dp_1src_imm"),
|
||||
(0xdac1bffe, "AUTIB171615_64LR_dp_1src"),
|
||||
(0xdac1941e, "AUTIBSPPCR_64LRR_dp_1src"),
|
||||
(0xf3a0001f, "AUTIBSPPC_only_dp_1src_imm"),
|
||||
(0xdac18bfe, "PACIA171615_64LR_dp_1src"),
|
||||
(0xdac1a3fe, "PACIASPPC_64LR_dp_1src"),
|
||||
(0xdac18ffe, "PACIB171615_64LR_dp_1src"),
|
||||
(0xdac1a7fe, "PACIBSPPC_64LR_dp_1src"),
|
||||
(0xd50324ff, "PACM_HI_hints"),
|
||||
(0xdac183fe, "PACNBIASPPC_64LR_dp_1src"),
|
||||
(0xdac187fe, "PACNBIBSPPC_64LR_dp_1src"),
|
||||
(0xd65f0be0, "RETAASPPCR_64M_branch_reg"),
|
||||
(0x5500001f, "RETAASPPC_only_miscbranch"),
|
||||
(0xd65f0fe0, "RETABSPPCR_64M_branch_reg"),
|
||||
(0x5520001f, "RETABSPPC_only_miscbranch"),
|
||||
] {
|
||||
let request = decode_pointer_authentication(pc, word).unwrap().unwrap();
|
||||
let PointerAuthenticationOperation::LinkRegister(instruction) = request.operation
|
||||
else {
|
||||
panic!("canonical LR form must retain its descriptor");
|
||||
};
|
||||
assert_eq!(instruction.canonical_id(), id);
|
||||
assert_eq!(request.instruction_pc, pc);
|
||||
assert_eq!(request.next_pc, GuestAddress(pc.0 + 4));
|
||||
assert_eq!(request.operation.is_return(), instruction.is_return());
|
||||
let key = instruction.key().map(|key| match key {
|
||||
pauth_lr::Key::Ia => PointerAuthenticationKey::Ia,
|
||||
pauth_lr::Key::Ib => PointerAuthenticationKey::Ib,
|
||||
});
|
||||
assert_eq!(request.operation.required_key(), key);
|
||||
}
|
||||
for (word, key, authenticate) in [
|
||||
(0xdac10211, PointerAuthenticationKey::Ia, false),
|
||||
(0xdac10611, PointerAuthenticationKey::Ib, false),
|
||||
(0xdac11211, PointerAuthenticationKey::Ia, true),
|
||||
(0xdac11611, PointerAuthenticationKey::Ib, true),
|
||||
] {
|
||||
let request = decode_pointer_authentication(pc, word).unwrap().unwrap();
|
||||
let expected = if authenticate {
|
||||
PointerAuthenticationOperation::Authenticate {
|
||||
key,
|
||||
destination: 17,
|
||||
modifier: PointerAuthenticationModifier::Register(16),
|
||||
}
|
||||
} else {
|
||||
PointerAuthenticationOperation::Sign {
|
||||
key,
|
||||
destination: 17,
|
||||
modifier: PointerAuthenticationModifier::Register(16),
|
||||
}
|
||||
};
|
||||
assert_eq!(request.operation, expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_pac_fixed_hints_strip_and_return_have_exact_operands() {
|
||||
use PointerAuthenticationKey::{Ia, Ib};
|
||||
use PointerAuthenticationModifier::{Register, StackPointer, Zero};
|
||||
use PointerAuthenticationModifier::{StackPointer, Zero};
|
||||
use PointerAuthenticationOperation::{Authenticate, Sign, Strip};
|
||||
let pc = GuestAddress(0x4000);
|
||||
let fixed = [
|
||||
(
|
||||
0xd503211f,
|
||||
Sign {
|
||||
key: Ia,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
PointerAuthenticationOperation::Sign1716 { key: Ia },
|
||||
),
|
||||
(
|
||||
0xd503215f,
|
||||
Sign {
|
||||
key: Ib,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
PointerAuthenticationOperation::Sign1716 { key: Ib },
|
||||
),
|
||||
(
|
||||
0xd503219f,
|
||||
Authenticate {
|
||||
key: Ia,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
PointerAuthenticationOperation::Authenticate1716 { key: Ia },
|
||||
),
|
||||
(
|
||||
0xd50321df,
|
||||
Authenticate {
|
||||
key: Ib,
|
||||
destination: 17,
|
||||
modifier: Register(16),
|
||||
},
|
||||
PointerAuthenticationOperation::Authenticate1716 { key: Ib },
|
||||
),
|
||||
(
|
||||
0xd503231f,
|
||||
@@ -1745,6 +1797,7 @@ mod tests {
|
||||
decoded.is_some_and(|request| !matches!(
|
||||
request.operation,
|
||||
PointerAuthenticationOperation::Branch { .. }
|
||||
| PointerAuthenticationOperation::LinkRegister(_)
|
||||
)),
|
||||
fixed.iter().any(|(fixed, _)| *fixed == changed)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
//! Canonical typed descriptors and decoder for the June PAuth_LR forms.
|
||||
//! A decoded descriptor conveys source facts, not execution or key authority.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
const REGISTER_MASK: u32 = 31;
|
||||
const REGISTER_SHIFT: u32 = 5;
|
||||
const OFFSET_SCALE: u32 = 2;
|
||||
const OFFSET_MASK: u32 = u16::MAX as u32;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Key {
|
||||
Ia,
|
||||
Ib,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Instruction {
|
||||
Authenticate171615(Key),
|
||||
AuthenticateSpRegister { key: Key, register: u8 },
|
||||
AuthenticateSpPc { key: Key, offset: u32 },
|
||||
Sign171615(Key),
|
||||
SignSpPc { key: Key, implicit_bti: bool },
|
||||
ReturnSpRegister { key: Key, register: u8 },
|
||||
ReturnSpPc { key: Key, offset: u32 },
|
||||
Pacm,
|
||||
}
|
||||
|
||||
impl Instruction {
|
||||
pub const fn valid(self) -> bool {
|
||||
match self {
|
||||
Self::AuthenticateSpRegister { register, .. } => register <= REGISTER_MASK as u8,
|
||||
// Rm31 is the existing RETAA/RETAB word, excluded by the LR diagram.
|
||||
Self::ReturnSpRegister { register, .. } => register < REGISTER_MASK as u8,
|
||||
Self::AuthenticateSpPc { offset, .. } | Self::ReturnSpPc { offset, .. } => {
|
||||
offset <= OFFSET_MASK << OFFSET_SCALE && offset.is_multiple_of(1 << OFFSET_SCALE)
|
||||
}
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn is_return(self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::ReturnSpRegister { .. } | Self::ReturnSpPc { .. }
|
||||
)
|
||||
}
|
||||
|
||||
pub const fn key(self) -> Option<Key> {
|
||||
match self {
|
||||
Self::Pacm => None,
|
||||
Self::Authenticate171615(key) | Self::Sign171615(key) => Some(key),
|
||||
Self::AuthenticateSpRegister { key, .. }
|
||||
| Self::AuthenticateSpPc { key, .. }
|
||||
| Self::SignSpPc { key, .. }
|
||||
| Self::ReturnSpRegister { key, .. }
|
||||
| Self::ReturnSpPc { key, .. } => Some(key),
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn canonical_id(self) -> &'static str {
|
||||
match self {
|
||||
Self::Authenticate171615(Key::Ia) => "AUTIA171615_64LR_dp_1src",
|
||||
Self::Authenticate171615(Key::Ib) => "AUTIB171615_64LR_dp_1src",
|
||||
Self::AuthenticateSpRegister { key: Key::Ia, .. } => "AUTIASPPCR_64LRR_dp_1src",
|
||||
Self::AuthenticateSpRegister { key: Key::Ib, .. } => "AUTIBSPPCR_64LRR_dp_1src",
|
||||
Self::AuthenticateSpPc { key: Key::Ia, .. } => "AUTIASPPC_only_dp_1src_imm",
|
||||
Self::AuthenticateSpPc { key: Key::Ib, .. } => "AUTIBSPPC_only_dp_1src_imm",
|
||||
Self::Sign171615(Key::Ia) => "PACIA171615_64LR_dp_1src",
|
||||
Self::Sign171615(Key::Ib) => "PACIB171615_64LR_dp_1src",
|
||||
Self::SignSpPc {
|
||||
key: Key::Ia,
|
||||
implicit_bti: true,
|
||||
} => "PACIASPPC_64LR_dp_1src",
|
||||
Self::SignSpPc {
|
||||
key: Key::Ib,
|
||||
implicit_bti: true,
|
||||
} => "PACIBSPPC_64LR_dp_1src",
|
||||
Self::SignSpPc {
|
||||
key: Key::Ia,
|
||||
implicit_bti: false,
|
||||
} => "PACNBIASPPC_64LR_dp_1src",
|
||||
Self::SignSpPc {
|
||||
key: Key::Ib,
|
||||
implicit_bti: false,
|
||||
} => "PACNBIBSPPC_64LR_dp_1src",
|
||||
Self::ReturnSpRegister { key: Key::Ia, .. } => "RETAASPPCR_64M_branch_reg",
|
||||
Self::ReturnSpRegister { key: Key::Ib, .. } => "RETABSPPCR_64M_branch_reg",
|
||||
Self::ReturnSpPc { key: Key::Ia, .. } => "RETAASPPC_only_miscbranch",
|
||||
Self::ReturnSpPc { key: Key::Ib, .. } => "RETABSPPC_only_miscbranch",
|
||||
Self::Pacm => "PACM_HI_hints",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Fixed bits taken from the exact June members, not assembler acceptance.
|
||||
const EXACT_FORMS: [(u32, Instruction); 9] = [
|
||||
(0xdac1_bbfe, Instruction::Authenticate171615(Key::Ia)),
|
||||
(0xdac1_bffe, Instruction::Authenticate171615(Key::Ib)),
|
||||
(0xdac1_8bfe, Instruction::Sign171615(Key::Ia)),
|
||||
(0xdac1_8ffe, Instruction::Sign171615(Key::Ib)),
|
||||
(
|
||||
0xdac1_a3fe,
|
||||
Instruction::SignSpPc {
|
||||
key: Key::Ia,
|
||||
implicit_bti: true,
|
||||
},
|
||||
),
|
||||
(
|
||||
0xdac1_a7fe,
|
||||
Instruction::SignSpPc {
|
||||
key: Key::Ib,
|
||||
implicit_bti: true,
|
||||
},
|
||||
),
|
||||
(
|
||||
0xdac1_83fe,
|
||||
Instruction::SignSpPc {
|
||||
key: Key::Ia,
|
||||
implicit_bti: false,
|
||||
},
|
||||
),
|
||||
(
|
||||
0xdac1_87fe,
|
||||
Instruction::SignSpPc {
|
||||
key: Key::Ib,
|
||||
implicit_bti: false,
|
||||
},
|
||||
),
|
||||
(0xd503_24ff, Instruction::Pacm),
|
||||
];
|
||||
const AUTH_REGISTER_MASK: u32 = 0xffff_fc1f;
|
||||
const AUTH_REGISTER_FORMS: [(u32, Key); 2] = [(0xdac1_901e, Key::Ia), (0xdac1_941e, Key::Ib)];
|
||||
const RETURN_REGISTER_MASK: u32 = 0xffff_ffe0;
|
||||
const RETURN_REGISTER_FORMS: [(u32, Key); 2] = [(0xd65f_0be0, Key::Ia), (0xd65f_0fe0, Key::Ib)];
|
||||
const PC_MASK: u32 = 0xffe0_001f;
|
||||
const AUTH_PC_FORMS: [(u32, Key); 2] = [(0xf380_001f, Key::Ia), (0xf3a0_001f, Key::Ib)];
|
||||
const RETURN_PC_FORMS: [(u32, Key); 2] = [(0x5500_001f, Key::Ia), (0x5520_001f, Key::Ib)];
|
||||
|
||||
/// A match conveys source facts only; it grants no execution capability.
|
||||
pub fn decode(word: u32) -> Option<Instruction> {
|
||||
for (value, instruction) in EXACT_FORMS {
|
||||
if word == value {
|
||||
return Some(instruction);
|
||||
}
|
||||
}
|
||||
for (value, key) in AUTH_REGISTER_FORMS {
|
||||
if word & AUTH_REGISTER_MASK == value {
|
||||
return Some(Instruction::AuthenticateSpRegister {
|
||||
key,
|
||||
register: ((word >> REGISTER_SHIFT) & REGISTER_MASK) as u8,
|
||||
});
|
||||
}
|
||||
}
|
||||
for (value, key) in RETURN_REGISTER_FORMS {
|
||||
if word & RETURN_REGISTER_MASK == value {
|
||||
let instruction = Instruction::ReturnSpRegister {
|
||||
key,
|
||||
register: (word & REGISTER_MASK) as u8,
|
||||
};
|
||||
return instruction.valid().then_some(instruction);
|
||||
}
|
||||
}
|
||||
let offset = ((word >> REGISTER_SHIFT) & OFFSET_MASK) << OFFSET_SCALE;
|
||||
for (value, key) in AUTH_PC_FORMS {
|
||||
if word & PC_MASK == value {
|
||||
return Some(Instruction::AuthenticateSpPc { key, offset });
|
||||
}
|
||||
}
|
||||
for (value, key) in RETURN_PC_FORMS {
|
||||
if word & PC_MASK == value {
|
||||
return Some(Instruction::ReturnSpPc { key, offset });
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -162,6 +162,7 @@ pub const SOURCE_FINGERPRINT_MATERIAL: &str = concat!(
|
||||
include_str!("x86_64/simd/memory_checked/tests.rs"),
|
||||
include_str!("block/thread.rs"),
|
||||
include_str!("block/pauth_memory.rs"),
|
||||
include_str!("block/pauth_lr.rs"),
|
||||
include_str!("x86_64/block.rs"),
|
||||
include_str!("aarch64/bitfield.rs"),
|
||||
include_str!("x86_64/bitfield.rs"),
|
||||
|
||||
@@ -1569,7 +1569,31 @@ fn complete_pauth_with_memory(
|
||||
memory: Option<&mut AuthenticatedMemory<'_>>,
|
||||
) -> Result<(GuestAddress, Option<bool>)> {
|
||||
use PointerAuthenticationOperation::{Authenticate, Sign, Strip};
|
||||
const HINT_POINTER_REGISTER: usize = 17;
|
||||
const HINT_MODIFIER_REGISTER: usize = 16;
|
||||
match instruction.operation {
|
||||
PointerAuthenticationOperation::LinkRegister(_) => {
|
||||
anyhow::bail!("link-register authentication requires actual retained LR owners")
|
||||
}
|
||||
PointerAuthenticationOperation::Sign1716 { key } => {
|
||||
let value = context.sign(
|
||||
runtime_pauth_key(key),
|
||||
registers.x[HINT_POINTER_REGISTER],
|
||||
registers.x[HINT_MODIFIER_REGISTER],
|
||||
)?;
|
||||
registers.x[HINT_POINTER_REGISTER] = value;
|
||||
Ok((instruction.next_pc, None))
|
||||
}
|
||||
PointerAuthenticationOperation::Authenticate1716 { key } => {
|
||||
let result = context.authenticate_operation(
|
||||
runtime_pauth_key(key),
|
||||
registers.x[HINT_POINTER_REGISTER],
|
||||
registers.x[HINT_MODIFIER_REGISTER],
|
||||
false,
|
||||
)?;
|
||||
registers.x[HINT_POINTER_REGISTER] = result.pointer;
|
||||
Ok((instruction.next_pc, Some(result.authenticated)))
|
||||
}
|
||||
PointerAuthenticationOperation::SignIbSp => {
|
||||
let signed = context.sign_ib(registers.x[30], registers.sp)?;
|
||||
registers.x[30] = signed;
|
||||
|
||||
@@ -11,6 +11,11 @@ impl fmt::Debug for OwnedStop {
|
||||
Self::BudgetExhausted => f.write_str("BudgetExhausted"),
|
||||
Self::EntryDeclined(value) => f.debug_tuple("EntryDeclined").field(value).finish(),
|
||||
Self::HelperRefused(value) => f.debug_tuple("HelperRefused").field(value).finish(),
|
||||
Self::PointerAuthenticationFault { instruction, code } => f
|
||||
.debug_struct("PointerAuthenticationFault")
|
||||
.field("instruction", instruction)
|
||||
.field("code", code)
|
||||
.finish(),
|
||||
Self::PointerAuthenticationPoisonedTransfer {
|
||||
instruction,
|
||||
target,
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
//! Actual fresh-software debug controls and distinct retained execution scopes.
|
||||
//! LR execution does not manufacture an LR-absent exception-entry token.
|
||||
use crate::{
|
||||
pauth::features::LinkRegisterPauthCapability,
|
||||
system::{
|
||||
debug::DebugControls,
|
||||
identification_snapshot::Snapshot,
|
||||
profile::{BaseSpeAbsence, EntryProfile},
|
||||
state::{PacmStateFeature, SystemState},
|
||||
},
|
||||
};
|
||||
use anyhow::{Context, Result, ensure};
|
||||
use std::sync::Arc;
|
||||
const MDSCR_SOFTWARE_STEP: u64 = 1;
|
||||
const MDSCR_KERNEL_DEBUG_ENABLE: u64 = 1 << 13;
|
||||
const MDSCR_MONITOR_DEBUG_ENABLE: u64 = 1 << 15;
|
||||
const MDSCR_ACTIVE_DEBUG: u64 =
|
||||
MDSCR_SOFTWARE_STEP | MDSCR_KERNEL_DEBUG_ENABLE | MDSCR_MONITOR_DEBUG_ENABLE;
|
||||
enum FeatureScope {
|
||||
Base(EntryProfile),
|
||||
LinkRegister(Arc<Snapshot>),
|
||||
}
|
||||
pub(crate) struct ProcessEntryControls {
|
||||
features: FeatureScope,
|
||||
_spe: BaseSpeAbsence,
|
||||
mdscr_el1: u64,
|
||||
debug: DebugControls,
|
||||
}
|
||||
impl ProcessEntryControls {
|
||||
/// # Safety
|
||||
/// These are this fresh software PE's sole actual declared controls. Retain
|
||||
/// them through the sole execution owner and complete producer registry.
|
||||
pub(crate) unsafe fn fresh_software(
|
||||
features: EntryProfile,
|
||||
spe: BaseSpeAbsence,
|
||||
mdscr_el1: u64,
|
||||
debug: DebugControls,
|
||||
) -> Result<Self> {
|
||||
let owner = Self {
|
||||
features: FeatureScope::Base(features),
|
||||
_spe: spe,
|
||||
mdscr_el1,
|
||||
debug,
|
||||
};
|
||||
owner.check()?;
|
||||
Ok(owner)
|
||||
}
|
||||
/// # Safety
|
||||
/// The Arc is the SAME immutable Snapshot allocation as the actual fixed
|
||||
/// control bank of this fresh PE; no hardware/diagnostic adoption occurs.
|
||||
/// Other owner/producer obligations are identical to fresh_software.
|
||||
pub(crate) unsafe fn fresh_software_link_register_pauth(
|
||||
snapshot: &Arc<Snapshot>,
|
||||
spe: BaseSpeAbsence,
|
||||
mdscr_el1: u64,
|
||||
debug: DebugControls,
|
||||
) -> Result<Self> {
|
||||
snapshot.non_pauth_entry_absence()?;
|
||||
LinkRegisterPauthCapability::from_profile(snapshot)
|
||||
.map_err(|error| anyhow::anyhow!("actual LR profile: {error:?}"))?;
|
||||
let owner = Self {
|
||||
features: FeatureScope::LinkRegister(Arc::clone(snapshot)),
|
||||
_spe: spe,
|
||||
mdscr_el1,
|
||||
debug,
|
||||
};
|
||||
owner.check()?;
|
||||
Ok(owner)
|
||||
}
|
||||
pub(super) fn link_register(&self) -> bool {
|
||||
matches!(self.features, FeatureScope::LinkRegister(_))
|
||||
}
|
||||
pub(crate) fn debug_controls(&self) -> &DebugControls {
|
||||
&self.debug
|
||||
}
|
||||
pub(super) fn check(&self) -> Result<()> {
|
||||
let debug = self.debug_controls();
|
||||
ensure!(
|
||||
self.mdscr_el1 & MDSCR_ACTIVE_DEBUG == 0
|
||||
&& !debug.halted
|
||||
&& !debug.ignore_traps_in_debug
|
||||
&& !debug.halting_allowed
|
||||
&& !debug.edscr_tda
|
||||
&& debug.breakpoint_count == 0
|
||||
&& debug.watchpoint_count == 0
|
||||
&& debug.raw_bank == 0
|
||||
&& debug.effective_bank == 0,
|
||||
"unsupported actual debug/step producer state"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
pub(super) fn check_snapshot(
|
||||
&self,
|
||||
identification: Option<&Snapshot>,
|
||||
system: &SystemState,
|
||||
) -> Result<()> {
|
||||
match &self.features {
|
||||
FeatureScope::Base(profile) => {
|
||||
if let Some(ids) = identification {
|
||||
ids.check_entry_profile(*profile)?;
|
||||
}
|
||||
ensure!(
|
||||
system.pacm_state_feature() == PacmStateFeature::Absent,
|
||||
"base entry scope has unqualified PACM storage"
|
||||
);
|
||||
}
|
||||
FeatureScope::LinkRegister(snapshot) => {
|
||||
let ids = identification.context("actual LR identification owner unavailable")?;
|
||||
ensure!(
|
||||
snapshot.same_snapshot(ids),
|
||||
"actual LR feature and memory bank snapshots differ"
|
||||
);
|
||||
snapshot.non_pauth_entry_absence()?;
|
||||
LinkRegisterPauthCapability::from_profile(snapshot)
|
||||
.map_err(|error| anyhow::anyhow!("actual LR profile: {error:?}"))?;
|
||||
ensure!(
|
||||
system.pacm_state_feature() == PacmStateFeature::Full,
|
||||
"actual full PACM storage unavailable"
|
||||
);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "entry_controls/tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,106 @@
|
||||
use super::*;
|
||||
use crate::system::{identification::Register, state::El1Registers};
|
||||
const A64_EL0_EL1: u64 = 0x11;
|
||||
const APA_SHIFT: u32 = 4;
|
||||
const APA_LR: u64 = 6;
|
||||
const PACM_FULL: u64 = 2 << 12;
|
||||
|
||||
fn snapshot() -> Arc<Snapshot> {
|
||||
Arc::new(
|
||||
Snapshot::declared(
|
||||
"actual-lr-entry-tests",
|
||||
&[
|
||||
(Register::IdAa64Isar1El1, APA_LR << APA_SHIFT),
|
||||
(Register::IdAa64Isar2El1, 0),
|
||||
(Register::IdAa64Isar3El1, PACM_FULL),
|
||||
(Register::IdAa64Pfr0El1, A64_EL0_EL1),
|
||||
(Register::IdAa64Pfr1El1, 0),
|
||||
(Register::IdAa64Pfr2El1, 0),
|
||||
(Register::IdAa64Dfr0El1, 0),
|
||||
(Register::IdAa64Dfr1El1, 0),
|
||||
(Register::IdAa64Mmfr0El1, 0),
|
||||
(Register::IdAa64Mmfr1El1, 0),
|
||||
(Register::IdAa64Mmfr2El1, 0),
|
||||
(Register::IdAa64Mmfr3El1, 0),
|
||||
],
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
}
|
||||
fn controls(ids: &Arc<Snapshot>) -> ProcessEntryControls {
|
||||
// SAFETY: fresh local declared controls; no entry permission or live PE adoption.
|
||||
unsafe {
|
||||
ProcessEntryControls::fresh_software_link_register_pauth(
|
||||
ids,
|
||||
ids.base_spe_absence().unwrap(),
|
||||
0,
|
||||
DebugControls::default(),
|
||||
)
|
||||
}
|
||||
.unwrap()
|
||||
}
|
||||
fn system(feature: PacmStateFeature) -> SystemState {
|
||||
SystemState::new_with_pacm(0, 0, El1Registers::new(0, 0, 0, 0, 0), feature).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lr_scope_requires_original_snapshot_allocation_and_full_storage() {
|
||||
let ids = snapshot();
|
||||
let owner = controls(&ids);
|
||||
assert!(
|
||||
owner
|
||||
.check_snapshot(Some(&ids), &system(PacmStateFeature::Full))
|
||||
.is_ok()
|
||||
);
|
||||
assert!(
|
||||
owner
|
||||
.check_snapshot(Some(&snapshot()), &system(PacmStateFeature::Full))
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
owner
|
||||
.check_snapshot(None, &system(PacmStateFeature::Full))
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
owner
|
||||
.check_snapshot(Some(&ids), &system(PacmStateFeature::Absent))
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lr_scope_does_not_manufacture_lr_absent_entry_profile() {
|
||||
let ids = snapshot();
|
||||
assert!(ids.non_pauth_entry_absence().is_ok());
|
||||
assert!(ids.entry_profile().is_err());
|
||||
assert!(controls(&ids).link_register());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fresh_lr_scope_rejects_actual_halted_or_step_controls() {
|
||||
let ids = snapshot();
|
||||
for (mdscr, debug) in [
|
||||
(MDSCR_SOFTWARE_STEP, DebugControls::default()),
|
||||
(
|
||||
0,
|
||||
DebugControls {
|
||||
halted: true,
|
||||
..DebugControls::default()
|
||||
},
|
||||
),
|
||||
] {
|
||||
// SAFETY: fresh local declared controls; constructor must decline this profile.
|
||||
assert!(
|
||||
unsafe {
|
||||
ProcessEntryControls::fresh_software_link_register_pauth(
|
||||
&ids,
|
||||
ids.base_spe_absence().unwrap(),
|
||||
mdscr,
|
||||
debug,
|
||||
)
|
||||
}
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
mod darwin_services;
|
||||
mod diagnostics;
|
||||
mod entry_controls;
|
||||
mod low128_call;
|
||||
mod pauth_lr;
|
||||
mod pauth_policy;
|
||||
mod provider;
|
||||
mod source;
|
||||
@@ -13,7 +15,8 @@ use crate::{
|
||||
blocks::{BlockRuntime, RunOutcome, StopReason},
|
||||
memory::domain::MemoryExecutionLoan,
|
||||
};
|
||||
pub(crate) use provider::{CheckedProcessOwner, ProcessEntryControls};
|
||||
pub(crate) use entry_controls::ProcessEntryControls;
|
||||
pub(crate) use provider::CheckedProcessOwner;
|
||||
use source::{BoundSource, ReturnedTerminal};
|
||||
use stela_compiler::GuestAddress;
|
||||
|
||||
@@ -27,6 +30,10 @@ pub(crate) enum OwnedStop {
|
||||
BudgetExhausted,
|
||||
EntryDeclined(String),
|
||||
HelperRefused(String),
|
||||
PointerAuthenticationFault {
|
||||
instruction: stela_compiler::block::PointerAuthentication,
|
||||
code: u8,
|
||||
},
|
||||
PointerAuthenticationPoisonedTransfer {
|
||||
instruction: stela_compiler::block::PointerAuthentication,
|
||||
target: GuestAddress,
|
||||
@@ -171,9 +178,9 @@ impl BlockRuntime {
|
||||
Ok(bound) => bound,
|
||||
Err(error) => break OwnedStop::EntryDeclined(error.to_string()),
|
||||
};
|
||||
if let Err(error) = pe
|
||||
.backend
|
||||
.qualify(&bound, pe.system, &mut pe.thread.registers)
|
||||
if let Err(error) =
|
||||
pe.backend
|
||||
.qualify(&bound, pe.system, &mut pe.thread.registers, &outer)
|
||||
{
|
||||
break OwnedStop::EntryDeclined(error.to_string());
|
||||
}
|
||||
@@ -345,6 +352,9 @@ impl<B: provider::Owner> Active<'_, '_, B> {
|
||||
bound,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer.as_ref().ok_or_else(|| {
|
||||
anyhow::anyhow!("actual outer exclusion unavailable")
|
||||
})?,
|
||||
)?;
|
||||
self.finish_retirement(false)?;
|
||||
Ok(None)
|
||||
@@ -366,6 +376,7 @@ impl<B: provider::Owner> Active<'_, '_, B> {
|
||||
&helper,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer.as_ref(),
|
||||
);
|
||||
use provider::HelperOutcome;
|
||||
match outcome {
|
||||
@@ -375,6 +386,9 @@ impl<B: provider::Owner> Active<'_, '_, B> {
|
||||
bound,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer.as_ref().ok_or_else(|| {
|
||||
anyhow::anyhow!("actual outer exclusion unavailable")
|
||||
})?,
|
||||
)?;
|
||||
anyhow::ensure!(
|
||||
self.pe.thread.pc == helper.pc()
|
||||
@@ -391,6 +405,69 @@ impl<B: provider::Owner> Active<'_, '_, B> {
|
||||
Ok(Some(OwnedStop::HelperRefused(error.to_string())))
|
||||
}
|
||||
HelperOutcome::Indeterminate(error) => Err(error),
|
||||
HelperOutcome::PreparedPauth {
|
||||
instruction,
|
||||
effect,
|
||||
} => {
|
||||
effect.validate(self.pe.system)?;
|
||||
let continuation = effect.continuation();
|
||||
let authenticated = effect.authenticated();
|
||||
self.pe
|
||||
.authority
|
||||
.start_retirement(&ConsumerKey(()), self.attempt)
|
||||
.map_err(|()| {
|
||||
anyhow::anyhow!("LR retirement authority failed")
|
||||
})?;
|
||||
effect.commit(&mut self.pe.thread.registers, self.pe.system)?;
|
||||
// A staged candidate becomes an actual service observation only after commit.
|
||||
accounting.pointer_authentication_events.push(
|
||||
crate::blocks::PointerAuthenticationEvent {
|
||||
instruction,
|
||||
next_pc: continuation,
|
||||
authenticated,
|
||||
},
|
||||
);
|
||||
self.pe.thread.pc = continuation;
|
||||
self.ensure_outer()?;
|
||||
self.pe.backend.post_retirement(
|
||||
bound,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer.as_ref().ok_or_else(|| {
|
||||
anyhow::anyhow!("actual LR outer unavailable")
|
||||
})?,
|
||||
)?;
|
||||
self.finish_retirement(false)?;
|
||||
Ok(None)
|
||||
}
|
||||
HelperOutcome::AuthenticationFault { instruction, code } => {
|
||||
// Precise no-commit fault. No exception owner or destination/link write is fabricated.
|
||||
anyhow::ensure!(
|
||||
self.pe.thread.pc == instruction.instruction_pc,
|
||||
"LR fault lost actual PC"
|
||||
);
|
||||
self.pe
|
||||
.authority
|
||||
.start_retirement(&ConsumerKey(()), self.attempt)
|
||||
.map_err(|()| {
|
||||
anyhow::anyhow!("LR fault settlement authority failed")
|
||||
})?;
|
||||
self.ensure_outer()?;
|
||||
self.pe.backend.post_retirement(
|
||||
bound,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer.as_ref().ok_or_else(|| {
|
||||
anyhow::anyhow!("actual LR outer unavailable")
|
||||
})?,
|
||||
)?;
|
||||
self.finish_retirement(true)?;
|
||||
Ok(Some(OwnedStop::PointerAuthenticationFault {
|
||||
instruction,
|
||||
code,
|
||||
}))
|
||||
}
|
||||
|
||||
HelperOutcome::Complete {
|
||||
continuation,
|
||||
event,
|
||||
@@ -412,6 +489,9 @@ impl<B: provider::Owner> Active<'_, '_, B> {
|
||||
bound,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer.as_ref().ok_or_else(|| {
|
||||
anyhow::anyhow!("actual outer exclusion unavailable")
|
||||
})?,
|
||||
)?;
|
||||
self.finish_retirement(poisoned_transfer.is_some())?;
|
||||
Ok(poisoned_transfer.map(|(instruction, target)| {
|
||||
@@ -455,6 +535,9 @@ impl<B: provider::Owner> Active<'_, '_, B> {
|
||||
bound,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer.as_ref().ok_or_else(|| {
|
||||
anyhow::anyhow!("actual outer exclusion unavailable")
|
||||
})?,
|
||||
)?;
|
||||
self.finish_retirement(false)?;
|
||||
Ok(None)
|
||||
@@ -474,9 +557,14 @@ impl<B: provider::Owner> Active<'_, '_, B> {
|
||||
self.pe.thread.pc == bound.entry.entry(),
|
||||
"entry refusal changed actual PC"
|
||||
);
|
||||
self.pe
|
||||
.backend
|
||||
.qualify(bound, self.pe.system, &mut self.pe.thread.registers)?;
|
||||
self.pe.backend.qualify(
|
||||
bound,
|
||||
self.pe.system,
|
||||
&mut self.pe.thread.registers,
|
||||
self.outer
|
||||
.as_ref()
|
||||
.ok_or_else(|| anyhow::anyhow!("actual outer exclusion unavailable"))?,
|
||||
)?;
|
||||
self.pe
|
||||
.authority
|
||||
.finish_native_refusal(&ConsumerKey(()), self.attempt)
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
//! Source-qualified LR staging over the existing actual bank and outer loan.
|
||||
//! Candidates carry no entry/PC permission. Canonical Active alone commits them.
|
||||
use crate::{
|
||||
memory::{
|
||||
domain::{MemoryExecutionLoan, MemoryThread},
|
||||
policy::MemoryControls,
|
||||
},
|
||||
pauth::{
|
||||
self,
|
||||
lr_effects::{Effect, Evaluation},
|
||||
lr_instruction::{Action, Staged},
|
||||
lr_service::{BorrowedLinkRegisterService, KeySelection},
|
||||
},
|
||||
system::{
|
||||
process_memory::FixedProcessMemoryControls,
|
||||
state::{PacmStateFeature, SystemState},
|
||||
},
|
||||
};
|
||||
use anyhow::{Context, Result, ensure};
|
||||
use stela_compiler::{
|
||||
GuestAddress, GuestState,
|
||||
block::{
|
||||
PointerAuthentication, PointerAuthenticationKey as Key,
|
||||
PointerAuthenticationModifier as Modifier, PointerAuthenticationOperation as Operation,
|
||||
},
|
||||
};
|
||||
|
||||
const ZERO_REGISTER: u8 = 31;
|
||||
const LOWER_VA47_MASK: u64 = (1 << 47) - 1;
|
||||
const UPPER_REGION: u64 = 1 << 55;
|
||||
const TCR_T0SZ_MASK: u64 = 0x3f;
|
||||
const TCR_VA47_T0SZ: u64 = 17;
|
||||
const TCR_TBI0: u64 = 1 << 37;
|
||||
const TCR_TBI1: u64 = 1 << 38;
|
||||
const TCR_TBID0: u64 = 1 << 51;
|
||||
const TCR_TBID1: u64 = 1 << 52;
|
||||
|
||||
pub(super) fn conditional(operation: Operation) -> bool {
|
||||
matches!(
|
||||
operation,
|
||||
Operation::SignIbSp
|
||||
| Operation::AuthenticateIbSp
|
||||
| Operation::ReturnIaSp
|
||||
| Operation::ReturnIbSp
|
||||
| Operation::Sign1716 { .. }
|
||||
| Operation::Authenticate1716 { .. }
|
||||
| Operation::Sign {
|
||||
key: Key::Ia | Key::Ib,
|
||||
modifier: Modifier::StackPointer,
|
||||
..
|
||||
}
|
||||
| Operation::Authenticate {
|
||||
key: Key::Ia | Key::Ib,
|
||||
modifier: Modifier::StackPointer,
|
||||
..
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// Actual source/bank qualification before native entry, without operand checks.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(super) fn service<'a>(
|
||||
controls: &'a FixedProcessMemoryControls,
|
||||
context: &'a pauth::Context,
|
||||
system: &'a SystemState,
|
||||
registers: &'a GuestState,
|
||||
instruction: PointerAuthentication,
|
||||
thread: &MemoryThread<MemoryControls>,
|
||||
outer: &'a MemoryExecutionLoan,
|
||||
) -> Result<BorrowedLinkRegisterService<'a>> {
|
||||
let ids = controls
|
||||
.identification_snapshot()
|
||||
.context("actual LR identification owner unavailable")?;
|
||||
let loan = controls
|
||||
.extended_controls(ids, thread, outer)
|
||||
.map_err(|error| anyhow::anyhow!("actual LR control loan: {error:?}"))?;
|
||||
let service = BorrowedLinkRegisterService::new(
|
||||
loan,
|
||||
context,
|
||||
registers,
|
||||
instruction.instruction_pc,
|
||||
system,
|
||||
)
|
||||
.map_err(|error| anyhow::anyhow!("actual LR service: {error:?}"))?;
|
||||
if let Some(key) = instruction.operation.required_key() {
|
||||
let (selected, actual) = match key {
|
||||
Key::Ia => (pauth::lr_context::InstructionKey::A, pauth::Key::Ia),
|
||||
Key::Ib => (pauth::lr_context::InstructionKey::B, pauth::Key::Ib),
|
||||
_ => anyhow::bail!("LR service requires an instruction key"),
|
||||
};
|
||||
if service.key_selection(selected) == KeySelection::UseKey {
|
||||
ensure!(context.has_key(actual), "actual enabled LR key unavailable");
|
||||
let (tcr, tcr2) = service.tcr_controls();
|
||||
ensure!(
|
||||
tcr2 == 0 && tcr & TCR_T0SZ_MASK == TCR_VA47_T0SZ,
|
||||
"LR requires actual lower VA47 controls"
|
||||
);
|
||||
let lower = tcr & TCR_TBI0 != 0 && tcr & TCR_TBID0 == 0;
|
||||
let upper = tcr & TCR_TBI1 != 0 && tcr & TCR_TBID1 == 0;
|
||||
ensure!(!lower && !upper, "LR instruction TBI controls unsupported");
|
||||
}
|
||||
}
|
||||
Ok(service)
|
||||
}
|
||||
|
||||
pub(crate) struct PreparedEffect {
|
||||
effect: Effect,
|
||||
continuation: GuestAddress,
|
||||
authenticated: Option<bool>,
|
||||
}
|
||||
impl PreparedEffect {
|
||||
pub(super) fn authenticated(&self) -> Option<bool> {
|
||||
self.authenticated
|
||||
}
|
||||
pub(super) fn continuation(&self) -> GuestAddress {
|
||||
self.continuation
|
||||
}
|
||||
pub(super) fn validate(&self, system: &SystemState) -> Result<()> {
|
||||
ensure!(
|
||||
system.pacm_state_feature() == PacmStateFeature::Full,
|
||||
"actual LR PACM storage changed"
|
||||
);
|
||||
if let Effect::Register { destination, .. } = self.effect {
|
||||
ensure!(destination < ZERO_REGISTER, "invalid staged LR destination");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
/// Only canonical Active lends these original mutable resources after validation.
|
||||
pub(super) fn commit(self, registers: &mut GuestState, system: &mut SystemState) -> Result<()> {
|
||||
match self.effect {
|
||||
Effect::Register { destination, value } => {
|
||||
*registers
|
||||
.x
|
||||
.get_mut(usize::from(destination))
|
||||
.context("staged LR destination changed")? = value;
|
||||
}
|
||||
Effect::Pacm(value) => system
|
||||
.set_pacm(value)
|
||||
.map_err(|error| anyhow::anyhow!("actual PACM commit: {error:?}"))?,
|
||||
Effect::Return { .. } | Effect::Discard => {}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub(super) enum Prepared {
|
||||
Effect(PreparedEffect),
|
||||
AuthenticationFault { code: u8 },
|
||||
}
|
||||
|
||||
/// Stage AFTER the genuine ordinary prefix. Selected-key bypass precedes layout,
|
||||
/// pointer canonicalization and key lookup, including high/tagged raw operands.
|
||||
pub(super) fn prepare(
|
||||
instruction: PointerAuthentication,
|
||||
service: &BorrowedLinkRegisterService<'_>,
|
||||
) -> Result<Prepared> {
|
||||
let operands = match instruction.operation {
|
||||
Operation::LinkRegister(decoded) => match service
|
||||
.stage(decoded)
|
||||
.map_err(|error| anyhow::anyhow!("actual LR operands: {error:?}"))?
|
||||
{
|
||||
Staged::Pointer(value) => Some((value.key, value.action, value.pointer)),
|
||||
Staged::Pacm => None,
|
||||
},
|
||||
operation => service
|
||||
.stage_conditional(operation)
|
||||
.map_err(|error| anyhow::anyhow!("actual conditional operands: {error:?}"))?
|
||||
.map(|value| (value.key, value.action, value.pointer)),
|
||||
};
|
||||
let mut authenticated = None;
|
||||
if let Some((key, action, pointer)) = operands {
|
||||
let key = match key {
|
||||
pauth::lr_instruction::Key::Ia => pauth::lr_context::InstructionKey::A,
|
||||
pauth::lr_instruction::Key::Ib => pauth::lr_context::InstructionKey::B,
|
||||
};
|
||||
if service.key_selection(key) == KeySelection::UseKey {
|
||||
if action != Action::Sign {
|
||||
authenticated = Some(true);
|
||||
}
|
||||
ensure!(
|
||||
pointer & UPPER_REGION == 0,
|
||||
"upper-region LR pointer unsupported"
|
||||
);
|
||||
if action == Action::Sign {
|
||||
ensure!(
|
||||
pointer & !LOWER_VA47_MASK == 0,
|
||||
"noncanonical lower LR signing input unsupported"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
let result = match instruction.operation {
|
||||
Operation::LinkRegister(decoded) => pauth::lr_effects::evaluate(decoded, service),
|
||||
operation => pauth::lr_effects::evaluate_conditional(operation, service)
|
||||
.and_then(|value| value.ok_or(pauth::lr_effects::Error::InvalidDestination)),
|
||||
}
|
||||
.map_err(|error| anyhow::anyhow!("actual LR evaluation: {error:?}"))?;
|
||||
match result {
|
||||
Evaluation::AuthenticationFault { code } => Ok(Prepared::AuthenticationFault { code }),
|
||||
Evaluation::Candidate(effect) => {
|
||||
let continuation = match effect {
|
||||
Effect::Return { target } => target,
|
||||
_ => instruction.next_pc,
|
||||
};
|
||||
Ok(Prepared::Effect(PreparedEffect {
|
||||
effect,
|
||||
continuation,
|
||||
authenticated,
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -0,0 +1,106 @@
|
||||
use super::*;
|
||||
use crate::system::state::{El1Registers, PSTATE_PACM_MASK, Pacm};
|
||||
|
||||
const CONTINUATION: GuestAddress = GuestAddress(0x1004);
|
||||
const DESTINATION: u8 = 17;
|
||||
const RESULT: u64 = 0x1234;
|
||||
|
||||
fn system(feature: PacmStateFeature) -> SystemState {
|
||||
SystemState::new_with_pacm(0, 0x2000, El1Registers::new(1, 2, 3, 4, 5), feature).unwrap()
|
||||
}
|
||||
fn prepared(effect: Effect) -> PreparedEffect {
|
||||
PreparedEffect {
|
||||
effect,
|
||||
continuation: CONTINUATION,
|
||||
authenticated: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_pacm_storage_refuses_before_register_effect() {
|
||||
let state = system(PacmStateFeature::Absent);
|
||||
assert!(
|
||||
prepared(Effect::Register {
|
||||
destination: DESTINATION,
|
||||
value: RESULT
|
||||
})
|
||||
.validate(&state)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_destination_refuses_before_commit() {
|
||||
let state = system(PacmStateFeature::Full);
|
||||
assert!(
|
||||
prepared(Effect::Register {
|
||||
destination: ZERO_REGISTER,
|
||||
value: RESULT
|
||||
})
|
||||
.validate(&state)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn register_effect_preserves_system_flags_and_other_registers() {
|
||||
let mut state = system(PacmStateFeature::Full);
|
||||
let original_system = state.clone();
|
||||
let mut registers = GuestState {
|
||||
nzcv: 0xa000_0000,
|
||||
sp: 0x3000,
|
||||
..GuestState::default()
|
||||
};
|
||||
let mut expected = registers.clone();
|
||||
expected.x[usize::from(DESTINATION)] = RESULT;
|
||||
let effect = prepared(Effect::Register {
|
||||
destination: DESTINATION,
|
||||
value: RESULT,
|
||||
});
|
||||
effect.validate(&state).unwrap();
|
||||
effect.commit(&mut registers, &mut state).unwrap();
|
||||
assert_eq!(registers, expected);
|
||||
assert_eq!(state, original_system);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pacm_effect_changes_only_actual_system_pacm() {
|
||||
let mut state = system(PacmStateFeature::Full);
|
||||
let mut registers = GuestState::default();
|
||||
let original = registers.clone();
|
||||
let effect = prepared(Effect::Pacm(Pacm::One));
|
||||
effect.validate(&state).unwrap();
|
||||
effect.commit(&mut registers, &mut state).unwrap();
|
||||
assert_eq!(state.pstate_misc(), PSTATE_PACM_MASK);
|
||||
assert_eq!(registers, original);
|
||||
let expected = SystemState::new_with_pacm(
|
||||
PSTATE_PACM_MASK,
|
||||
0x2000,
|
||||
El1Registers::new(1, 2, 3, 4, 5),
|
||||
PacmStateFeature::Full,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(state, expected);
|
||||
assert_eq!(state.el1_registers(), &El1Registers::new(1, 2, 3, 4, 5));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn return_and_discard_candidates_do_not_write_original_banks() {
|
||||
for candidate in [
|
||||
Effect::Return {
|
||||
target: CONTINUATION,
|
||||
},
|
||||
Effect::Discard,
|
||||
] {
|
||||
let mut state = system(PacmStateFeature::Full);
|
||||
let original_system = state.clone();
|
||||
let mut registers = GuestState::default();
|
||||
let original = registers.clone();
|
||||
let effect = prepared(candidate);
|
||||
effect.validate(&state).unwrap();
|
||||
assert_eq!(effect.continuation(), CONTINUATION);
|
||||
effect.commit(&mut registers, &mut state).unwrap();
|
||||
assert_eq!(registers, original);
|
||||
assert_eq!(state, original_system);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,11 @@
|
||||
//! and SCTLR/TCR bank. No key copies, alternate policy or completion authority.
|
||||
use crate::{
|
||||
pauth,
|
||||
system::{identification::Register, identification_snapshot::Snapshot},
|
||||
system::{
|
||||
identification::Register,
|
||||
identification_snapshot::Snapshot,
|
||||
process_memory::{SCTLR_ENDA, SCTLR_ENDB, SCTLR_ENIA, SCTLR_ENIB},
|
||||
},
|
||||
};
|
||||
use stela_compiler::block::{
|
||||
PointerAuthenticationKey as Key, PointerAuthenticationOperation as Op,
|
||||
@@ -20,10 +24,6 @@ const TCR_TBI0: u64 = 1 << 37;
|
||||
const TCR_TBI1: u64 = 1 << 38;
|
||||
const TCR_TBID0: u64 = 1 << 51;
|
||||
const TCR_TBID1: u64 = 1 << 52;
|
||||
const SCTLR_ENIA: u64 = 1 << 31;
|
||||
const SCTLR_ENIB: u64 = 1 << 30;
|
||||
const SCTLR_ENDA: u64 = 1 << 27;
|
||||
const SCTLR_ENDB: u64 = 1 << 13;
|
||||
|
||||
pub(super) fn qualify(
|
||||
ids: &Snapshot,
|
||||
@@ -42,7 +42,11 @@ pub(super) fn qualify(
|
||||
let version = match tuple {
|
||||
(APA_QARMA5_CLASSIC, 0, 0) => pauth::Version::Classic,
|
||||
(APA_QARMA5_FAULTING_COMBINED, 0, 0) => pauth::Version::FaultingCombined,
|
||||
_ => anyhow::bail!("unsupported actual PAuth algorithm tuple"),
|
||||
_ => {
|
||||
pauth::features::LinkRegisterPauthCapability::from_profile(ids)
|
||||
.map_err(|error| anyhow::anyhow!("actual LR tuple: {error:?}"))?;
|
||||
pauth::Version::FaultingCombined
|
||||
}
|
||||
};
|
||||
anyhow::ensure!(
|
||||
context.version() == version,
|
||||
@@ -97,11 +101,14 @@ pub(super) fn qualify_pointer(
|
||||
registers: &stela_compiler::GuestState,
|
||||
) -> anyhow::Result<()> {
|
||||
const LINK_REGISTER: u8 = 30;
|
||||
const HINT_POINTER_REGISTER: u8 = 17;
|
||||
const ZERO_REGISTER: u8 = 31;
|
||||
const UPPER_REGION: u64 = 1 << 55;
|
||||
const VA47_ADDRESS_MASK: u64 = (1 << 47) - 1;
|
||||
let register = match operation {
|
||||
Op::SignIbSp | Op::AuthenticateIbSp | Op::ReturnIbSp | Op::ReturnIaSp => LINK_REGISTER,
|
||||
Op::Sign1716 { .. } | Op::Authenticate1716 { .. } => HINT_POINTER_REGISTER,
|
||||
Op::LinkRegister(_) => anyhow::bail!("LR operands require actual borrowed control service"),
|
||||
Op::Sign { destination, .. }
|
||||
| Op::Authenticate { destination, .. }
|
||||
| Op::Strip { destination, .. } => destination,
|
||||
@@ -120,7 +127,10 @@ pub(super) fn qualify_pointer(
|
||||
pointer & UPPER_REGION == 0,
|
||||
"upper-region PAuth inputs are unsupported"
|
||||
);
|
||||
if matches!(operation, Op::SignIbSp | Op::Sign { .. }) {
|
||||
if matches!(
|
||||
operation,
|
||||
Op::SignIbSp | Op::Sign1716 { .. } | Op::Sign { .. }
|
||||
) {
|
||||
anyhow::ensure!(
|
||||
pointer & !VA47_ADDRESS_MASK == 0,
|
||||
"noncanonical lower signing input is unsupported"
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
use super::super::super::{checked_memory, complete_clock, complete_pauth_with_memory};
|
||||
use super::super::software_async::NoAsyncSources;
|
||||
use super::NativeObservation;
|
||||
use super::low128_call;
|
||||
use super::source::{BoundSource, Helper};
|
||||
use super::{low128_call, pauth_lr};
|
||||
use crate::{
|
||||
blocks::{ClockEvent, PointerAuthenticationEvent, RunOutcome, ThreadRegisterEvent},
|
||||
clock,
|
||||
@@ -14,11 +14,9 @@ use crate::{
|
||||
},
|
||||
pauth,
|
||||
system::{
|
||||
debug::DebugControls,
|
||||
events::EventEndpoint,
|
||||
execution::{Boundary, Dispatcher, EntryBoundary, Failure},
|
||||
process_memory::{FixedProcessMemoryControls, PreparedProcessMemory},
|
||||
profile::{BaseSpeAbsence, EntryProfile},
|
||||
scalable_controls::fp::FpControlOwner,
|
||||
state::SystemState,
|
||||
},
|
||||
@@ -30,59 +28,7 @@ use stela_compiler::{
|
||||
context::{ExecutionContext, memory::MemoryRequirements},
|
||||
};
|
||||
|
||||
const MDSCR_SOFTWARE_STEP: u64 = 1;
|
||||
const MDSCR_KERNEL_DEBUG_ENABLE: u64 = 1 << 13;
|
||||
const MDSCR_MONITOR_DEBUG_ENABLE: u64 = 1 << 15;
|
||||
const MDSCR_ACTIVE_DEBUG: u64 =
|
||||
MDSCR_SOFTWARE_STEP | MDSCR_KERNEL_DEBUG_ENABLE | MDSCR_MONITOR_DEBUG_ENABLE;
|
||||
|
||||
/// Actual immutable declaration for a NEW software PE's debug/control subset.
|
||||
/// EntryProfile has already proved the bounded optional features (including
|
||||
/// NMI) absent; BaseSpeAbsence covers branch-history effects separately.
|
||||
pub(crate) struct ProcessEntryControls {
|
||||
_features: EntryProfile,
|
||||
_spe: BaseSpeAbsence,
|
||||
mdscr_el1: u64,
|
||||
debug: DebugControls,
|
||||
}
|
||||
impl ProcessEntryControls {
|
||||
/// # Safety
|
||||
/// These are this fresh software PE's sole actual declared debug controls,
|
||||
/// not readbacks copied from another mutable CPU. Retain this owner for the
|
||||
/// executable PE lifetime. All producers belong to SoftwareAsyncDomain.
|
||||
pub(crate) unsafe fn fresh_software(
|
||||
features: EntryProfile,
|
||||
spe: BaseSpeAbsence,
|
||||
mdscr_el1: u64,
|
||||
debug: DebugControls,
|
||||
) -> anyhow::Result<Self> {
|
||||
let owner = Self {
|
||||
_features: features,
|
||||
_spe: spe,
|
||||
mdscr_el1,
|
||||
debug,
|
||||
};
|
||||
owner.check()?;
|
||||
Ok(owner)
|
||||
}
|
||||
fn check(&self) -> anyhow::Result<()> {
|
||||
let debug = self.debug;
|
||||
anyhow::ensure!(
|
||||
self.mdscr_el1 & MDSCR_ACTIVE_DEBUG == 0
|
||||
&& !debug.halted
|
||||
&& !debug.ignore_traps_in_debug
|
||||
&& !debug.halting_allowed
|
||||
&& !debug.edscr_tda
|
||||
&& debug.breakpoint_count == 0
|
||||
&& debug.watchpoint_count == 0
|
||||
&& debug.raw_bank == 0
|
||||
&& debug.effective_bank == 0,
|
||||
"unsupported actual debug/step producer state"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
use super::entry_controls::ProcessEntryControls;
|
||||
pub(crate) struct CheckedProcessOwner<'pe> {
|
||||
address_space: u64,
|
||||
controls: &'pe mut FixedProcessMemoryControls,
|
||||
@@ -169,9 +115,18 @@ impl<'pe> CheckedProcessOwner<'pe> {
|
||||
bound: &BoundSource<'_>,
|
||||
system: &SystemState,
|
||||
registers: &mut GuestState,
|
||||
outer: &MemoryExecutionLoan,
|
||||
) -> anyhow::Result<()> {
|
||||
bound.recheck()?;
|
||||
self.check_resources()?;
|
||||
self.execution
|
||||
.check_snapshot(self.controls.identification_snapshot(), system)?;
|
||||
if self.execution.link_register() {
|
||||
anyhow::ensure!(
|
||||
bound.trap().is_none(),
|
||||
"LR trap/exception lifecycle is not admitted"
|
||||
);
|
||||
}
|
||||
anyhow::ensure!(
|
||||
bound.entry.address_space() == self.address_space,
|
||||
"source namespace differs"
|
||||
@@ -181,13 +136,29 @@ impl<'pe> CheckedProcessOwner<'pe> {
|
||||
.controls
|
||||
.identification_snapshot()
|
||||
.ok_or_else(|| anyhow::anyhow!("PAuth identification owner unavailable"))?;
|
||||
super::pauth_policy::qualify(
|
||||
ids,
|
||||
self.controls.sctlr_el1(),
|
||||
self.controls.tcr_el1(),
|
||||
self.pauth,
|
||||
if matches!(
|
||||
instruction.operation,
|
||||
)?;
|
||||
PointerAuthenticationOperation::LinkRegister(_)
|
||||
) || self.execution.link_register() && pauth_lr::conditional(instruction.operation)
|
||||
{
|
||||
let _service = pauth_lr::service(
|
||||
&*self.controls,
|
||||
self.pauth,
|
||||
system,
|
||||
registers,
|
||||
instruction,
|
||||
self.memory,
|
||||
outer,
|
||||
)?;
|
||||
} else {
|
||||
super::pauth_policy::qualify(
|
||||
ids,
|
||||
self.controls.sctlr_el1(),
|
||||
self.controls.tcr_el1(),
|
||||
self.pauth,
|
||||
instruction.operation,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
if bound.requirements.required_flags & stela_compiler::context::memory::flags::ASIMD != 0 {
|
||||
let fp = self
|
||||
@@ -233,6 +204,7 @@ pub(crate) trait Owner: sealed::Concrete {
|
||||
bound: &BoundSource<'_>,
|
||||
system: &SystemState,
|
||||
registers: &mut GuestState,
|
||||
outer: &MemoryExecutionLoan,
|
||||
) -> anyhow::Result<()>;
|
||||
fn invoke(
|
||||
&mut self,
|
||||
@@ -245,6 +217,7 @@ pub(crate) trait Owner: sealed::Concrete {
|
||||
helper: &Helper,
|
||||
system: &SystemState,
|
||||
registers: &mut GuestState,
|
||||
outer: Option<&MemoryExecutionLoan>,
|
||||
) -> HelperOutcome;
|
||||
fn complete_trap(
|
||||
&mut self,
|
||||
@@ -258,6 +231,7 @@ pub(crate) trait Owner: sealed::Concrete {
|
||||
bound: &BoundSource<'_>,
|
||||
system: &SystemState,
|
||||
registers: &mut GuestState,
|
||||
outer: &MemoryExecutionLoan,
|
||||
) -> anyhow::Result<()>;
|
||||
}
|
||||
|
||||
@@ -272,8 +246,9 @@ impl Owner for CheckedProcessOwner<'_> {
|
||||
bound: &BoundSource<'_>,
|
||||
system: &SystemState,
|
||||
registers: &mut GuestState,
|
||||
outer: &MemoryExecutionLoan,
|
||||
) -> anyhow::Result<()> {
|
||||
self.qualify_current_resources(bound, system, registers)?;
|
||||
self.qualify_current_resources(bound, system, registers, outer)?;
|
||||
// Pointer operands may be produced by the ordinary prefix (including
|
||||
// loaded LR/SP). They are qualified only at the actual source-validated
|
||||
// helper boundary, after the canonical consumer settles that prefix.
|
||||
@@ -387,8 +362,9 @@ impl Owner for CheckedProcessOwner<'_> {
|
||||
fn complete_helper(
|
||||
&mut self,
|
||||
helper: &Helper,
|
||||
_system: &SystemState,
|
||||
system: &SystemState,
|
||||
registers: &mut GuestState,
|
||||
outer: Option<&MemoryExecutionLoan>,
|
||||
) -> HelperOutcome {
|
||||
// Actual terminal PC was already stored by the consumer, which retains
|
||||
// it exclusively; this provider receives no PC/authority accessor.
|
||||
@@ -397,6 +373,41 @@ impl Owner for CheckedProcessOwner<'_> {
|
||||
}
|
||||
match helper {
|
||||
Helper::Pauth(instruction) => {
|
||||
if matches!(
|
||||
instruction.operation,
|
||||
PointerAuthenticationOperation::LinkRegister(_)
|
||||
) || self.execution.link_register()
|
||||
&& pauth_lr::conditional(instruction.operation)
|
||||
{
|
||||
let prepared = (|| -> anyhow::Result<pauth_lr::Prepared> {
|
||||
let outer = outer.ok_or_else(|| {
|
||||
anyhow::anyhow!("actual LR outer exclusion unavailable")
|
||||
})?;
|
||||
let service = pauth_lr::service(
|
||||
&*self.controls,
|
||||
self.pauth,
|
||||
system,
|
||||
registers,
|
||||
*instruction,
|
||||
self.memory,
|
||||
outer,
|
||||
)?;
|
||||
pauth_lr::prepare(*instruction, &service)
|
||||
})();
|
||||
return match prepared {
|
||||
Ok(pauth_lr::Prepared::Effect(effect)) => HelperOutcome::PreparedPauth {
|
||||
instruction: *instruction,
|
||||
effect,
|
||||
},
|
||||
Ok(pauth_lr::Prepared::AuthenticationFault { code }) => {
|
||||
HelperOutcome::AuthenticationFault {
|
||||
instruction: *instruction,
|
||||
code,
|
||||
}
|
||||
}
|
||||
Err(error) => HelperOutcome::NoEffect(error),
|
||||
};
|
||||
}
|
||||
if let Err(error) =
|
||||
super::pauth_policy::qualify_pointer(instruction.operation, registers)
|
||||
{
|
||||
@@ -483,13 +494,14 @@ impl Owner for CheckedProcessOwner<'_> {
|
||||
bound: &BoundSource<'_>,
|
||||
system: &SystemState,
|
||||
registers: &mut GuestState,
|
||||
outer: &MemoryExecutionLoan,
|
||||
) -> anyhow::Result<()> {
|
||||
// This is an actual exhaustive registry lease, not an empty queue test
|
||||
// or successful pending-delivery stub. Any registered producer fails.
|
||||
// A completed helper has changed its operand (for example, signing
|
||||
// LR). Revalidate current resources without treating that output as
|
||||
// the original input to a second helper invocation.
|
||||
self.qualify_current_resources(bound, system, registers)
|
||||
self.qualify_current_resources(bound, system, registers, outer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -568,6 +580,14 @@ impl Dispatcher for ProcessDispatcher<'_, '_> {
|
||||
}
|
||||
|
||||
pub(crate) enum HelperOutcome {
|
||||
PreparedPauth {
|
||||
instruction: stela_compiler::block::PointerAuthentication,
|
||||
effect: pauth_lr::PreparedEffect,
|
||||
},
|
||||
AuthenticationFault {
|
||||
instruction: stela_compiler::block::PointerAuthentication,
|
||||
code: u8,
|
||||
},
|
||||
NoEffect(anyhow::Error),
|
||||
Complete {
|
||||
continuation: GuestAddress,
|
||||
|
||||
@@ -50,6 +50,10 @@ pub(super) enum ReturnedTerminal {
|
||||
}
|
||||
|
||||
impl<'code> BoundSource<'code> {
|
||||
pub(super) fn trap(&self) -> Option<SynchronousTrap> {
|
||||
self.analysis.trap
|
||||
}
|
||||
|
||||
pub(super) fn pauth(&self) -> Option<PointerAuthentication> {
|
||||
self.analysis.pointer_authentication
|
||||
}
|
||||
|
||||
@@ -78,23 +78,35 @@ pub(crate) unsafe fn run_protected_services(
|
||||
.ok_or_else(|| anyhow::anyhow!("missing actual thread service owner"))?;
|
||||
// This bounded software machine has no asynchronous devices or injection
|
||||
// APIs. The exclusive registry loan spans construction, FFI and settlement.
|
||||
let debug = DebugControls {
|
||||
halted: false,
|
||||
ignore_traps_in_debug: false,
|
||||
halting_allowed: false,
|
||||
edscr_tda: false,
|
||||
os_locked: true,
|
||||
breakpoint_count: 0,
|
||||
watchpoint_count: 0,
|
||||
raw_bank: 0,
|
||||
effective_bank: 0,
|
||||
};
|
||||
let execution = unsafe {
|
||||
ProcessEntryControls::fresh_software(
|
||||
ids.entry_profile()?,
|
||||
ids.base_spe_absence()?,
|
||||
0,
|
||||
DebugControls {
|
||||
halted: false,
|
||||
ignore_traps_in_debug: false,
|
||||
halting_allowed: false,
|
||||
edscr_tda: false,
|
||||
os_locked: true,
|
||||
breakpoint_count: 0,
|
||||
watchpoint_count: 0,
|
||||
raw_bank: 0,
|
||||
effective_bank: 0,
|
||||
},
|
||||
)
|
||||
if system.pacm_state_feature() == crate::system::state::PacmStateFeature::Full {
|
||||
ProcessEntryControls::fresh_software_link_register_pauth(
|
||||
controls
|
||||
.identification_snapshot_owner()
|
||||
.ok_or_else(|| anyhow::anyhow!("missing original LR Snapshot allocation"))?,
|
||||
ids.base_spe_absence()?,
|
||||
0,
|
||||
debug,
|
||||
)
|
||||
} else {
|
||||
ProcessEntryControls::fresh_software(
|
||||
ids.entry_profile()?,
|
||||
ids.base_spe_absence()?,
|
||||
0,
|
||||
debug,
|
||||
)
|
||||
}
|
||||
}?;
|
||||
let mut producers = unsafe { SoftwareAsyncDomain::fresh_software_pe() };
|
||||
let pending = producers
|
||||
|
||||
@@ -17,6 +17,13 @@ pub(super) struct DomainState {
|
||||
pub struct MemoryExecutionLoan {
|
||||
domain: Arc<MemoryDomain>,
|
||||
}
|
||||
impl MemoryExecutionLoan {
|
||||
/// Domain identity of this actual live mapping-exclusion pin, not PE or
|
||||
/// thread identity, source-attribute authority or a copied epoch permit.
|
||||
pub(crate) fn belongs_to(&self, domain: &Arc<MemoryDomain>) -> bool {
|
||||
Arc::ptr_eq(&self.domain, domain)
|
||||
}
|
||||
}
|
||||
impl Drop for MemoryExecutionLoan {
|
||||
fn drop(&mut self) {
|
||||
match self.domain.state.lock() {
|
||||
|
||||
@@ -97,14 +97,15 @@ pub struct Keys {
|
||||
}
|
||||
impl Keys {
|
||||
pub fn from_ib_words(low: u64, high: u64) -> Self {
|
||||
Self {
|
||||
words: [None, Some([low, high]), None, None],
|
||||
generic: None,
|
||||
}
|
||||
Self::from_optional_words([None, Some([low, high]), None, None])
|
||||
}
|
||||
pub fn from_words(ia: [u64; 2], ib: [u64; 2], da: [u64; 2], db: [u64; 2]) -> Self {
|
||||
Self::from_optional_words([Some(ia), Some(ib), Some(da), Some(db)])
|
||||
}
|
||||
/// Initialize this same fresh bank with explicit absent domains, never zero keys.
|
||||
pub(crate) fn from_optional_words(words: [Option<[u64; 2]>; 4]) -> Self {
|
||||
Self {
|
||||
words: [Some(ia), Some(ib), Some(da), Some(db)],
|
||||
words,
|
||||
generic: None,
|
||||
}
|
||||
}
|
||||
@@ -1065,3 +1066,20 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) mod features;
|
||||
pub use features::UnsupportedInstructionProfile;
|
||||
|
||||
pub(crate) mod lr_context;
|
||||
|
||||
pub(crate) mod lr_instruction;
|
||||
|
||||
pub(crate) mod lr_service;
|
||||
|
||||
mod two_modifier;
|
||||
|
||||
pub(crate) use two_modifier::ConfigurationError as TwoModifierError;
|
||||
|
||||
pub(crate) mod lr_effects;
|
||||
|
||||
pub(crate) mod conditional;
|
||||
@@ -0,0 +1,134 @@
|
||||
//! Legacy IA/IB conditional operands from the one canonical PAC descriptor.
|
||||
//! Pure pre-state staging; caller retains actual source/control/PACM authority.
|
||||
//! Initial profile has BTI absent. Landing/branch effects remain with the owner.
|
||||
|
||||
use super::lr_instruction::{Action, Key, StageError};
|
||||
use crate::system::state::Pacm;
|
||||
use stela_compiler::block::{
|
||||
PointerAuthenticationKey, PointerAuthenticationModifier,
|
||||
PointerAuthenticationOperation as Operation,
|
||||
};
|
||||
|
||||
const INSTRUCTION_BYTES: u64 = 4;
|
||||
const LINK_REGISTER: u8 = 30;
|
||||
const ZERO_REGISTER: u8 = 31;
|
||||
const HINT_POINTER_REGISTER: u8 = 17;
|
||||
const FIRST_HINT_MODIFIER: usize = 16;
|
||||
const SECOND_HINT_MODIFIER: usize = 15;
|
||||
const SP_AUTH_MODIFIER: usize = 16;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) struct Operands {
|
||||
pub key: Key,
|
||||
pub action: Action,
|
||||
pub pointer: u64,
|
||||
pub first: u64,
|
||||
pub second: Option<u64>,
|
||||
pub destination: Option<u8>,
|
||||
}
|
||||
|
||||
/// None means this operation is not conditional on PACM. Data keys and ordinary
|
||||
/// register modifiers keep their existing path. Some snapshots every operand,
|
||||
/// including OLD X16/X15, before the canonical consumer can write any register.
|
||||
pub(crate) fn stage(
|
||||
operation: Operation,
|
||||
pc: u64,
|
||||
x: &[u64; 31],
|
||||
sp: u64,
|
||||
pacm: Pacm,
|
||||
) -> Result<Option<Operands>, StageError> {
|
||||
if !pc.is_multiple_of(INSTRUCTION_BYTES) {
|
||||
return Err(StageError::UnalignedPc);
|
||||
}
|
||||
let (key, action, destination, first, second) = match operation {
|
||||
Operation::Sign1716 { key } => (
|
||||
key,
|
||||
Action::Sign,
|
||||
Some(HINT_POINTER_REGISTER),
|
||||
x[FIRST_HINT_MODIFIER],
|
||||
x[SECOND_HINT_MODIFIER],
|
||||
),
|
||||
Operation::Authenticate1716 { key } => (
|
||||
key,
|
||||
Action::Authenticate,
|
||||
Some(HINT_POINTER_REGISTER),
|
||||
x[FIRST_HINT_MODIFIER],
|
||||
x[SECOND_HINT_MODIFIER],
|
||||
),
|
||||
Operation::SignIbSp => (
|
||||
PointerAuthenticationKey::Ib,
|
||||
Action::Sign,
|
||||
Some(LINK_REGISTER),
|
||||
sp,
|
||||
pc,
|
||||
),
|
||||
Operation::AuthenticateIbSp => (
|
||||
PointerAuthenticationKey::Ib,
|
||||
Action::Authenticate,
|
||||
Some(LINK_REGISTER),
|
||||
sp,
|
||||
x[SP_AUTH_MODIFIER],
|
||||
),
|
||||
Operation::Sign {
|
||||
key,
|
||||
destination,
|
||||
modifier: PointerAuthenticationModifier::StackPointer,
|
||||
} if !key_is_data(key) => (key, Action::Sign, Some(destination), sp, pc),
|
||||
Operation::Authenticate {
|
||||
key,
|
||||
destination,
|
||||
modifier: PointerAuthenticationModifier::StackPointer,
|
||||
} if !key_is_data(key) => (
|
||||
key,
|
||||
Action::Authenticate,
|
||||
Some(destination),
|
||||
sp,
|
||||
x[SP_AUTH_MODIFIER],
|
||||
),
|
||||
Operation::ReturnIaSp => (
|
||||
PointerAuthenticationKey::Ia,
|
||||
Action::Return,
|
||||
None,
|
||||
sp,
|
||||
x[SP_AUTH_MODIFIER],
|
||||
),
|
||||
Operation::ReturnIbSp => (
|
||||
PointerAuthenticationKey::Ib,
|
||||
Action::Return,
|
||||
None,
|
||||
sp,
|
||||
x[SP_AUTH_MODIFIER],
|
||||
),
|
||||
_ => return Ok(None),
|
||||
};
|
||||
let key = match key {
|
||||
PointerAuthenticationKey::Ia => Key::Ia,
|
||||
PointerAuthenticationKey::Ib => Key::Ib,
|
||||
_ => return Err(StageError::InvalidOperands),
|
||||
};
|
||||
let pointer_register = destination.unwrap_or(LINK_REGISTER);
|
||||
let pointer = match pointer_register {
|
||||
ZERO_REGISTER => 0,
|
||||
register if register < ZERO_REGISTER => x[usize::from(register)],
|
||||
_ => return Err(StageError::InvalidOperands),
|
||||
};
|
||||
Ok(Some(Operands {
|
||||
key,
|
||||
action,
|
||||
pointer,
|
||||
first,
|
||||
second: if pacm == Pacm::One {
|
||||
Some(second)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
destination,
|
||||
}))
|
||||
}
|
||||
|
||||
const fn key_is_data(key: PointerAuthenticationKey) -> bool {
|
||||
matches!(
|
||||
key,
|
||||
PointerAuthenticationKey::Da | PointerAuthenticationKey::Db
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
//! Borrowed instruction-PAuth feature authority from the sole CPU-profile owner.
|
||||
//!
|
||||
//! This leaf owns no ID register bank and declares no hardware feature. The
|
||||
//! capability borrows the canonical System identification snapshot. Unrelated
|
||||
//! raw integers and Context key presence do not establish that provenance.
|
||||
//! Source/control/effect authorization remains with the runtime owners.
|
||||
|
||||
use super::Version;
|
||||
use crate::system::{identification::Register, identification_snapshot::Snapshot};
|
||||
|
||||
const ID_FIELD_MASK: u64 = 0xf;
|
||||
const ISAR1_APA_SHIFT: u32 = 4;
|
||||
const ISAR1_API_SHIFT: u32 = 8;
|
||||
const ISAR2_APA3_SHIFT: u32 = 12;
|
||||
const ISAR3_PACM_SHIFT: u32 = 12;
|
||||
const PACM_FULL_IMPLEMENTATION: u64 = 2;
|
||||
const APA_QARMA5_PAUTH_LR: u64 = 6;
|
||||
const AUTHENTICATION_ALGORITHM_ABSENT: u64 = 0;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum UnsupportedInstructionProfile {
|
||||
MissingId(Register),
|
||||
Qarma5Version(u8),
|
||||
ImplementationDefinedAlgorithm(u8),
|
||||
Qarma3Algorithm(u8),
|
||||
PacmImplementation(u8),
|
||||
}
|
||||
|
||||
/// Exact QARMA5 PAuth_LR feature fact borrowed from the same CPU snapshot.
|
||||
/// This capability does not authorize controls, PACM, source, BTI or GCS effects.
|
||||
pub(crate) struct LinkRegisterPauthCapability<'profile> {
|
||||
source: &'profile Snapshot,
|
||||
}
|
||||
|
||||
impl<'profile> LinkRegisterPauthCapability<'profile> {
|
||||
pub(crate) fn from_profile(
|
||||
source: &'profile Snapshot,
|
||||
) -> Result<Self, UnsupportedInstructionProfile> {
|
||||
check_snapshot(source, APA_QARMA5_PAUTH_LR)?;
|
||||
let isar3 = source
|
||||
.read(Register::IdAa64Isar3El1)
|
||||
.map_err(|_| UnsupportedInstructionProfile::MissingId(Register::IdAa64Isar3El1))?;
|
||||
let pacm = (isar3 >> ISAR3_PACM_SHIFT) & ID_FIELD_MASK;
|
||||
if pacm != PACM_FULL_IMPLEMENTATION {
|
||||
return Err(UnsupportedInstructionProfile::PacmImplementation(
|
||||
pacm as u8,
|
||||
));
|
||||
}
|
||||
Ok(Self { source })
|
||||
}
|
||||
|
||||
pub(crate) const fn snapshot(&self) -> &Snapshot {
|
||||
self.source
|
||||
}
|
||||
|
||||
pub(crate) const fn version(&self) -> Version {
|
||||
Version::FaultingCombined
|
||||
}
|
||||
}
|
||||
|
||||
fn check_snapshot(
|
||||
source: &Snapshot,
|
||||
expected_apa: u64,
|
||||
) -> Result<(), UnsupportedInstructionProfile> {
|
||||
check_ids_for(
|
||||
source
|
||||
.read(Register::IdAa64Isar1El1)
|
||||
.map_err(|_| UnsupportedInstructionProfile::MissingId(Register::IdAa64Isar1El1))?,
|
||||
source
|
||||
.read(Register::IdAa64Isar2El1)
|
||||
.map_err(|_| UnsupportedInstructionProfile::MissingId(Register::IdAa64Isar2El1))?,
|
||||
expected_apa,
|
||||
)
|
||||
}
|
||||
|
||||
fn check_ids_for(
|
||||
isar1: u64,
|
||||
isar2: u64,
|
||||
expected_apa: u64,
|
||||
) -> Result<(), UnsupportedInstructionProfile> {
|
||||
let api = (isar1 >> ISAR1_API_SHIFT) & ID_FIELD_MASK;
|
||||
if api != AUTHENTICATION_ALGORITHM_ABSENT {
|
||||
return Err(UnsupportedInstructionProfile::ImplementationDefinedAlgorithm(api as u8));
|
||||
}
|
||||
let apa3 = (isar2 >> ISAR2_APA3_SHIFT) & ID_FIELD_MASK;
|
||||
if apa3 != AUTHENTICATION_ALGORITHM_ABSENT {
|
||||
return Err(UnsupportedInstructionProfile::Qarma3Algorithm(apa3 as u8));
|
||||
}
|
||||
let apa = (isar1 >> ISAR1_APA_SHIFT) & ID_FIELD_MASK;
|
||||
if apa != expected_apa {
|
||||
return Err(UnsupportedInstructionProfile::Qarma5Version(apa as u8));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "features/lr_tests.rs"]
|
||||
mod lr_tests;
|
||||
@@ -0,0 +1,81 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn exact_lr_tuple_rejects_other_algorithm_versions() {
|
||||
for apa in 0..=ID_FIELD_MASK {
|
||||
for api in 0..=ID_FIELD_MASK {
|
||||
for apa3 in 0..=ID_FIELD_MASK {
|
||||
let isar1 = (apa << ISAR1_APA_SHIFT) | (api << ISAR1_API_SHIFT);
|
||||
let isar2 = apa3 << ISAR2_APA3_SHIFT;
|
||||
assert_eq!(
|
||||
check_ids_for(isar1, isar2, APA_QARMA5_PAUTH_LR).is_ok(),
|
||||
apa == APA_QARMA5_PAUTH_LR
|
||||
&& api == AUTHENTICATION_ALGORITHM_ABSENT
|
||||
&& apa3 == AUTHENTICATION_ALGORITHM_ABSENT
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lr_capability_retains_exact_shared_snapshot_and_named_missing_ids_decline() {
|
||||
let values = [
|
||||
(
|
||||
Register::IdAa64Isar1El1,
|
||||
APA_QARMA5_PAUTH_LR << ISAR1_APA_SHIFT,
|
||||
),
|
||||
(Register::IdAa64Isar2El1, 0),
|
||||
(
|
||||
Register::IdAa64Isar3El1,
|
||||
PACM_FULL_IMPLEMENTATION << ISAR3_PACM_SHIFT,
|
||||
),
|
||||
];
|
||||
for missing in [
|
||||
Register::IdAa64Isar1El1,
|
||||
Register::IdAa64Isar2El1,
|
||||
Register::IdAa64Isar3El1,
|
||||
] {
|
||||
let present: Vec<_> = values
|
||||
.into_iter()
|
||||
.filter(|(register, _)| *register != missing)
|
||||
.collect();
|
||||
let source = Snapshot::declared("lr-capability-missing-id", &present).unwrap();
|
||||
assert!(matches!(
|
||||
LinkRegisterPauthCapability::from_profile(&source),
|
||||
Err(UnsupportedInstructionProfile::MissingId(register)) if register == missing
|
||||
));
|
||||
}
|
||||
let source = Snapshot::declared("lr-capability-declared-profile", &values).unwrap();
|
||||
let capability = LinkRegisterPauthCapability::from_profile(&source).unwrap();
|
||||
assert!(std::ptr::eq(capability.snapshot(), &source));
|
||||
assert_eq!(capability.version(), Version::FaultingCombined);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn qarma5_lr_requires_actual_full_pacm_and_rejects_absent_trivial_reserved_values() {
|
||||
for pacm in 0..=ID_FIELD_MASK {
|
||||
let source = Snapshot::declared(
|
||||
"lr-capability-pacm-coherence",
|
||||
&[
|
||||
(
|
||||
Register::IdAa64Isar1El1,
|
||||
APA_QARMA5_PAUTH_LR << ISAR1_APA_SHIFT,
|
||||
),
|
||||
(Register::IdAa64Isar2El1, 0),
|
||||
(Register::IdAa64Isar3El1, pacm << ISAR3_PACM_SHIFT),
|
||||
],
|
||||
)
|
||||
.unwrap();
|
||||
let result = LinkRegisterPauthCapability::from_profile(&source);
|
||||
if pacm == PACM_FULL_IMPLEMENTATION {
|
||||
assert!(result.is_ok());
|
||||
} else {
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(UnsupportedInstructionProfile::PacmImplementation(value))
|
||||
if value == pacm as u8
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
//! Borrowed QARMA5 LR key service, never source/control or instruction authority.
|
||||
//! The eventual same-PE owner retains this loan alongside its actual source,
|
||||
//! PSTATE/PACM, sole controls and effect loan. No key material or ID bank is copied.
|
||||
use super::{
|
||||
AuthResult, AuthenticationError, Context, Key, TwoModifierError,
|
||||
features::LinkRegisterPauthCapability,
|
||||
};
|
||||
use crate::system::identification_snapshot::Snapshot;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum InstructionKey {
|
||||
A,
|
||||
B,
|
||||
}
|
||||
impl InstructionKey {
|
||||
const fn key(self) -> Key {
|
||||
match self {
|
||||
Self::A => Key::Ia,
|
||||
Self::B => Key::Ib,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Selects an architectural authentication operation, never a permission bit.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum AuthenticationKind {
|
||||
Standalone,
|
||||
Return,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Error {
|
||||
WrongSnapshot,
|
||||
WrongAddressSpace,
|
||||
WrongVersion,
|
||||
Configuration(TwoModifierError),
|
||||
Authentication(AuthenticationError),
|
||||
}
|
||||
|
||||
/// One immutable Context and the same actual Snapshot allocation held together.
|
||||
/// This type deliberately has no Clone/Copy and no key or mutable-state getter.
|
||||
/// A successful constructor supplies crypto ownership only. The executing owner
|
||||
/// must still resolve actual enable/traps and retain all instruction effect loans.
|
||||
pub(crate) struct LinkRegisterContext<'run, 'profile> {
|
||||
capability: &'run LinkRegisterPauthCapability<'profile>,
|
||||
context: &'run Context,
|
||||
}
|
||||
|
||||
impl<'run, 'profile> LinkRegisterContext<'run, 'profile> {
|
||||
pub(crate) fn new(
|
||||
snapshot: &Snapshot,
|
||||
address_space: u64,
|
||||
capability: &'run LinkRegisterPauthCapability<'profile>,
|
||||
context: &'run Context,
|
||||
) -> Result<Self, Error> {
|
||||
if !snapshot.same_snapshot(capability.snapshot()) {
|
||||
return Err(Error::WrongSnapshot);
|
||||
}
|
||||
if address_space != context.address_space() {
|
||||
return Err(Error::WrongAddressSpace);
|
||||
}
|
||||
if context.version() != capability.version() {
|
||||
return Err(Error::WrongVersion);
|
||||
}
|
||||
Ok(Self {
|
||||
capability,
|
||||
context,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn snapshot(&self) -> &Snapshot {
|
||||
self.capability.snapshot()
|
||||
}
|
||||
|
||||
pub(crate) fn sign(
|
||||
&self,
|
||||
key: InstructionKey,
|
||||
pointer: u64,
|
||||
modifier1: u64,
|
||||
modifier2: u64,
|
||||
) -> Result<u64, Error> {
|
||||
self.context
|
||||
.sign_two_modifiers(key.key(), pointer, modifier1, modifier2)
|
||||
.map_err(Error::Configuration)
|
||||
}
|
||||
|
||||
/// Existing single-modifier semantics for legacy forms with actual PACM zero.
|
||||
pub(crate) fn sign_single(
|
||||
&self,
|
||||
key: InstructionKey,
|
||||
pointer: u64,
|
||||
modifier: u64,
|
||||
) -> Result<u64, Error> {
|
||||
self.context
|
||||
.sign(key.key(), pointer, modifier)
|
||||
.map_err(|_| Error::Configuration(TwoModifierError::KeyUnavailable { key: key.key() }))
|
||||
}
|
||||
|
||||
pub(crate) fn authenticate_single(
|
||||
&self,
|
||||
key: InstructionKey,
|
||||
pointer: u64,
|
||||
modifier: u64,
|
||||
kind: AuthenticationKind,
|
||||
) -> Result<AuthResult, Error> {
|
||||
self.context
|
||||
.authenticate_operation(
|
||||
key.key(),
|
||||
pointer,
|
||||
modifier,
|
||||
matches!(kind, AuthenticationKind::Return),
|
||||
)
|
||||
.map_err(Error::Authentication)
|
||||
}
|
||||
|
||||
pub(crate) fn authenticate(
|
||||
&self,
|
||||
key: InstructionKey,
|
||||
pointer: u64,
|
||||
modifier1: u64,
|
||||
modifier2: u64,
|
||||
kind: AuthenticationKind,
|
||||
) -> Result<AuthResult, Error> {
|
||||
self.context
|
||||
.authenticate_two_modifiers(
|
||||
key.key(),
|
||||
pointer,
|
||||
modifier1,
|
||||
modifier2,
|
||||
matches!(kind, AuthenticationKind::Return),
|
||||
)
|
||||
.map_err(Error::Configuration)?
|
||||
.map_err(Error::Authentication)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "lr_context/tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,139 @@
|
||||
//! Configuration/crypto component checks; these observations are not ARM originals.
|
||||
use super::*;
|
||||
use crate::{
|
||||
pauth::{Keys, Version},
|
||||
system::identification::Register,
|
||||
};
|
||||
|
||||
const ADDRESS_SPACE: u64 = 0x243;
|
||||
const POINTER: u64 = 0x1234;
|
||||
const MODIFIER1: u64 = 0x1234_5678_9abc_def0;
|
||||
const MODIFIER2: u64 = 0xfedc_ba98_7654_3210;
|
||||
// Independent literal selection of June modifier2[36:5]::modifier1[35:4].
|
||||
const PACKED: u64 = 0xc3b2_a190_89ab_cdef;
|
||||
const CORRUPT_PAC: u64 = 1 << 47;
|
||||
|
||||
fn snapshot() -> Snapshot {
|
||||
Snapshot::declared(
|
||||
"explicit-lr-context-component-v1",
|
||||
&[
|
||||
(Register::IdAa64Isar1El1, 6 << 4),
|
||||
(Register::IdAa64Isar2El1, 0),
|
||||
(Register::IdAa64Isar3El1, 2 << 12),
|
||||
],
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
fn context(version: Version) -> Context {
|
||||
Context::new_with_version(
|
||||
ADDRESS_SPACE,
|
||||
Keys::from_words([1, 2], [3, 4], [5, 6], [7, 8]),
|
||||
version,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn both_keys_borrow_canonical_context_and_same_snapshot_without_state_commit() {
|
||||
let ids = snapshot();
|
||||
let capability = LinkRegisterPauthCapability::from_profile(&ids).unwrap();
|
||||
let context = context(Version::FaultingCombined);
|
||||
let loan = LinkRegisterContext::new(&ids, ADDRESS_SPACE, &capability, &context).unwrap();
|
||||
assert!(loan.snapshot().same_snapshot(&ids));
|
||||
for key in [InstructionKey::A, InstructionKey::B] {
|
||||
for pointer in [
|
||||
0,
|
||||
POINTER,
|
||||
0x7fff_ffff_ffff,
|
||||
0xffff_8000_0000_1234,
|
||||
u64::MAX,
|
||||
] {
|
||||
let signed = loan.sign(key, pointer, MODIFIER1, MODIFIER2).unwrap();
|
||||
assert_eq!(signed, context.sign(key.key(), pointer, PACKED).unwrap());
|
||||
for kind in [AuthenticationKind::Standalone, AuthenticationKind::Return] {
|
||||
assert_eq!(
|
||||
loan.authenticate(key, signed, MODIFIER1, MODIFIER2, kind),
|
||||
Ok(AuthResult {
|
||||
pointer,
|
||||
authenticated: true
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
loan.authenticate(key, signed ^ CORRUPT_PAC, MODIFIER1, MODIFIER2, kind),
|
||||
Err(Error::Authentication(AuthenticationError::Failure {
|
||||
code: u8::from(key == InstructionKey::B)
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn equal_readbacks_from_a_foreign_snapshot_never_gain_the_loan() {
|
||||
let ids = snapshot();
|
||||
let foreign = snapshot();
|
||||
let capability = LinkRegisterPauthCapability::from_profile(&ids).unwrap();
|
||||
let context = context(Version::FaultingCombined);
|
||||
assert!(matches!(
|
||||
LinkRegisterContext::new(&foreign, ADDRESS_SPACE, &capability, &context),
|
||||
Err(Error::WrongSnapshot)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn foreign_address_space_and_old_policy_decline_before_crypto() {
|
||||
let ids = snapshot();
|
||||
let capability = LinkRegisterPauthCapability::from_profile(&ids).unwrap();
|
||||
let valid = context(Version::FaultingCombined);
|
||||
assert!(matches!(
|
||||
LinkRegisterContext::new(&ids, ADDRESS_SPACE + 1, &capability, &valid),
|
||||
Err(Error::WrongAddressSpace)
|
||||
));
|
||||
for version in [Version::Classic, Version::Enhanced, Version::Faulting] {
|
||||
let wrong = context(version);
|
||||
assert!(matches!(
|
||||
LinkRegisterContext::new(&ids, ADDRESS_SPACE, &capability, &wrong),
|
||||
Err(Error::WrongVersion)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn absent_selected_key_is_configuration_and_never_a_zero_key() {
|
||||
let ids = snapshot();
|
||||
let capability = LinkRegisterPauthCapability::from_profile(&ids).unwrap();
|
||||
let context = Context::new_with_version(
|
||||
ADDRESS_SPACE,
|
||||
Keys::from_ib_words(3, 4),
|
||||
Version::FaultingCombined,
|
||||
);
|
||||
let loan = LinkRegisterContext::new(&ids, ADDRESS_SPACE, &capability, &context).unwrap();
|
||||
let expected = Error::Configuration(TwoModifierError::KeyUnavailable { key: Key::Ia });
|
||||
assert_eq!(
|
||||
loan.sign(InstructionKey::A, POINTER, MODIFIER1, MODIFIER2),
|
||||
Err(expected)
|
||||
);
|
||||
for kind in [AuthenticationKind::Standalone, AuthenticationKind::Return] {
|
||||
assert_eq!(
|
||||
loan.authenticate(InstructionKey::A, POINTER, MODIFIER1, MODIFIER2, kind),
|
||||
Err(expected)
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
loan.sign(InstructionKey::B, POINTER, MODIFIER1, MODIFIER2)
|
||||
.is_ok()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn old_algorithm_snapshot_cannot_create_lr_capability() {
|
||||
let ids = Snapshot::declared(
|
||||
"explicit-old-pauth-component-v1",
|
||||
&[
|
||||
(Register::IdAa64Isar1El1, 5 << 4),
|
||||
(Register::IdAa64Isar2El1, 0),
|
||||
],
|
||||
)
|
||||
.unwrap();
|
||||
assert!(LinkRegisterPauthCapability::from_profile(&ids).is_err());
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
//! Read-only LR evaluation over the actual borrowed key/control/frame owners.
|
||||
//!
|
||||
//! Effects are candidates, not execution permits. The canonical Active consumer
|
||||
//! validates source/current PC and all applicable state effects, then performs
|
||||
//! the single register/PSTATE/PC commit and postchecks. This module owns no bank,
|
||||
//! native entry, source lookup, branch fetch, exception entry or finalizer.
|
||||
|
||||
use super::{
|
||||
AuthenticationError,
|
||||
conditional::Operands,
|
||||
lr_context::{self, AuthenticationKind, InstructionKey},
|
||||
lr_instruction::{Action, Instruction, Key, Staged},
|
||||
lr_service::{self, BorrowedLinkRegisterService, KeySelection, PacmControlValue},
|
||||
};
|
||||
use crate::system::state::Pacm;
|
||||
use stela_compiler::{GuestAddress, block::PointerAuthenticationOperation};
|
||||
|
||||
const ZERO_REGISTER: u8 = 31;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Effect {
|
||||
Register { destination: u8, value: u64 },
|
||||
Return { target: GuestAddress },
|
||||
Pacm(Pacm),
|
||||
Discard,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Evaluation {
|
||||
Candidate(Effect),
|
||||
AuthenticationFault { code: u8 },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Error {
|
||||
Service(lr_service::Error),
|
||||
Crypto(lr_context::Error),
|
||||
InvalidDestination,
|
||||
}
|
||||
|
||||
/// No guest state changes, including on missing resources or authentication
|
||||
/// failure. Explicit LR forms always use both staged modifiers; PACM does not
|
||||
/// change that selection. Selected-key bypass precedes any key lookup.
|
||||
pub(crate) fn evaluate(
|
||||
instruction: Instruction,
|
||||
service: &BorrowedLinkRegisterService<'_>,
|
||||
) -> Result<Evaluation, Error> {
|
||||
let staged = service.stage(instruction).map_err(Error::Service)?;
|
||||
let Staged::Pointer(operands) = staged else {
|
||||
let value = match service.pacm_control_value().map_err(Error::Service)? {
|
||||
PacmControlValue::Zero => Pacm::Zero,
|
||||
PacmControlValue::One => Pacm::One,
|
||||
};
|
||||
return Ok(Evaluation::Candidate(Effect::Pacm(value)));
|
||||
};
|
||||
evaluate_pointer(
|
||||
Operands {
|
||||
key: operands.key,
|
||||
action: operands.action,
|
||||
pointer: operands.pointer,
|
||||
first: operands.modifier1,
|
||||
second: Some(operands.modifier2),
|
||||
destination: operands.destination,
|
||||
},
|
||||
service,
|
||||
)
|
||||
}
|
||||
|
||||
/// Legacy SP/1716/RET forms select modifiers from actual borrowed PACM.
|
||||
/// None leaves other forms with their existing single-modifier service.
|
||||
/// XZR discards only a successful result, after key/resource/fault checks.
|
||||
pub(crate) fn evaluate_conditional(
|
||||
operation: PointerAuthenticationOperation,
|
||||
service: &BorrowedLinkRegisterService<'_>,
|
||||
) -> Result<Option<Evaluation>, Error> {
|
||||
service
|
||||
.stage_conditional(operation)
|
||||
.map_err(Error::Service)?
|
||||
.map(|operands| evaluate_pointer(operands, service))
|
||||
.transpose()
|
||||
}
|
||||
|
||||
fn evaluate_pointer(
|
||||
operands: Operands,
|
||||
service: &BorrowedLinkRegisterService<'_>,
|
||||
) -> Result<Evaluation, Error> {
|
||||
let key = match operands.key {
|
||||
Key::Ia => InstructionKey::A,
|
||||
Key::Ib => InstructionKey::B,
|
||||
};
|
||||
let value = match service.key_selection(key) {
|
||||
KeySelection::Bypass => operands.pointer,
|
||||
KeySelection::UseKey => {
|
||||
let crypto = service.crypto().map_err(Error::Service)?;
|
||||
if operands.action == Action::Sign {
|
||||
match operands.second {
|
||||
Some(second) => crypto.sign(key, operands.pointer, operands.first, second),
|
||||
None => crypto.sign_single(key, operands.pointer, operands.first),
|
||||
}
|
||||
.map_err(Error::Crypto)?
|
||||
} else {
|
||||
let kind = if operands.action == Action::Return {
|
||||
AuthenticationKind::Return
|
||||
} else {
|
||||
AuthenticationKind::Standalone
|
||||
};
|
||||
let authenticated = match operands.second {
|
||||
Some(second) => {
|
||||
crypto.authenticate(key, operands.pointer, operands.first, second, kind)
|
||||
}
|
||||
None => crypto.authenticate_single(key, operands.pointer, operands.first, kind),
|
||||
};
|
||||
match authenticated {
|
||||
Ok(result) => result.pointer,
|
||||
Err(lr_context::Error::Authentication(AuthenticationError::Failure {
|
||||
code,
|
||||
})) => {
|
||||
return Ok(Evaluation::AuthenticationFault { code });
|
||||
}
|
||||
Err(error) => return Err(Error::Crypto(error)),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
let effect = if operands.action == Action::Return {
|
||||
Effect::Return {
|
||||
target: GuestAddress(value),
|
||||
}
|
||||
} else {
|
||||
match operands.destination {
|
||||
Some(ZERO_REGISTER) => Effect::Discard,
|
||||
Some(destination) if destination < ZERO_REGISTER => {
|
||||
Effect::Register { destination, value }
|
||||
}
|
||||
_ => return Err(Error::InvalidDestination),
|
||||
}
|
||||
};
|
||||
Ok(Evaluation::Candidate(effect))
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
//! Pre-state operands/effects for the canonical compiler LR descriptor.
|
||||
//! No duplicate encoding table, CPU/key authority, native entry or PC commit.
|
||||
|
||||
#[cfg(test)]
|
||||
use stela_compiler::block::pauth_lr::decode;
|
||||
pub(crate) use stela_compiler::block::pauth_lr::{Instruction, Key};
|
||||
|
||||
const REGISTER_MASK: u32 = 31;
|
||||
const INSTRUCTION_BYTES: u64 = 4;
|
||||
const LINK_REGISTER: usize = 30;
|
||||
const POINTER_REGISTER: usize = 17;
|
||||
const FIRST_MODIFIER: usize = 16;
|
||||
const SECOND_MODIFIER: usize = 15;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Action {
|
||||
Sign,
|
||||
Authenticate,
|
||||
Return,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Operands {
|
||||
pub key: Key,
|
||||
pub action: Action,
|
||||
pub pointer: u64,
|
||||
pub modifier1: u64,
|
||||
pub modifier2: u64,
|
||||
pub destination: Option<u8>,
|
||||
pub implicit_bti: bool,
|
||||
pub instruction_pc: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Staged {
|
||||
Pointer(Operands),
|
||||
Pacm,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum StageError {
|
||||
InvalidOperands,
|
||||
UnalignedPc,
|
||||
}
|
||||
|
||||
/// A snapshot, never an execution token. All values come from the same pre-state.
|
||||
/// The actual owner must authorize source, CPU, selected key/controls and effects.
|
||||
pub fn stage(
|
||||
instruction: Instruction,
|
||||
pc: u64,
|
||||
x: &[u64; 31],
|
||||
sp: u64,
|
||||
) -> Result<Staged, StageError> {
|
||||
if !instruction.valid() {
|
||||
return Err(StageError::InvalidOperands);
|
||||
}
|
||||
if !pc.is_multiple_of(INSTRUCTION_BYTES) {
|
||||
return Err(StageError::UnalignedPc);
|
||||
}
|
||||
let mut operands = Operands {
|
||||
key: Key::Ia,
|
||||
action: Action::Authenticate,
|
||||
pointer: x[LINK_REGISTER],
|
||||
modifier1: sp,
|
||||
modifier2: pc,
|
||||
destination: Some(LINK_REGISTER as u8),
|
||||
implicit_bti: false,
|
||||
instruction_pc: pc,
|
||||
};
|
||||
match instruction {
|
||||
Instruction::Pacm => return Ok(Staged::Pacm),
|
||||
Instruction::Sign171615(key) | Instruction::Authenticate171615(key) => {
|
||||
operands.key = key;
|
||||
operands.pointer = x[POINTER_REGISTER];
|
||||
operands.modifier1 = x[FIRST_MODIFIER];
|
||||
operands.modifier2 = x[SECOND_MODIFIER];
|
||||
operands.destination = Some(POINTER_REGISTER as u8);
|
||||
if matches!(instruction, Instruction::Sign171615(_)) {
|
||||
operands.action = Action::Sign;
|
||||
}
|
||||
}
|
||||
Instruction::AuthenticateSpRegister { key, register } => {
|
||||
operands.key = key;
|
||||
operands.modifier2 = if register == REGISTER_MASK as u8 {
|
||||
0
|
||||
} else {
|
||||
x[usize::from(register)]
|
||||
};
|
||||
}
|
||||
Instruction::AuthenticateSpPc { key, offset } => {
|
||||
operands.key = key;
|
||||
operands.modifier2 = pc.wrapping_sub(u64::from(offset));
|
||||
}
|
||||
Instruction::SignSpPc { key, implicit_bti } => {
|
||||
operands.key = key;
|
||||
operands.action = Action::Sign;
|
||||
operands.implicit_bti = implicit_bti;
|
||||
}
|
||||
Instruction::ReturnSpRegister { key, register } => {
|
||||
operands.key = key;
|
||||
operands.action = Action::Return;
|
||||
operands.modifier2 = x[usize::from(register)];
|
||||
operands.destination = None;
|
||||
}
|
||||
Instruction::ReturnSpPc { key, offset } => {
|
||||
operands.key = key;
|
||||
operands.action = Action::Return;
|
||||
operands.modifier2 = pc.wrapping_sub(u64::from(offset));
|
||||
operands.destination = None;
|
||||
}
|
||||
}
|
||||
Ok(Staged::Pointer(operands))
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg(test)]
|
||||
pub enum FeatureEffect {
|
||||
Execute,
|
||||
NoEffect,
|
||||
Undefined,
|
||||
}
|
||||
|
||||
/// PACM alone is a HINT NOP when FEAT_PAuth_LR is absent.
|
||||
#[cfg(test)]
|
||||
pub const fn feature_effect(instruction: Instruction, present: bool) -> FeatureEffect {
|
||||
if present {
|
||||
FeatureEffect::Execute
|
||||
} else if matches!(instruction, Instruction::Pacm) {
|
||||
FeatureEffect::NoEffect
|
||||
} else {
|
||||
FeatureEffect::Undefined
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg(test)]
|
||||
pub enum PacmEffect {
|
||||
NoEffect,
|
||||
Set(bool),
|
||||
}
|
||||
|
||||
/// Pure state effect after the system owner resolves IsPACMEnabled from the
|
||||
/// selected current EL/SCTLR2/HCRX controls. No state ownership is conferred.
|
||||
#[cfg(test)]
|
||||
pub const fn pacm_effect(feature_present: bool, enabled: bool) -> PacmEffect {
|
||||
if feature_present {
|
||||
PacmEffect::Set(enabled)
|
||||
} else {
|
||||
PacmEffect::NoEffect
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "pauth_lr_tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,172 @@
|
||||
//! Read-only LR operand/key service over the canonical owners' original loans.
|
||||
//!
|
||||
//! The consumed fixed-bank control read loan retains the actual source-domain
|
||||
//! pin. Domain identity alone does not prove PE/thread identity: the canonical
|
||||
//! consumer must retain the exact original PE/frame/System/outer object.
|
||||
//! No constructor creates a PE, Context, key bank, SystemState, guest frame or
|
||||
//! controls. This service neither admits an instruction nor changes guest state.
|
||||
//! The closed consumer still owns source identity/PC, layout and key-enable
|
||||
//! selection, BTI/GCS, PACM, traps, retirement and exception delivery. Its source
|
||||
//! descriptor is data, never an entry permit. A crypto result is only a candidate
|
||||
//! until those owners have completed their checks and effects in source order.
|
||||
|
||||
use super::{
|
||||
Context,
|
||||
features::{LinkRegisterPauthCapability, UnsupportedInstructionProfile},
|
||||
lr_context::{self, InstructionKey, LinkRegisterContext},
|
||||
lr_instruction::{self, Instruction, Staged},
|
||||
};
|
||||
use crate::system::{
|
||||
access::ExceptionLevel,
|
||||
process_memory::{
|
||||
SCTLR_ENIA, SCTLR_ENIB,
|
||||
extended_controls::{ExtendedControlLoan, SCTLR2_ENPACM, SCTLR2_ENPACM0},
|
||||
},
|
||||
state::{PacmStateFeature, SystemState},
|
||||
};
|
||||
use stela_compiler::{GuestAddress, GuestState, block::PointerAuthenticationOperation};
|
||||
|
||||
/// A decoded current control fact, not an execution grant or caller permission.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum KeySelection {
|
||||
Bypass,
|
||||
UseKey,
|
||||
}
|
||||
|
||||
/// Selected actual raw control value; this creates no PACM state effect.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum PacmControlValue {
|
||||
Zero,
|
||||
One,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Error {
|
||||
Profile(UnsupportedInstructionProfile),
|
||||
Context(lr_context::Error),
|
||||
Stage(lr_instruction::StageError),
|
||||
UnsupportedCurrentEl,
|
||||
MissingPacmStorage,
|
||||
}
|
||||
|
||||
/// Exclusive execution remains with the caller that lent these original refs.
|
||||
/// No Clone/Copy or mutable getters; no state snapshot or secondary bank is kept.
|
||||
pub(crate) struct BorrowedLinkRegisterService<'run> {
|
||||
capability: LinkRegisterPauthCapability<'run>,
|
||||
context: &'run Context,
|
||||
controls: ExtendedControlLoan<'run>,
|
||||
registers: &'run GuestState,
|
||||
instruction_pc: GuestAddress,
|
||||
system: &'run SystemState,
|
||||
}
|
||||
|
||||
impl<'run> BorrowedLinkRegisterService<'run> {
|
||||
/// Consumes the actual bank/source read loan, not copied control values.
|
||||
/// Namespace equality is a crypto consistency check, not source authority.
|
||||
/// The actual closed owner must lend its own namespace and original refs.
|
||||
pub(crate) fn new(
|
||||
controls: ExtendedControlLoan<'run>,
|
||||
context: &'run Context,
|
||||
registers: &'run GuestState,
|
||||
instruction_pc: GuestAddress,
|
||||
system: &'run SystemState,
|
||||
) -> Result<Self, Error> {
|
||||
if system.pacm_state_feature() != PacmStateFeature::Full {
|
||||
return Err(Error::MissingPacmStorage);
|
||||
}
|
||||
let snapshot = controls.snapshot();
|
||||
let capability =
|
||||
LinkRegisterPauthCapability::from_profile(snapshot).map_err(Error::Profile)?;
|
||||
let crypto =
|
||||
LinkRegisterContext::new(snapshot, controls.address_space(), &capability, context)
|
||||
.map_err(Error::Context)?;
|
||||
if !crypto.snapshot().same_snapshot(snapshot) {
|
||||
return Err(Error::Context(lr_context::Error::WrongSnapshot));
|
||||
}
|
||||
Ok(Self {
|
||||
capability,
|
||||
context,
|
||||
controls,
|
||||
registers,
|
||||
instruction_pc,
|
||||
system,
|
||||
})
|
||||
}
|
||||
|
||||
/// Read current original registers and the canonical settled source PC.
|
||||
/// Decode/source/lifecycle authorization and all state commits stay outside.
|
||||
pub(crate) fn stage(&self, instruction: Instruction) -> Result<Staged, Error> {
|
||||
lr_instruction::stage(
|
||||
instruction,
|
||||
self.instruction_pc.0,
|
||||
&self.registers.x,
|
||||
self.registers.sp,
|
||||
)
|
||||
.map_err(Error::Stage)
|
||||
}
|
||||
|
||||
/// Legacy conditional operands use actual PACM from the sole SystemState.
|
||||
/// None leaves ordinary register/data-key operations on their existing path.
|
||||
pub(crate) fn stage_conditional(
|
||||
&self,
|
||||
operation: PointerAuthenticationOperation,
|
||||
) -> Result<Option<super::conditional::Operands>, Error> {
|
||||
super::conditional::stage(
|
||||
operation,
|
||||
self.instruction_pc.0,
|
||||
&self.registers.x,
|
||||
self.registers.sp,
|
||||
self.system.pacm(),
|
||||
)
|
||||
.map_err(Error::Stage)
|
||||
}
|
||||
|
||||
/// Test-only architectural observation; this grants no execution permission.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn pstate(&self) -> u64 {
|
||||
self.system.pstate(self.registers)
|
||||
}
|
||||
|
||||
pub(crate) fn key_selection(&self, key: InstructionKey) -> KeySelection {
|
||||
let mask = match key {
|
||||
InstructionKey::A => SCTLR_ENIA,
|
||||
InstructionKey::B => SCTLR_ENIB,
|
||||
};
|
||||
if self.controls.sctlr_el1() & mask == 0 {
|
||||
KeySelection::Bypass
|
||||
} else {
|
||||
KeySelection::UseKey
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn pacm_control_value(&self) -> Result<PacmControlValue, Error> {
|
||||
let mask = match self.system.current_el() {
|
||||
ExceptionLevel::El0 => SCTLR2_ENPACM0,
|
||||
ExceptionLevel::El1 => SCTLR2_ENPACM,
|
||||
_ => return Err(Error::UnsupportedCurrentEl),
|
||||
};
|
||||
Ok(if self.controls.sctlr2_el1() & mask == 0 {
|
||||
PacmControlValue::Zero
|
||||
} else {
|
||||
PacmControlValue::One
|
||||
})
|
||||
}
|
||||
|
||||
/// Original raw layout controls for the parent's exact layout qualifier.
|
||||
/// Returning these values neither selects a layout nor changes a bank.
|
||||
pub(crate) fn tcr_controls(&self) -> (u64, u64) {
|
||||
(self.controls.tcr_el1(), self.controls.tcr2_el1())
|
||||
}
|
||||
|
||||
/// Unconditional pure key service; this does not apply key-enable selection,
|
||||
/// prove TCR layout, perform a guest operation or grant retirement.
|
||||
pub(crate) fn crypto(&self) -> Result<LinkRegisterContext<'_, 'run>, Error> {
|
||||
LinkRegisterContext::new(
|
||||
self.capability.snapshot(),
|
||||
self.controls.address_space(),
|
||||
&self.capability,
|
||||
self.context,
|
||||
)
|
||||
.map_err(Error::Context)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn exact_canonical_subjects() {
|
||||
for &(word, canonical_id) in CANONICAL_WORDS {
|
||||
let instruction = decode(word).expect("allocated June subject");
|
||||
assert_eq!(instruction.canonical_id(), canonical_id);
|
||||
assert_eq!(feature_effect(instruction, true), FeatureEffect::Execute);
|
||||
assert_eq!(
|
||||
feature_effect(instruction, false),
|
||||
if instruction == Instruction::Pacm {
|
||||
FeatureEffect::NoEffect
|
||||
} else {
|
||||
FeatureEffect::Undefined
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_allocated_register_and_legacy_return_exclusion() {
|
||||
for register in 0..32 {
|
||||
for (word, key) in [(0xdac1_901e, Key::Ia), (0xdac1_941e, Key::Ib)] {
|
||||
assert_eq!(
|
||||
decode(word | register << 5),
|
||||
Some(Instruction::AuthenticateSpRegister {
|
||||
key,
|
||||
register: register as u8
|
||||
})
|
||||
);
|
||||
}
|
||||
for (word, key) in [(0xd65f_0be0, Key::Ia), (0xd65f_0fe0, Key::Ib)] {
|
||||
assert_eq!(
|
||||
decode(word | register),
|
||||
(register != 31).then_some(Instruction::ReturnSpRegister {
|
||||
key,
|
||||
register: register as u8
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
assert_eq!(decode(0xd65f_0bff), None); // RETAA remains existing owner's form.
|
||||
assert_eq!(decode(0xd65f_0fff), None); // RETAB remains existing owner's form.
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_immediate_is_unsigned_scaled_and_subtracted_with_wrap() {
|
||||
let x = std::array::from_fn(|n| 0x4000 + n as u64);
|
||||
for immediate in 0..=u16::MAX {
|
||||
let offset = u32::from(immediate) * 4;
|
||||
for &(word, key, action) in &[
|
||||
(0xf380_001f, Key::Ia, Action::Authenticate),
|
||||
(0xf3a0_001f, Key::Ib, Action::Authenticate),
|
||||
(0x5500_001f, Key::Ia, Action::Return),
|
||||
(0x5520_001f, Key::Ib, Action::Return),
|
||||
] {
|
||||
let instruction = decode(word | u32::from(immediate) << 5).unwrap();
|
||||
let Staged::Pointer(operands) = stage(instruction, 4, &x, 0x8000).unwrap() else {
|
||||
panic!("pointer form");
|
||||
};
|
||||
assert_eq!(operands.modifier2, 4u64.wrapping_sub(u64::from(offset)));
|
||||
assert_eq!((operands.key, operands.action), (key, action));
|
||||
assert_eq!(operands.pointer, x[30]);
|
||||
assert_eq!(operands.modifier1, 0x8000);
|
||||
assert_eq!(
|
||||
operands.destination,
|
||||
if action == Action::Return {
|
||||
None
|
||||
} else {
|
||||
Some(30)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_snapshots_zero_register_and_destination_roles() {
|
||||
let x = std::array::from_fn(|n| 0x1122_3344_0000_0000 + n as u64);
|
||||
for key in [Key::Ia, Key::Ib] {
|
||||
for instruction in [
|
||||
Instruction::Authenticate171615(key),
|
||||
Instruction::Sign171615(key),
|
||||
] {
|
||||
let Staged::Pointer(o) = stage(instruction, 0x1000, &x, 0x9876).unwrap() else {
|
||||
panic!()
|
||||
};
|
||||
assert_eq!(
|
||||
(o.pointer, o.modifier1, o.modifier2, o.destination),
|
||||
(x[17], x[16], x[15], Some(17))
|
||||
);
|
||||
}
|
||||
for register in 0..=31 {
|
||||
let Staged::Pointer(o) = stage(
|
||||
Instruction::AuthenticateSpRegister { key, register },
|
||||
0x1000,
|
||||
&x,
|
||||
0x9876,
|
||||
)
|
||||
.unwrap() else {
|
||||
panic!()
|
||||
};
|
||||
assert_eq!(
|
||||
o.modifier2,
|
||||
if register == 31 {
|
||||
0
|
||||
} else {
|
||||
x[usize::from(register)]
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
(o.pointer, o.modifier1, o.destination),
|
||||
(x[30], 0x9876, Some(30))
|
||||
);
|
||||
}
|
||||
let Staged::Pointer(o) = stage(
|
||||
Instruction::ReturnSpRegister { key, register: 30 },
|
||||
0x1000,
|
||||
&x,
|
||||
0x9876,
|
||||
)
|
||||
.unwrap() else {
|
||||
panic!()
|
||||
};
|
||||
assert_eq!(
|
||||
(o.pointer, o.modifier2, o.destination),
|
||||
(x[30], x[30], None)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn implicit_bti_is_confined_to_pacixsppc() {
|
||||
let x = [42; 31];
|
||||
for (word, expected) in [
|
||||
(0xdac1_a3fe, true),
|
||||
(0xdac1_a7fe, true),
|
||||
(0xdac1_83fe, false),
|
||||
(0xdac1_87fe, false),
|
||||
(0xdac1_8bfe, false),
|
||||
(0xdac1_8ffe, false),
|
||||
] {
|
||||
let Staged::Pointer(o) = stage(decode(word).unwrap(), 0x1000, &x, 0x8000).unwrap() else {
|
||||
panic!()
|
||||
};
|
||||
assert_eq!(o.implicit_bti, expected);
|
||||
assert_eq!(o.action, Action::Sign);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_typed_operands_decline_before_indexing() {
|
||||
let x = [0; 31];
|
||||
for instruction in [
|
||||
Instruction::AuthenticateSpRegister {
|
||||
key: Key::Ia,
|
||||
register: 32,
|
||||
},
|
||||
Instruction::ReturnSpRegister {
|
||||
key: Key::Ib,
|
||||
register: 31,
|
||||
},
|
||||
Instruction::AuthenticateSpPc {
|
||||
key: Key::Ia,
|
||||
offset: 1,
|
||||
},
|
||||
Instruction::ReturnSpPc {
|
||||
key: Key::Ib,
|
||||
offset: 262_144,
|
||||
},
|
||||
] {
|
||||
assert_eq!(
|
||||
stage(instruction, 0x1000, &x, 0),
|
||||
Err(StageError::InvalidOperands)
|
||||
);
|
||||
}
|
||||
for instruction in [Instruction::Pacm, Instruction::Sign171615(Key::Ia)] {
|
||||
assert_eq!(stage(instruction, 1, &x, 0), Err(StageError::UnalignedPc));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pacm_feature_and_resolved_control_truth_table() {
|
||||
assert_eq!(
|
||||
stage(Instruction::Pacm, 0x1000, &[0; 31], 0).unwrap(),
|
||||
Staged::Pacm
|
||||
);
|
||||
for enabled in [false, true] {
|
||||
assert_eq!(pacm_effect(false, enabled), PacmEffect::NoEffect);
|
||||
assert_eq!(pacm_effect(true, enabled), PacmEffect::Set(enabled));
|
||||
}
|
||||
}
|
||||
|
||||
// Independent expected words and IDs pinned in contracts.json to June XML.
|
||||
const CANONICAL_WORDS: &[(u32, &str)] = &[
|
||||
(0xdac1bbfe, "AUTIA171615_64LR_dp_1src"),
|
||||
(0xdac1901e, "AUTIASPPCR_64LRR_dp_1src"),
|
||||
(0xf380001f, "AUTIASPPC_only_dp_1src_imm"),
|
||||
(0xdac1bffe, "AUTIB171615_64LR_dp_1src"),
|
||||
(0xdac1941e, "AUTIBSPPCR_64LRR_dp_1src"),
|
||||
(0xf3a0001f, "AUTIBSPPC_only_dp_1src_imm"),
|
||||
(0xdac18bfe, "PACIA171615_64LR_dp_1src"),
|
||||
(0xdac1a3fe, "PACIASPPC_64LR_dp_1src"),
|
||||
(0xdac18ffe, "PACIB171615_64LR_dp_1src"),
|
||||
(0xdac1a7fe, "PACIBSPPC_64LR_dp_1src"),
|
||||
(0xd50324ff, "PACM_HI_hints"),
|
||||
(0xdac183fe, "PACNBIASPPC_64LR_dp_1src"),
|
||||
(0xdac187fe, "PACNBIBSPPC_64LR_dp_1src"),
|
||||
(0xd65f0be0, "RETAASPPCR_64M_branch_reg"),
|
||||
(0x5500001f, "RETAASPPC_only_miscbranch"),
|
||||
(0xd65f0fe0, "RETABSPPCR_64M_branch_reg"),
|
||||
(0x5520001f, "RETABSPPC_only_miscbranch"),
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn legacy_conditional_modifiers_preserve_source_distinctions() {
|
||||
use crate::{pauth::conditional, system::state::Pacm};
|
||||
use stela_compiler::block::{
|
||||
PointerAuthenticationKey as K, PointerAuthenticationModifier as M,
|
||||
PointerAuthenticationOperation as O,
|
||||
};
|
||||
let mut x = [0; 31];
|
||||
x[15] = 0x150;
|
||||
x[16] = 0x160;
|
||||
x[17] = 0x170;
|
||||
x[30] = 0x300;
|
||||
for key in [K::Ia, K::Ib] {
|
||||
for (operation, pointer, first, second, action) in [
|
||||
(O::Sign1716 { key }, x[17], x[16], x[15], Action::Sign),
|
||||
(
|
||||
O::Authenticate1716 { key },
|
||||
x[17],
|
||||
x[16],
|
||||
x[15],
|
||||
Action::Authenticate,
|
||||
),
|
||||
(
|
||||
O::Sign {
|
||||
key,
|
||||
destination: 16,
|
||||
modifier: M::StackPointer,
|
||||
},
|
||||
x[16],
|
||||
0x8000,
|
||||
0x1000,
|
||||
Action::Sign,
|
||||
),
|
||||
(
|
||||
O::Authenticate {
|
||||
key,
|
||||
destination: 16,
|
||||
modifier: M::StackPointer,
|
||||
},
|
||||
x[16],
|
||||
0x8000,
|
||||
x[16],
|
||||
Action::Authenticate,
|
||||
),
|
||||
] {
|
||||
for pacm in [Pacm::Zero, Pacm::One] {
|
||||
let operands = conditional::stage(operation, 0x1000, &x, 0x8000, pacm)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(operands.pointer, pointer);
|
||||
assert_eq!(operands.first, first);
|
||||
assert_eq!(operands.second, (pacm == Pacm::One).then_some(second));
|
||||
assert_eq!(operands.action, action);
|
||||
}
|
||||
}
|
||||
for operation in [
|
||||
O::Sign {
|
||||
key,
|
||||
destination: 17,
|
||||
modifier: M::Register(16),
|
||||
},
|
||||
O::Authenticate {
|
||||
key,
|
||||
destination: 17,
|
||||
modifier: M::Register(16),
|
||||
},
|
||||
] {
|
||||
assert!(
|
||||
conditional::stage(operation, 0x1000, &x, 0x8000, Pacm::One)
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
}
|
||||
assert_eq!(x[16], 0x160);
|
||||
assert_eq!(x[17], 0x170);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_sp_zero_register_and_return_stage_before_effects() {
|
||||
use crate::{pauth::conditional, system::state::Pacm};
|
||||
use stela_compiler::block::{
|
||||
PointerAuthenticationKey as K, PointerAuthenticationModifier as M,
|
||||
PointerAuthenticationOperation as O,
|
||||
};
|
||||
let mut x = [0; 31];
|
||||
x[16] = 0x160;
|
||||
x[30] = 0x300;
|
||||
for operation in [O::ReturnIaSp, O::ReturnIbSp] {
|
||||
let operands = conditional::stage(operation, 0x1000, &x, 0x8000, Pacm::One)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(operands.pointer, x[30]);
|
||||
assert_eq!(operands.destination, None);
|
||||
assert_eq!(operands.second, Some(x[16]));
|
||||
assert_eq!(operands.action, Action::Return);
|
||||
}
|
||||
for key in [K::Ia, K::Ib] {
|
||||
for operation in [
|
||||
O::Sign {
|
||||
key,
|
||||
destination: 31,
|
||||
modifier: M::StackPointer,
|
||||
},
|
||||
O::Authenticate {
|
||||
key,
|
||||
destination: 31,
|
||||
modifier: M::StackPointer,
|
||||
},
|
||||
] {
|
||||
let operands = conditional::stage(operation, 0x1000, &x, 0x8000, Pacm::One)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(operands.pointer, 0);
|
||||
assert_eq!(operands.destination, Some(31));
|
||||
}
|
||||
}
|
||||
let invalid = O::Sign {
|
||||
key: K::Ia,
|
||||
destination: 32,
|
||||
modifier: M::StackPointer,
|
||||
};
|
||||
assert_eq!(
|
||||
conditional::stage(invalid, 0x1000, &x, 0x8000, Pacm::One),
|
||||
Err(StageError::InvalidOperands)
|
||||
);
|
||||
assert_eq!(
|
||||
conditional::stage(O::ReturnIaSp, 0x1001, &x, 0x8000, Pacm::One),
|
||||
Err(StageError::UnalignedPc)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
//! Canonical instruction-PAuth two-modifier primitive over one supplied Context.
|
||||
//!
|
||||
//! This leaf grants no CPU feature or instruction authority. Callers must bind
|
||||
//! original operands/source, address space, keys and actual PAuth_LR controls.
|
||||
//! Explicit forms always supply two modifiers; old conditional forms require
|
||||
//! the CPU owner's PACM decision. BTI/GCS and all state commits remain outside.
|
||||
//! The selected QARMA5 Context retains VA47/instruction-TBI-off pointer policy.
|
||||
|
||||
use super::{AuthResult, AuthenticationError, Context, Key, Version};
|
||||
|
||||
const FIRST_MODIFIER_LOW_BIT: u32 = 4;
|
||||
const SECOND_MODIFIER_LOW_BIT: u32 = 5;
|
||||
const MODIFIER_COMPONENT_BITS: u32 = u32::BITS;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum ConfigurationError {
|
||||
DataKey { key: Key },
|
||||
UnsupportedVersion { version: Version },
|
||||
KeyUnavailable { key: Key },
|
||||
}
|
||||
|
||||
impl Context {
|
||||
/// ComputePAC2QARMA packing plus the existing InsertPAC implementation.
|
||||
/// The actual CPU/source owner must separately qualify APA6/API0/APA3zero.
|
||||
pub(crate) fn sign_two_modifiers(
|
||||
&self,
|
||||
key: Key,
|
||||
pointer: u64,
|
||||
modifier1: u64,
|
||||
modifier2: u64,
|
||||
) -> Result<u64, ConfigurationError> {
|
||||
self.check_two_modifier_configuration(key)?;
|
||||
self.sign(key, pointer, pack_modifiers(modifier1, modifier2))
|
||||
.map_err(|_| ConfigurationError::KeyUnavailable { key })
|
||||
}
|
||||
|
||||
/// Return canonical standalone/combined policy results without a state commit.
|
||||
/// Configuration errors remain separate from architectural authentication.
|
||||
pub(crate) fn authenticate_two_modifiers(
|
||||
&self,
|
||||
key: Key,
|
||||
pointer: u64,
|
||||
modifier1: u64,
|
||||
modifier2: u64,
|
||||
combined: bool,
|
||||
) -> Result<Result<AuthResult, AuthenticationError>, ConfigurationError> {
|
||||
self.check_two_modifier_configuration(key)?;
|
||||
Ok(self.authenticate_operation(
|
||||
key,
|
||||
pointer,
|
||||
pack_modifiers(modifier1, modifier2),
|
||||
combined,
|
||||
))
|
||||
}
|
||||
|
||||
fn check_two_modifier_configuration(&self, key: Key) -> Result<(), ConfigurationError> {
|
||||
if key.is_data() {
|
||||
return Err(ConfigurationError::DataKey { key });
|
||||
}
|
||||
if self.version() != Version::FaultingCombined {
|
||||
return Err(ConfigurationError::UnsupportedVersion {
|
||||
version: self.version(),
|
||||
});
|
||||
}
|
||||
if !self.has_key(key) {
|
||||
return Err(ConfigurationError::KeyUnavailable { key });
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Exact June ComputePAC2QARMA: modifier2[36:5] :: modifier1[35:4].
|
||||
/// This is not the implementation-defined ComputePAC2 primitive.
|
||||
const fn pack_modifiers(modifier1: u64, modifier2: u64) -> u64 {
|
||||
let low = (modifier1 >> FIRST_MODIFIER_LOW_BIT) as u32;
|
||||
let high = (modifier2 >> SECOND_MODIFIER_LOW_BIT) as u32;
|
||||
((high as u64) << MODIFIER_COMPONENT_BITS) | low as u64
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "two_modifier/tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,184 @@
|
||||
//! Focused source-staged component tests, not original PAuth_LR evidence.
|
||||
use super::*;
|
||||
use crate::pauth::{Keys, TwoModifierError};
|
||||
|
||||
const ADDRESS_SPACE: u64 = 7;
|
||||
const IA_KEY: [u64; 2] = [0x0123_4567_89ab_cdef, 0xfedc_ba98_7654_3210];
|
||||
const IB_KEY: [u64; 2] = [0x1020_3040_5060_7080, 0x8877_6655_4433_2211];
|
||||
const FIRST_MODIFIER: u64 = 0x1234_5678_9abc_def0;
|
||||
const SECOND_MODIFIER: u64 = 0xfedc_ba98_7654_3210;
|
||||
const TARGET: u64 = 0x1234;
|
||||
const CORRUPT_PAC_BIT: u64 = 1 << 47;
|
||||
const FIRST_RELEVANT_MASK: u64 = (u32::MAX as u64) << 4;
|
||||
const SECOND_RELEVANT_MASK: u64 = (u32::MAX as u64) << 5;
|
||||
|
||||
fn context(version: Version) -> Context {
|
||||
Context::new_with_version(
|
||||
ADDRESS_SPACE,
|
||||
Keys::from_words(IA_KEY, IB_KEY, [0; 2], [0; 2]),
|
||||
version,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn both_instruction_keys_preserve_complete_canonical_pointer_results() {
|
||||
let context = context(Version::FaultingCombined);
|
||||
for key in [Key::Ia, Key::Ib] {
|
||||
for pointer in [
|
||||
0,
|
||||
TARGET,
|
||||
0x0000_7fff_ffff_ffff,
|
||||
0xffff_8000_0000_1234,
|
||||
u64::MAX,
|
||||
] {
|
||||
let signed = context
|
||||
.sign_two_modifiers(key, pointer, FIRST_MODIFIER, SECOND_MODIFIER)
|
||||
.unwrap();
|
||||
// Separate source-slice construction validates the complete crypto
|
||||
// and pointer-policy delegation rather than only an upper PAC field.
|
||||
let packed = ((SECOND_MODIFIER & SECOND_RELEVANT_MASK) << 27)
|
||||
| ((FIRST_MODIFIER & FIRST_RELEVANT_MASK) >> 4);
|
||||
assert_eq!(signed, context.sign(key, pointer, packed).unwrap());
|
||||
for combined in [false, true] {
|
||||
assert_eq!(
|
||||
context.authenticate_two_modifiers(
|
||||
key,
|
||||
signed,
|
||||
FIRST_MODIFIER,
|
||||
SECOND_MODIFIER,
|
||||
combined
|
||||
),
|
||||
Ok(Ok(AuthResult {
|
||||
pointer,
|
||||
authenticated: true
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corrupt_authentication_retains_exact_standalone_and_combined_faults() {
|
||||
let context = context(Version::FaultingCombined);
|
||||
for key in [Key::Ia, Key::Ib] {
|
||||
let signed = context
|
||||
.sign_two_modifiers(key, TARGET, FIRST_MODIFIER, SECOND_MODIFIER)
|
||||
.unwrap();
|
||||
for combined in [false, true] {
|
||||
let corrupt = signed ^ CORRUPT_PAC_BIT;
|
||||
let expected = context.authenticate_operation(
|
||||
key,
|
||||
corrupt,
|
||||
pack_modifiers(FIRST_MODIFIER, SECOND_MODIFIER),
|
||||
combined,
|
||||
);
|
||||
assert_eq!(
|
||||
expected,
|
||||
Err(AuthenticationError::Failure {
|
||||
code: u8::from(key == Key::Ib)
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
context.authenticate_two_modifiers(
|
||||
key,
|
||||
corrupt,
|
||||
FIRST_MODIFIER,
|
||||
SECOND_MODIFIER,
|
||||
combined
|
||||
),
|
||||
Ok(expected)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exact_modifier_bit_dependence_and_ignored_bits_reuse_one_pack_owner() {
|
||||
for bit in 0..u64::BITS {
|
||||
let first = if (4..=35).contains(&bit) {
|
||||
1 << (bit - 4)
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let second = if (5..=36).contains(&bit) {
|
||||
1 << (bit - 5 + u32::BITS)
|
||||
} else {
|
||||
0
|
||||
};
|
||||
assert_eq!(pack_modifiers(1 << bit, 0), first);
|
||||
assert_eq!(pack_modifiers(0, 1 << bit), second);
|
||||
}
|
||||
let context = context(Version::FaultingCombined);
|
||||
for key in [Key::Ia, Key::Ib] {
|
||||
let signed = context
|
||||
.sign_two_modifiers(key, TARGET, FIRST_MODIFIER, SECOND_MODIFIER)
|
||||
.unwrap();
|
||||
for (first, second) in [
|
||||
(FIRST_MODIFIER ^ !FIRST_RELEVANT_MASK, SECOND_MODIFIER),
|
||||
(FIRST_MODIFIER, SECOND_MODIFIER ^ !SECOND_RELEVANT_MASK),
|
||||
] {
|
||||
assert_eq!(
|
||||
context.sign_two_modifiers(key, TARGET, first, second),
|
||||
Ok(signed)
|
||||
);
|
||||
assert_eq!(
|
||||
context.authenticate_two_modifiers(key, signed, first, second, true),
|
||||
Ok(Ok(AuthResult {
|
||||
pointer: TARGET,
|
||||
authenticated: true
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn configuration_errors_do_not_become_authentication_failures_or_zero_keys() {
|
||||
let context = context(Version::FaultingCombined);
|
||||
for key in [Key::Da, Key::Db] {
|
||||
assert_eq!(
|
||||
context.sign_two_modifiers(key, TARGET, FIRST_MODIFIER, SECOND_MODIFIER),
|
||||
Err(TwoModifierError::DataKey { key })
|
||||
);
|
||||
assert_eq!(
|
||||
context.authenticate_two_modifiers(key, TARGET, FIRST_MODIFIER, SECOND_MODIFIER, true),
|
||||
Err(TwoModifierError::DataKey { key })
|
||||
);
|
||||
}
|
||||
for version in [Version::Classic, Version::Enhanced, Version::Faulting] {
|
||||
let context = self::context(version);
|
||||
assert_eq!(
|
||||
context.sign_two_modifiers(Key::Ia, TARGET, FIRST_MODIFIER, SECOND_MODIFIER),
|
||||
Err(TwoModifierError::UnsupportedVersion { version })
|
||||
);
|
||||
assert_eq!(
|
||||
context.authenticate_two_modifiers(
|
||||
Key::Ia,
|
||||
TARGET,
|
||||
FIRST_MODIFIER,
|
||||
SECOND_MODIFIER,
|
||||
true
|
||||
),
|
||||
Err(TwoModifierError::UnsupportedVersion { version })
|
||||
);
|
||||
}
|
||||
let missing = Context::new_with_version(
|
||||
ADDRESS_SPACE,
|
||||
Keys::from_ib_words(IB_KEY[0], IB_KEY[1]),
|
||||
Version::FaultingCombined,
|
||||
);
|
||||
assert_eq!(
|
||||
missing.sign_two_modifiers(Key::Ia, TARGET, FIRST_MODIFIER, SECOND_MODIFIER),
|
||||
Err(TwoModifierError::KeyUnavailable { key: Key::Ia })
|
||||
);
|
||||
assert_eq!(
|
||||
missing.authenticate_two_modifiers(Key::Ia, TARGET, FIRST_MODIFIER, SECOND_MODIFIER, true),
|
||||
Err(TwoModifierError::KeyUnavailable { key: Key::Ia })
|
||||
);
|
||||
assert!(
|
||||
missing
|
||||
.sign_two_modifiers(Key::Ib, TARGET, FIRST_MODIFIER, SECOND_MODIFIER)
|
||||
.is_ok()
|
||||
);
|
||||
}
|
||||
@@ -170,10 +170,9 @@ impl Snapshot {
|
||||
self.check_fixed_exception_levels()
|
||||
}
|
||||
|
||||
/// Derive the existing bounded entry token from these exact raw IDs. This
|
||||
/// accepts only no-SVE/no-SME and the reviewed absent optional-entry effects.
|
||||
/// It is not a whole CPU-validity check or an instruction-feature allowlist.
|
||||
pub fn entry_profile(&self) -> Result<EntryProfile, Unsupported> {
|
||||
/// Actual fixed-EL optional-effect facts except PAuth_LR. This creates no
|
||||
/// entry grant and makes no claim that PAuth_LR is absent or implemented.
|
||||
pub(crate) fn non_pauth_entry_absence(&self) -> Result<ScalableEntryAbsence, Unsupported> {
|
||||
self.check_fixed_exception_levels()?;
|
||||
for &field in REQUIRED_ABSENCES {
|
||||
self.require_zero(field)?;
|
||||
@@ -191,6 +190,16 @@ impl Snapshot {
|
||||
value: ras,
|
||||
});
|
||||
}
|
||||
ScalableEntryAbsence::from_id_registers(
|
||||
self.read(Register::IdAa64Pfr0El1)?,
|
||||
self.read(Register::IdAa64Pfr1El1)?,
|
||||
)
|
||||
.map_err(Unsupported::EntryProfile)
|
||||
}
|
||||
|
||||
/// Derive the existing bounded exception entry token, including LR absence.
|
||||
pub fn entry_profile(&self) -> Result<EntryProfile, Unsupported> {
|
||||
let scalable = self.non_pauth_entry_absence()?;
|
||||
let isar1 = self.read(Register::IdAa64Isar1El1)?;
|
||||
let isar2 = self.read(Register::IdAa64Isar2El1)?;
|
||||
let apa = ((isar1 >> APA_SHIFT) & FIELD_MASK) as u8;
|
||||
@@ -207,11 +216,6 @@ impl Snapshot {
|
||||
) {
|
||||
return Err(Unsupported::PauthLrTuple { apa, api, apa3 });
|
||||
}
|
||||
let scalable = ScalableEntryAbsence::from_id_registers(
|
||||
self.read(Register::IdAa64Pfr0El1)?,
|
||||
self.read(Register::IdAa64Pfr1El1)?,
|
||||
)
|
||||
.map_err(Unsupported::EntryProfile)?;
|
||||
// Primary MTE=0 is the absence fact. MTE_frac/MTEX are invalid under that
|
||||
// primary value and are not interpreted as independent absence claims.
|
||||
EntryProfile::base(SystemEntryFeatures::declared_absent(), scalable)
|
||||
|
||||
@@ -34,10 +34,15 @@ pub use source::SourceNormalWbDomain;
|
||||
mod low128;
|
||||
pub(crate) use low128::Low128ProcessMemoryAuthorization;
|
||||
pub use low128::PreparedLow128ProcessMemory;
|
||||
pub mod extended_controls;
|
||||
#[path = "process_memory/scalable.rs"]
|
||||
mod scalable;
|
||||
pub use scalable::ScalableExecutionError;
|
||||
|
||||
pub(crate) const SCTLR_ENIA: u64 = 1 << 31;
|
||||
pub(crate) const SCTLR_ENIB: u64 = 1 << 30;
|
||||
pub(crate) const SCTLR_ENDA: u64 = 1 << 27;
|
||||
pub(crate) const SCTLR_ENDB: u64 = 1 << 13;
|
||||
const SCTLR_MMU_ENABLE: u64 = 1;
|
||||
const SCTLR_DATA_CACHE_ENABLE: u64 = 1 << 2;
|
||||
const SCTLR_NATIVE_NORMAL_WB: u64 = SCTLR_MMU_ENABLE | SCTLR_DATA_CACHE_ENABLE;
|
||||
@@ -191,6 +196,7 @@ pub struct FixedProcessMemoryControls {
|
||||
tcr_el1: u64,
|
||||
lower_address: LowerAddressProfile,
|
||||
source: SourceNormalWbDomain,
|
||||
extended: Option<extended_controls::ExtendedControlBank>,
|
||||
}
|
||||
|
||||
impl FixedProcessMemoryControls {
|
||||
@@ -233,6 +239,7 @@ impl FixedProcessMemoryControls {
|
||||
tcr_el1,
|
||||
lower_address,
|
||||
source,
|
||||
extended: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -258,6 +265,10 @@ impl FixedProcessMemoryControls {
|
||||
|
||||
/// The same immutable source used at construction, if this scope has one.
|
||||
/// Legacy raw-ID construction intentionally supplies no scalable authority.
|
||||
pub(crate) fn identification_snapshot_owner(&self) -> Option<&Arc<Snapshot>> {
|
||||
self.identification.as_ref()
|
||||
}
|
||||
|
||||
pub fn identification_snapshot(&self) -> Option<&Snapshot> {
|
||||
self.identification.as_deref()
|
||||
}
|
||||
@@ -394,7 +405,20 @@ impl FixedProcessMemoryControls {
|
||||
pstate & PSTATE_MODE_MASK,
|
||||
));
|
||||
}
|
||||
let unsupported = pstate & !SOURCE_PSTATE_MASK;
|
||||
let mut source_mask = SOURCE_PSTATE_MASK;
|
||||
if system.pacm_state_feature() == crate::system::state::PacmStateFeature::Full {
|
||||
let identification =
|
||||
self.identification_snapshot()
|
||||
.ok_or(ProcessMemoryError::UnsupportedPstate(
|
||||
crate::system::state::PSTATE_PACM_MASK,
|
||||
))?;
|
||||
crate::pauth::features::LinkRegisterPauthCapability::from_profile(identification)
|
||||
.map_err(|_| {
|
||||
ProcessMemoryError::UnsupportedPstate(crate::system::state::PSTATE_PACM_MASK)
|
||||
})?;
|
||||
source_mask |= crate::system::state::PSTATE_PACM_MASK;
|
||||
}
|
||||
let unsupported = pstate & !source_mask;
|
||||
if unsupported != 0 {
|
||||
return Err(ProcessMemoryError::UnsupportedPstate(unsupported));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
//! Optional SCTLR2/TCR2 storage in the existing sole fixed-control bank.
|
||||
//!
|
||||
//! Read loans retain that original bank and a real mapping-exclusion pin. They
|
||||
//! prove source-domain currency only, not PE or thread identity: another thread
|
||||
//! can share the same domain. The consumer must retain its exact original
|
||||
//! ThreadState/SystemState/Context/PE and outer execution object through staging,
|
||||
//! effects and PC settlement. No read loan grants native entry or completion.
|
||||
|
||||
use super::{
|
||||
FixedProcessMemoryControls, MemoryControls, MemoryExecutionLoan, MemoryStatus, MemoryThread,
|
||||
ProcessMemoryError, Register, Snapshot, SourceNormalWbDomain,
|
||||
};
|
||||
use crate::{
|
||||
pauth::features::{LinkRegisterPauthCapability, UnsupportedInstructionProfile},
|
||||
system::identification_snapshot::{Origin, Unsupported},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
const FIELD_MASK: u64 = 0xf;
|
||||
const MMFR3_SCTLRX_SHIFT: u32 = 4;
|
||||
const MMFR3_TCRX_SHIFT: u32 = 0;
|
||||
const MMFR4_SRMASK_SHIFT: u32 = 44;
|
||||
const PFR1_MTE_SHIFT: u32 = 8;
|
||||
const EXTENSION_PRESENT: u8 = 1;
|
||||
const FEATURE_ABSENT: u8 = 0;
|
||||
pub(crate) const SCTLR2_ENPACM: u64 = 1 << 7;
|
||||
pub(crate) const SCTLR2_ENPACM0: u64 = 1 << 8;
|
||||
pub(crate) const SCTLR2_CPTA: u64 = 1 << 9;
|
||||
pub(crate) const SCTLR2_CPTA0: u64 = 1 << 10;
|
||||
pub(crate) const SCTLR2_CPTM: u64 = 1 << 11;
|
||||
pub(crate) const SCTLR2_CPTM0: u64 = 1 << 12;
|
||||
const SCTLR2_CPA_FIELDS: u64 = SCTLR2_CPTA | SCTLR2_CPTA0 | SCTLR2_CPTM | SCTLR2_CPTM0;
|
||||
const SCTLR2_PACM_FIELDS: u64 = SCTLR2_ENPACM | SCTLR2_ENPACM0;
|
||||
const SCTLR2_REVIEWED: u64 = SCTLR2_PACM_FIELDS | SCTLR2_CPA_FIELDS;
|
||||
const ISAR3_CPA_SHIFT: u32 = 0;
|
||||
const CPA_WITH_CHECKING: u8 = 2;
|
||||
|
||||
/// Stored once inside FixedProcessMemoryControls; no SCTLR/TCR copies.
|
||||
/// Full raw registers are retained. Future EnFPM or mutation belongs to this
|
||||
/// same owner; the current constructor rejects unimplemented extended bits.
|
||||
#[derive(Debug)]
|
||||
pub(super) struct ExtendedControlBank {
|
||||
sctlr2_el1: u64,
|
||||
tcr2_el1: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Error {
|
||||
Process(ProcessMemoryError),
|
||||
Identification(Unsupported),
|
||||
PauthProfile(UnsupportedInstructionProfile),
|
||||
CapturedSourceRequiresActualTransfer,
|
||||
MissingIdentification,
|
||||
DifferentSnapshot,
|
||||
ExtendedControlsUnavailable,
|
||||
MissingAddressSpace,
|
||||
SourceDomain(MemoryStatus),
|
||||
UnsupportedControl { register: &'static str, value: u64 },
|
||||
}
|
||||
|
||||
fn field(snapshot: &Snapshot, register: Register, shift: u32) -> Result<u8, Error> {
|
||||
Ok(((snapshot.read(register).map_err(Error::Identification)? >> shift) & FIELD_MASK) as u8)
|
||||
}
|
||||
|
||||
fn require(
|
||||
snapshot: &Snapshot,
|
||||
register: Register,
|
||||
name: &'static str,
|
||||
shift: u32,
|
||||
expected: u8,
|
||||
) -> Result<(), Error> {
|
||||
let value = field(snapshot, register, shift)?;
|
||||
if value != expected {
|
||||
return Err(Error::Identification(Unsupported::Field {
|
||||
register,
|
||||
field: name,
|
||||
value,
|
||||
}));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl FixedProcessMemoryControls {
|
||||
/// Consume explicit source facts for a genuinely fresh declared software
|
||||
/// bank. This is not an upgrade/adoption method for an existing live bank.
|
||||
/// SourceNormalWbDomain's genuine full-domain source-resolution contract and
|
||||
/// existing constructor contracts remain required. No reset value is guessed.
|
||||
pub fn new_source_resolved_with_extended_controls(
|
||||
identification: Arc<Snapshot>,
|
||||
sctlr_el1: u64,
|
||||
tcr_el1: u64,
|
||||
lower_address_bits: u8,
|
||||
source: SourceNormalWbDomain,
|
||||
sctlr2_el1: u64,
|
||||
tcr2_el1: u64,
|
||||
) -> Result<Self, Error> {
|
||||
if identification.provenance().origin() != Origin::DeclaredGuest {
|
||||
return Err(Error::CapturedSourceRequiresActualTransfer);
|
||||
}
|
||||
require(
|
||||
&identification,
|
||||
Register::IdAa64Mmfr3El1,
|
||||
"SCTLRX",
|
||||
MMFR3_SCTLRX_SHIFT,
|
||||
EXTENSION_PRESENT,
|
||||
)?;
|
||||
require(
|
||||
&identification,
|
||||
Register::IdAa64Mmfr3El1,
|
||||
"TCRX",
|
||||
MMFR3_TCRX_SHIFT,
|
||||
EXTENSION_PRESENT,
|
||||
)?;
|
||||
require(
|
||||
&identification,
|
||||
Register::IdAa64Mmfr4El1,
|
||||
"SRMASK",
|
||||
MMFR4_SRMASK_SHIFT,
|
||||
FEATURE_ABSENT,
|
||||
)?;
|
||||
if sctlr2_el1 & !SCTLR2_REVIEWED != 0 {
|
||||
return Err(Error::UnsupportedControl {
|
||||
register: "SCTLR2_EL1",
|
||||
value: sctlr2_el1,
|
||||
});
|
||||
}
|
||||
// Nonzero feature-dependent fields cannot be stored as known controls
|
||||
// under an absent/reserved/unsupported LR profile. This uses the sole
|
||||
// reviewed same-Snapshot tuple check; no crypto or entry is authorized.
|
||||
if sctlr2_el1 & SCTLR2_PACM_FIELDS != 0 {
|
||||
LinkRegisterPauthCapability::from_profile(&identification)
|
||||
.map_err(Error::PauthProfile)?;
|
||||
}
|
||||
if sctlr2_el1 & SCTLR2_CPA_FIELDS != 0 {
|
||||
require(
|
||||
&identification,
|
||||
Register::IdAa64Isar3El1,
|
||||
"CPA",
|
||||
ISAR3_CPA_SHIFT,
|
||||
CPA_WITH_CHECKING,
|
||||
)?;
|
||||
}
|
||||
if tcr2_el1 != 0 {
|
||||
return Err(Error::UnsupportedControl {
|
||||
register: "TCR2_EL1",
|
||||
value: tcr2_el1,
|
||||
});
|
||||
}
|
||||
if !source.is_current().map_err(Error::SourceDomain)? {
|
||||
return Err(Error::SourceDomain(MemoryStatus::Domain));
|
||||
}
|
||||
require(
|
||||
&identification,
|
||||
Register::IdAa64Pfr1El1,
|
||||
"MTE",
|
||||
PFR1_MTE_SHIFT,
|
||||
FEATURE_ABSENT,
|
||||
)?;
|
||||
let mut bank = Self::new_with_identification(
|
||||
identification,
|
||||
sctlr_el1,
|
||||
tcr_el1,
|
||||
lower_address_bits,
|
||||
source,
|
||||
)
|
||||
.map_err(Error::Process)?;
|
||||
// This fresh owned value has never escaped. Existing constructors remain
|
||||
// explicitly unavailable; there is no setter on an existing bank.
|
||||
bank.extended = Some(ExtendedControlBank {
|
||||
sctlr2_el1,
|
||||
tcr2_el1,
|
||||
});
|
||||
Ok(bank)
|
||||
}
|
||||
|
||||
/// Validate the actual thread with a short borrow, then retain only original
|
||||
/// bank/Snapshot/outer references. The canonical consumer separately retains
|
||||
/// the exact mutable thread/PE through its existing memory/native stages.
|
||||
/// No caller raw epoch,
|
||||
/// integer ASID, equivalent-looking Snapshot or separate domain is accepted.
|
||||
/// This bounded loan validates current source and actual outer-domain identity; it does
|
||||
/// not expand MTE memory support or prove PE/ThreadState identity.
|
||||
pub(crate) fn extended_controls<'run>(
|
||||
&'run self,
|
||||
expected_snapshot: &Snapshot,
|
||||
thread: &MemoryThread<MemoryControls>,
|
||||
execution: &'run MemoryExecutionLoan,
|
||||
) -> Result<ExtendedControlLoan<'run>, Error> {
|
||||
let snapshot = self
|
||||
.identification_snapshot()
|
||||
.ok_or(Error::MissingIdentification)?;
|
||||
if !snapshot.same_snapshot(expected_snapshot) {
|
||||
return Err(Error::DifferentSnapshot);
|
||||
}
|
||||
let extended = self
|
||||
.extended
|
||||
.as_ref()
|
||||
.ok_or(Error::ExtendedControlsUnavailable)?;
|
||||
self.source
|
||||
.check_current_execution(thread, execution)
|
||||
.map_err(Error::SourceDomain)?;
|
||||
let address_space = thread.address_space().ok_or(Error::MissingAddressSpace)?;
|
||||
Ok(ExtendedControlLoan {
|
||||
bank: self,
|
||||
extended,
|
||||
snapshot,
|
||||
_execution: execution,
|
||||
address_space,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Non-Clone loan: renewal/mutation of the bank and release of the actual outer
|
||||
/// pin are excluded while borrowed. No copied controls/IDs or second bank.
|
||||
pub(crate) struct ExtendedControlLoan<'run> {
|
||||
bank: &'run FixedProcessMemoryControls,
|
||||
extended: &'run ExtendedControlBank,
|
||||
snapshot: &'run Snapshot,
|
||||
_execution: &'run MemoryExecutionLoan,
|
||||
address_space: u64,
|
||||
}
|
||||
|
||||
impl<'run> ExtendedControlLoan<'run> {
|
||||
pub(crate) fn snapshot(&self) -> &'run Snapshot {
|
||||
self.snapshot
|
||||
}
|
||||
pub(crate) fn address_space(&self) -> u64 {
|
||||
self.address_space
|
||||
}
|
||||
pub(crate) fn sctlr_el1(&self) -> u64 {
|
||||
self.bank.sctlr_el1()
|
||||
}
|
||||
pub(crate) fn tcr_el1(&self) -> u64 {
|
||||
self.bank.tcr_el1()
|
||||
}
|
||||
pub(crate) fn sctlr2_el1(&self) -> u64 {
|
||||
self.extended.sctlr2_el1
|
||||
}
|
||||
pub(crate) fn tcr2_el1(&self) -> u64 {
|
||||
self.extended.tcr2_el1
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -0,0 +1,384 @@
|
||||
//! Fresh declared component fixtures; no PE identity, instruction or native credit.
|
||||
use super::*;
|
||||
use crate::{
|
||||
blocks::ThreadState,
|
||||
memory::{
|
||||
domain::{MemoryDomain, MemorySystem},
|
||||
policy::{LowerAddressProfile, TagCheckFaultMode},
|
||||
},
|
||||
pauth::{
|
||||
Context, Keys, Version,
|
||||
lr_context::InstructionKey,
|
||||
lr_instruction::{Instruction, Key},
|
||||
lr_service::{BorrowedLinkRegisterService, KeySelection, PacmControlValue},
|
||||
},
|
||||
system::state::{El1Registers, PSTATE_EL0T, PSTATE_EL1H, PacmStateFeature, SystemState},
|
||||
};
|
||||
use stela_compiler::{GuestAddress, GuestState, TargetCpu};
|
||||
|
||||
const ADDRESS_SPACE: u64 = 7;
|
||||
const ADDRESS_BITS: u8 = 47;
|
||||
const TCR: u64 = 17 | (17 << 16) | (2 << 30);
|
||||
const SCTLR: u64 = 1 | (1 << 2) | (1 << 31);
|
||||
|
||||
fn entries(mte: u64) -> Vec<(Register, u64)> {
|
||||
vec![
|
||||
(Register::IdAa64Pfr0El1, 0x11),
|
||||
(Register::IdAa64Pfr1El1, mte << PFR1_MTE_SHIFT),
|
||||
(Register::IdAa64Mmfr0El1, 0),
|
||||
(Register::IdAa64Mmfr2El1, 1 << 32),
|
||||
(Register::IdAa64Mmfr3El1, 0x11),
|
||||
(Register::IdAa64Mmfr4El1, 0),
|
||||
(Register::IdAa64Isar1El1, 6 << 4),
|
||||
(Register::IdAa64Isar2El1, 0),
|
||||
(Register::IdAa64Isar3El1, 2 << 12),
|
||||
(Register::IdAa64Dfr0El1, 0),
|
||||
]
|
||||
}
|
||||
fn snapshot(mte: u64) -> Arc<Snapshot> {
|
||||
Arc::new(Snapshot::declared("LR-sole-bank-declared-component", &entries(mte)).unwrap())
|
||||
}
|
||||
fn new_domain() -> Arc<MemoryDomain> {
|
||||
MemoryDomain::new_for_address_space(
|
||||
ADDRESS_SPACE,
|
||||
MemorySystem::new(16, 4).unwrap(),
|
||||
Vec::new(),
|
||||
TargetCpu::Baseline,
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
fn source(domain: &Arc<MemoryDomain>) -> SourceNormalWbDomain {
|
||||
// SAFETY: this fresh empty domain declares no mappings or native invocation.
|
||||
// No copied hardware PE or inferred effective ARM memory attributes are used.
|
||||
unsafe { SourceNormalWbDomain::from_source_resolved(Arc::clone(domain)) }.unwrap()
|
||||
}
|
||||
fn memory(domain: &Arc<MemoryDomain>) -> MemoryThread<MemoryControls> {
|
||||
domain.thread(MemoryControls::new(
|
||||
LowerAddressProfile::new(ADDRESS_BITS, false).unwrap(),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
TagCheckFaultMode::Ignore,
|
||||
false,
|
||||
))
|
||||
}
|
||||
fn bank(ids: Arc<Snapshot>, domain: &Arc<MemoryDomain>, sctlr2: u64) -> FixedProcessMemoryControls {
|
||||
FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
ids,
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(domain),
|
||||
sctlr2,
|
||||
0,
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn old_named_scopes_have_unavailable_extended_storage() {
|
||||
let mte = FEATURE_ABSENT as u64;
|
||||
let ids = snapshot(mte);
|
||||
let domain = new_domain();
|
||||
let bank = FixedProcessMemoryControls::new_with_identification(
|
||||
Arc::clone(&ids),
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
)
|
||||
.unwrap();
|
||||
let thread = memory(&domain);
|
||||
let outer = thread.execution_loan().unwrap();
|
||||
assert!(bank.extended.is_none());
|
||||
assert!(matches!(
|
||||
bank.extended_controls(&ids, &thread, &outer),
|
||||
Err(Error::ExtendedControlsUnavailable)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fresh_scopes_preserve_original_ids_and_all_four_control_values() {
|
||||
let mte = FEATURE_ABSENT as u64;
|
||||
let ids = snapshot(mte);
|
||||
let domain = new_domain();
|
||||
for sctlr2 in [
|
||||
0,
|
||||
SCTLR2_ENPACM,
|
||||
SCTLR2_ENPACM0,
|
||||
SCTLR2_ENPACM | SCTLR2_ENPACM0,
|
||||
] {
|
||||
let bank = bank(Arc::clone(&ids), &domain, sctlr2);
|
||||
let thread = memory(&domain);
|
||||
let outer = thread.execution_loan().unwrap();
|
||||
let loan = bank.extended_controls(&ids, &thread, &outer).unwrap();
|
||||
assert!(loan.snapshot().same_snapshot(&ids));
|
||||
assert_eq!(loan.address_space(), ADDRESS_SPACE);
|
||||
assert_eq!(
|
||||
(
|
||||
loan.sctlr_el1(),
|
||||
loan.tcr_el1(),
|
||||
loan.sctlr2_el1(),
|
||||
loan.tcr2_el1()
|
||||
),
|
||||
(SCTLR, TCR, sctlr2, 0)
|
||||
);
|
||||
assert_eq!(
|
||||
(loan.snapshot().read(Register::IdAa64Pfr1El1).unwrap() >> PFR1_MTE_SHIFT) & FIELD_MASK,
|
||||
mte
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn different_snapshot_thread_domain_and_outer_pin_decline() {
|
||||
let ids = snapshot(0);
|
||||
let equal_values = snapshot(0);
|
||||
let domain = new_domain();
|
||||
let other = new_domain();
|
||||
let bank = bank(Arc::clone(&ids), &domain, 0);
|
||||
let thread = memory(&domain);
|
||||
let different_thread = memory(&other);
|
||||
let outer = thread.execution_loan().unwrap();
|
||||
let different_outer = different_thread.execution_loan().unwrap();
|
||||
assert!(matches!(
|
||||
bank.extended_controls(&equal_values, &thread, &outer),
|
||||
Err(Error::DifferentSnapshot)
|
||||
));
|
||||
assert!(matches!(
|
||||
bank.extended_controls(&ids, &different_thread, &outer),
|
||||
Err(Error::SourceDomain(_))
|
||||
));
|
||||
assert!(matches!(
|
||||
bank.extended_controls(&ids, &thread, &different_outer),
|
||||
Err(Error::SourceDomain(_))
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn domain_read_loan_intentionally_does_not_identify_a_pe_or_thread() {
|
||||
let ids = snapshot(0);
|
||||
let domain = new_domain();
|
||||
let bank = bank(Arc::clone(&ids), &domain, 0);
|
||||
let first = memory(&domain);
|
||||
let second = memory(&domain);
|
||||
let outer = first.execution_loan().unwrap();
|
||||
// Both are admitted as DOMAIN reads. The consumer must independently retain
|
||||
// its exact original frame/System/PE/outer object; this is not a PE permit.
|
||||
assert!(bank.extended_controls(&ids, &first, &outer).is_ok());
|
||||
assert!(bank.extended_controls(&ids, &second, &outer).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_features_and_unimplemented_extended_bits_never_default() {
|
||||
let domain = new_domain();
|
||||
for (register, bad) in [
|
||||
(Register::IdAa64Mmfr3El1, 0),
|
||||
(Register::IdAa64Mmfr4El1, 1 << MMFR4_SRMASK_SHIFT),
|
||||
(Register::IdAa64Pfr1El1, 2 << PFR1_MTE_SHIFT),
|
||||
] {
|
||||
let mut values = entries(0);
|
||||
values.iter_mut().find(|(r, _)| *r == register).unwrap().1 = bad;
|
||||
let ids = Arc::new(Snapshot::declared("LR-bank-invalid-declaration", &values).unwrap());
|
||||
assert!(
|
||||
FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
ids,
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
0,
|
||||
0,
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
let values: Vec<_> = entries(0)
|
||||
.into_iter()
|
||||
.filter(|(r, _)| *r != Register::IdAa64Mmfr4El1)
|
||||
.collect();
|
||||
let partial = Arc::new(Snapshot::declared("LR-bank-missing-field", &values).unwrap());
|
||||
assert!(matches!(
|
||||
FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
partial,
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
0,
|
||||
0,
|
||||
),
|
||||
Err(Error::Identification(_))
|
||||
));
|
||||
for (sctlr2, tcr2) in [(1, 0), (1 << 63, 0), (0, 1)] {
|
||||
assert!(matches!(
|
||||
FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
snapshot(0),
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
sctlr2,
|
||||
tcr2,
|
||||
),
|
||||
Err(Error::UnsupportedControl { .. })
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lr_service_consumes_original_bank_loan_and_retains_actual_frame() {
|
||||
let ids = snapshot(0);
|
||||
let domain = new_domain();
|
||||
let bank = bank(Arc::clone(&ids), &domain, SCTLR2_ENPACM0);
|
||||
let memory = memory(&domain);
|
||||
let outer = memory.execution_loan().unwrap();
|
||||
let context = Context::new_with_version(
|
||||
ADDRESS_SPACE,
|
||||
Keys::from_words([1, 2], [3, 4], [5, 6], [7, 8]),
|
||||
Version::FaultingCombined,
|
||||
);
|
||||
let thread = ThreadState {
|
||||
pc: GuestAddress(0x1000),
|
||||
registers: GuestState::default(),
|
||||
};
|
||||
let frame_before = thread.clone();
|
||||
for (mode, expected) in [
|
||||
(PSTATE_EL0T, PacmControlValue::One),
|
||||
(PSTATE_EL1H, PacmControlValue::Zero),
|
||||
] {
|
||||
let system = SystemState::new_with_pacm(
|
||||
mode,
|
||||
0,
|
||||
El1Registers::new(0, 0, 0, 0, 0),
|
||||
PacmStateFeature::Full,
|
||||
)
|
||||
.unwrap();
|
||||
let before = system.clone();
|
||||
let loan = bank.extended_controls(&ids, &memory, &outer).unwrap();
|
||||
let service =
|
||||
BorrowedLinkRegisterService::new(loan, &context, &thread.registers, thread.pc, &system)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
service.key_selection(InstructionKey::A),
|
||||
KeySelection::UseKey
|
||||
);
|
||||
assert_eq!(
|
||||
service.key_selection(InstructionKey::B),
|
||||
KeySelection::Bypass
|
||||
);
|
||||
assert_eq!(service.pacm_control_value().unwrap(), expected);
|
||||
assert_eq!(service.tcr_controls(), (TCR, 0));
|
||||
assert_eq!(service.pstate(), mode);
|
||||
let staged = service.stage(Instruction::Sign171615(Key::Ia)).unwrap();
|
||||
let crate::pauth::lr_instruction::Staged::Pointer(operands) = staged else {
|
||||
panic!("pointer staging")
|
||||
};
|
||||
service
|
||||
.crypto()
|
||||
.unwrap()
|
||||
.sign(
|
||||
InstructionKey::A,
|
||||
operands.pointer,
|
||||
operands.modifier1,
|
||||
operands.modifier2,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(system, before);
|
||||
assert_eq!(thread.pc, frame_before.pc);
|
||||
assert_eq!(thread.registers, frame_before.registers);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cpt_fields_require_cpa2_without_widening_the_memory_contract() {
|
||||
let domain = new_domain();
|
||||
for cpa in [0, 1, 2, FIELD_MASK] {
|
||||
let mut values = entries(0);
|
||||
values
|
||||
.iter_mut()
|
||||
.find(|(register, _)| *register == Register::IdAa64Isar3El1)
|
||||
.unwrap()
|
||||
.1 |= cpa;
|
||||
let ids =
|
||||
Arc::new(Snapshot::declared("shared-bank-cpt-feature-declaration", &values).unwrap());
|
||||
let result = FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
ids,
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
SCTLR2_CPTA,
|
||||
0,
|
||||
);
|
||||
if cpa == u64::from(CPA_WITH_CHECKING) {
|
||||
// The current data contract still refuses CPA2. A later separately
|
||||
// reviewed arithmetic-only owner must make memory unavailable.
|
||||
assert!(matches!(result, Err(Error::Process(_))));
|
||||
} else {
|
||||
assert!(matches!(result, Err(Error::Identification(_))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nonzero_pacm_fields_require_same_snapshot_reviewed_lr_profile() {
|
||||
let domain = new_domain();
|
||||
for apa in [0, 1, 5, 7] {
|
||||
let mut values = entries(0);
|
||||
values
|
||||
.iter_mut()
|
||||
.find(|(register, _)| *register == Register::IdAa64Isar1El1)
|
||||
.unwrap()
|
||||
.1 = apa << 4;
|
||||
let ids = Arc::new(Snapshot::declared("bank-PACM-applicability", &values).unwrap());
|
||||
for bits in [SCTLR2_ENPACM, SCTLR2_ENPACM0, SCTLR2_PACM_FIELDS] {
|
||||
assert!(matches!(
|
||||
FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
Arc::clone(&ids),
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
bits,
|
||||
0,
|
||||
),
|
||||
Err(Error::PauthProfile(_))
|
||||
));
|
||||
}
|
||||
// Explicit zero fields require no LR algorithm/PACM capability.
|
||||
assert!(
|
||||
FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
ids,
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
0,
|
||||
0,
|
||||
)
|
||||
.is_ok()
|
||||
);
|
||||
}
|
||||
for pacm in [0, 1, 3] {
|
||||
let mut values = entries(0);
|
||||
values
|
||||
.iter_mut()
|
||||
.find(|(register, _)| *register == Register::IdAa64Isar3El1)
|
||||
.unwrap()
|
||||
.1 = pacm << 12;
|
||||
let ids = Arc::new(Snapshot::declared("bank-PACM-implementation", &values).unwrap());
|
||||
assert!(matches!(
|
||||
FixedProcessMemoryControls::new_source_resolved_with_extended_controls(
|
||||
ids,
|
||||
SCTLR,
|
||||
TCR,
|
||||
ADDRESS_BITS,
|
||||
source(&domain),
|
||||
SCTLR2_ENPACM0,
|
||||
0,
|
||||
),
|
||||
Err(Error::PauthProfile(_))
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Source-resolved ARM memory attributes for one exact domain generation.
|
||||
//! Native storage eligibility is validated separately by the existing domain.
|
||||
|
||||
use crate::memory::domain::{DataPolicy, MemoryDomain, MemoryThread};
|
||||
use crate::memory::domain::{DataPolicy, MemoryDomain, MemoryExecutionLoan, MemoryThread};
|
||||
use std::sync::Arc;
|
||||
use stela_compiler::context::memory::MemoryStatus;
|
||||
|
||||
@@ -59,6 +59,19 @@ impl SourceNormalWbDomain {
|
||||
Ok(self.domain.generation()? == self.generation)
|
||||
}
|
||||
|
||||
/// Validate this original source generation while its actual counted domain
|
||||
/// pin remains borrowed. No new pin or PE/thread identity is created.
|
||||
pub(super) fn check_current_execution<P: DataPolicy>(
|
||||
&self,
|
||||
thread: &MemoryThread<P>,
|
||||
execution: &MemoryExecutionLoan,
|
||||
) -> Result<(), MemoryStatus> {
|
||||
if !self.matches(thread) || !execution.belongs_to(&self.domain) {
|
||||
return Err(MemoryStatus::Domain);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn matches<P: DataPolicy>(&self, thread: &MemoryThread<P>) -> bool {
|
||||
// The caller holds the actual domain execution loan before this check.
|
||||
// Unavailable/poisoned state fails closed, including same-Arc matches.
|
||||
|
||||
@@ -8,6 +8,10 @@ use super::pstate::{DAIF_MASK, MteFeature, NZCV_MASK, SP_SELECT_MASK, TCO_MASK};
|
||||
use crate::memory::tags::{TagGenerationControls, TagGenerationState, TagRandomization};
|
||||
use stela_compiler::GuestState;
|
||||
|
||||
#[path = "state/pacm.rs"]
|
||||
mod pacm;
|
||||
pub use pacm::{PSTATE_PACM_MASK, PSTATE_PACM_SHIFT, Pacm, PacmStateFeature};
|
||||
|
||||
pub const PSTATE_MODE_MASK: u64 = 0x1f;
|
||||
pub const PSTATE_EL_SHIFT: u32 = 2;
|
||||
pub const PSTATE_EL0T: u64 = 0;
|
||||
@@ -31,6 +35,7 @@ pub enum StateError {
|
||||
El0StackSelection,
|
||||
ActiveSpEl0,
|
||||
UnsupportedMteProfile,
|
||||
UnsupportedPacmProfile,
|
||||
}
|
||||
|
||||
/// Architectural storage only. Register-specific write masks and use-time
|
||||
@@ -148,6 +153,7 @@ pub struct SystemState {
|
||||
inactive_sp: u64,
|
||||
el1_registers: El1Registers,
|
||||
mte: Option<MteState>,
|
||||
pacm_feature: PacmStateFeature,
|
||||
}
|
||||
|
||||
impl SystemState {
|
||||
@@ -157,7 +163,13 @@ impl SystemState {
|
||||
inactive_sp: u64,
|
||||
el1_registers: El1Registers,
|
||||
) -> Result<Self, StateError> {
|
||||
Self::checked(pstate_misc, inactive_sp, el1_registers, None)
|
||||
Self::checked(
|
||||
pstate_misc,
|
||||
inactive_sp,
|
||||
el1_registers,
|
||||
None,
|
||||
PacmStateFeature::Absent,
|
||||
)
|
||||
}
|
||||
|
||||
/// The authoritative CPU adapter supplies its existing MTE feature value.
|
||||
@@ -173,7 +185,26 @@ impl SystemState {
|
||||
if feature != MteFeature::TwoOrLater {
|
||||
return Err(StateError::UnsupportedMteProfile);
|
||||
}
|
||||
Self::checked(pstate_misc, inactive_sp, el1_registers, Some(mte))
|
||||
Self::checked(
|
||||
pstate_misc,
|
||||
inactive_sp,
|
||||
el1_registers,
|
||||
Some(mte),
|
||||
PacmStateFeature::Absent,
|
||||
)
|
||||
}
|
||||
|
||||
/// Explicit PACM storage for this original fresh SystemState. The actual PE
|
||||
/// constructor supplies the initial value and same-Snapshot feature fact;
|
||||
/// this does not infer a thread reset value or grant instruction authority.
|
||||
/// Initial scope keeps MTE and BTI storage absent.
|
||||
pub fn new_with_pacm(
|
||||
pstate_misc: u64,
|
||||
inactive_sp: u64,
|
||||
el1_registers: El1Registers,
|
||||
feature: PacmStateFeature,
|
||||
) -> Result<Self, StateError> {
|
||||
Self::checked(pstate_misc, inactive_sp, el1_registers, None, feature)
|
||||
}
|
||||
|
||||
fn checked(
|
||||
@@ -181,13 +212,15 @@ impl SystemState {
|
||||
inactive_sp: u64,
|
||||
el1_registers: El1Registers,
|
||||
mte: Option<MteState>,
|
||||
pacm_feature: PacmStateFeature,
|
||||
) -> Result<Self, StateError> {
|
||||
validate_misc(pstate_misc, mte.is_some())?;
|
||||
validate_misc(pstate_misc, mte.is_some(), pacm_feature)?;
|
||||
Ok(Self {
|
||||
pstate_misc,
|
||||
inactive_sp,
|
||||
el1_registers,
|
||||
mte,
|
||||
pacm_feature,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -263,7 +296,7 @@ impl SystemState {
|
||||
psr: u64,
|
||||
) -> Result<(), StateError> {
|
||||
let misc = psr & !NZCV_MASK;
|
||||
validate_misc(misc, self.mte.is_some())?;
|
||||
validate_misc(misc, self.mte.is_some(), self.pacm_feature)?;
|
||||
self.replace_misc(registers, misc);
|
||||
registers.nzcv = (psr & NZCV_MASK) as u32;
|
||||
Ok(())
|
||||
@@ -288,6 +321,26 @@ impl SystemState {
|
||||
pub fn mte_mut(&mut self) -> Option<&mut MteState> {
|
||||
self.mte.as_mut()
|
||||
}
|
||||
/// Storage capacity only; actual CPU/source/control permission is separate.
|
||||
pub const fn pacm_state_feature(&self) -> PacmStateFeature {
|
||||
self.pacm_feature
|
||||
}
|
||||
|
||||
pub const fn pacm(&self) -> Pacm {
|
||||
pacm::read(self.pstate_misc)
|
||||
}
|
||||
|
||||
/// Apply a source-authorized PACM/reset/entry value to this same PSTATE owner.
|
||||
/// The canonical Active/exception owner must validate the complete staged
|
||||
/// effect before GPR/PC commits; this setter is not execution authority.
|
||||
pub fn set_pacm(&mut self, value: Pacm) -> Result<(), StateError> {
|
||||
if self.pacm_feature != PacmStateFeature::Full {
|
||||
return Err(StateError::UnsupportedPacmProfile);
|
||||
}
|
||||
self.pstate_misc = (self.pstate_misc & !PSTATE_PACM_MASK) | value.pstate_bits();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn tag_check_override(&self) -> bool {
|
||||
self.pstate_misc & TCO_MASK != 0
|
||||
}
|
||||
@@ -301,11 +354,17 @@ fn stack_bank(misc: u64) -> StackBank {
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_misc(misc: u64, mte: bool) -> Result<(), StateError> {
|
||||
fn validate_misc(misc: u64, mte: bool, pacm: PacmStateFeature) -> Result<(), StateError> {
|
||||
if misc & NZCV_MASK != 0 {
|
||||
return Err(StateError::FlagsInMiscPstate);
|
||||
}
|
||||
let allowed = BASE_MISC_MASK | if mte { TCO_MASK } else { 0 };
|
||||
let allowed = BASE_MISC_MASK
|
||||
| if mte { TCO_MASK } else { 0 }
|
||||
| if pacm == PacmStateFeature::Full {
|
||||
PSTATE_PACM_MASK
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let unsupported = misc & !allowed;
|
||||
if unsupported != 0 {
|
||||
return Err(StateError::UnsupportedPstateBits(unsupported));
|
||||
@@ -541,3 +600,7 @@ mod tests {
|
||||
assert_eq!(state.generation().seed, 11);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "state/pacm_tests.rs"]
|
||||
mod pacm_tests;
|
||||
@@ -0,0 +1,34 @@
|
||||
//! PACM storage in canonical PSTATE; control/lifecycle authorization is external.
|
||||
pub const PSTATE_PACM_SHIFT: u32 = 35;
|
||||
pub const PSTATE_PACM_MASK: u64 = 1 << PSTATE_PACM_SHIFT;
|
||||
|
||||
/// Explicit storage subset. Full is not proof of a PE feature or effective enable.
|
||||
/// Trivial/reserved layouts are not implemented by this initial storage subset.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum PacmStateFeature {
|
||||
Absent,
|
||||
Full,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Pacm {
|
||||
Zero,
|
||||
One,
|
||||
}
|
||||
|
||||
impl Pacm {
|
||||
pub const fn bit(self) -> bool {
|
||||
matches!(self, Self::One)
|
||||
}
|
||||
pub(super) const fn pstate_bits(self) -> u64 {
|
||||
if self.bit() { PSTATE_PACM_MASK } else { 0 }
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) const fn read(pstate: u64) -> Pacm {
|
||||
if pstate & PSTATE_PACM_MASK == 0 {
|
||||
Pacm::Zero
|
||||
} else {
|
||||
Pacm::One
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
use super::*;
|
||||
|
||||
const FLAGS: u32 = 0xa000_0000;
|
||||
const INITIAL_SP: u64 = 0x2000;
|
||||
const INACTIVE_SP: u64 = 0x3000;
|
||||
const BTYPE_MASK: u64 = 3 << 10;
|
||||
|
||||
fn el1() -> El1Registers {
|
||||
El1Registers::new(1, 2, 3, 4, 5)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn absent_storage_refuses_pacm_and_updates_without_mutation() {
|
||||
assert!(SystemState::new(PSTATE_PACM_MASK, INACTIVE_SP, el1()).is_err());
|
||||
let mut state = SystemState::new(PSTATE_EL1H, INACTIVE_SP, el1()).unwrap();
|
||||
let before = state.clone();
|
||||
assert_eq!(
|
||||
state.set_pacm(Pacm::One),
|
||||
Err(StateError::UnsupportedPacmProfile)
|
||||
);
|
||||
assert_eq!(state, before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explicit_initial_pacm_has_no_inferred_reset_or_btype() {
|
||||
for initial in [0, PSTATE_PACM_MASK] {
|
||||
let state = SystemState::new_with_pacm(
|
||||
PSTATE_EL1H | initial,
|
||||
INACTIVE_SP,
|
||||
el1(),
|
||||
PacmStateFeature::Full,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(state.pstate_misc(), PSTATE_EL1H | initial);
|
||||
assert_eq!(state.pacm().bit(), initial != 0);
|
||||
}
|
||||
assert!(
|
||||
SystemState::new_with_pacm(
|
||||
PSTATE_EL1H | BTYPE_MASK,
|
||||
INACTIVE_SP,
|
||||
el1(),
|
||||
PacmStateFeature::Full,
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pacm_updates_preserve_original_pstate_flags_stacks_and_registers() {
|
||||
let mut state = SystemState::new_with_pacm(
|
||||
PSTATE_EL1H | DAIF_MASK,
|
||||
INACTIVE_SP,
|
||||
el1(),
|
||||
PacmStateFeature::Full,
|
||||
)
|
||||
.unwrap();
|
||||
let registers = GuestState {
|
||||
nzcv: FLAGS,
|
||||
sp: INITIAL_SP,
|
||||
..GuestState::default()
|
||||
};
|
||||
let original_registers = registers.clone();
|
||||
for value in [Pacm::One, Pacm::Zero] {
|
||||
state.set_pacm(value).unwrap();
|
||||
assert_eq!(
|
||||
state.pstate(®isters),
|
||||
PSTATE_EL1H | DAIF_MASK | u64::from(FLAGS) | value.pstate_bits()
|
||||
);
|
||||
assert_eq!(state.stack_pointer(StackBank::El0, ®isters), INACTIVE_SP);
|
||||
assert_eq!(registers, original_registers);
|
||||
assert_eq!(state.el1_registers(), &el1());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn state_transition_stores_authorized_value_without_resolving_controls() {
|
||||
let mut state = SystemState::new_with_pacm(
|
||||
PSTATE_EL1H | PSTATE_PACM_MASK,
|
||||
INACTIVE_SP,
|
||||
el1(),
|
||||
PacmStateFeature::Full,
|
||||
)
|
||||
.unwrap();
|
||||
let mut registers = GuestState {
|
||||
nzcv: FLAGS,
|
||||
sp: INITIAL_SP,
|
||||
..GuestState::default()
|
||||
};
|
||||
state
|
||||
.transition_pstate(
|
||||
&mut registers,
|
||||
PSTATE_EL0T | PSTATE_PACM_MASK | u64::from(FLAGS),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(state.pacm(), Pacm::One);
|
||||
assert_eq!(registers.sp, INACTIVE_SP);
|
||||
state
|
||||
.transition_pstate(&mut registers, PSTATE_EL1H | u64::from(FLAGS))
|
||||
.unwrap();
|
||||
assert_eq!(state.pacm(), Pacm::Zero);
|
||||
assert_eq!(registers.sp, INITIAL_SP);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_transition_preserves_full_original_state() {
|
||||
let mut state = SystemState::new_with_pacm(
|
||||
PSTATE_EL1H | PSTATE_PACM_MASK,
|
||||
INACTIVE_SP,
|
||||
el1(),
|
||||
PacmStateFeature::Full,
|
||||
)
|
||||
.unwrap();
|
||||
let mut registers = GuestState {
|
||||
nzcv: FLAGS,
|
||||
sp: INITIAL_SP,
|
||||
..GuestState::default()
|
||||
};
|
||||
let before_state = state.clone();
|
||||
let before_registers = registers.clone();
|
||||
assert!(
|
||||
state
|
||||
.transition_pstate(&mut registers, PSTATE_EL0T | BTYPE_MASK)
|
||||
.is_err()
|
||||
);
|
||||
assert_eq!(state, before_state);
|
||||
assert_eq!(registers, before_registers);
|
||||
}
|
||||
@@ -2107,6 +2107,17 @@ class SystemServiceProfileTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
progress.validate_service_profiles(default, {default['id']: default})
|
||||
|
||||
def test_checked_process_profile_retains_distinct_abi_and_decode_features(self):
|
||||
default, additional = self.contracts()
|
||||
additional[progress.CHECKED_PROCESS_PROFILE] = {
|
||||
'id': progress.CHECKED_PROCESS_PROFILE, 'compiler_mode': 'service',
|
||||
'abi': progress.CHECKED_PROCESS_ABI, 'outside_scope': ['Unqualified runtime effects']}
|
||||
profiles = progress.validate_service_profiles(default, additional)
|
||||
self.assertEqual(profiles[progress.CHECKED_PROCESS_PROFILE]['abi'], progress.CHECKED_PROCESS_ABI)
|
||||
self.assertNotEqual(progress.CHECKED_PROCESS_ABI, progress.CHECKED_MEMORY_ABI)
|
||||
self.assertEqual(progress.SERVICE_DECODERS[progress.SYSTEM_PROFILE][0], progress.SYSTEM_DECODER_MATTRS)
|
||||
self.assertEqual(progress.SERVICE_DECODERS[progress.CHECKED_PROCESS_PROFILE][0], ('+pauth-lr',))
|
||||
|
||||
def test_mixed_service_rows_select_their_own_profile_without_new_lane(self):
|
||||
default, additional = self.contracts()
|
||||
registry = fixtures()
|
||||
|
||||
+19
-10
@@ -24,6 +24,8 @@ SERVICE_ABI = BLOCK_ABI + '-apple-arm64e-software-pauth-clock-v1'
|
||||
SERVICE_PROFILE = 'apple-arm64e-software-pauth-clock-v1'
|
||||
SYSTEM_PROFILE = 'system-v1'
|
||||
CHECKED_MEMORY_PROFILE = 'checked-gpr-memory-sa0-off-normal-wb-v3'
|
||||
CHECKED_PROCESS_PROFILE = 'checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1'
|
||||
CHECKED_PROCESS_ABI = 'x86_64-sysv-guest-state-v3-context-block-exit-checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1'
|
||||
CHECKED_MEMORY_ABI = 'x86_64-sysv-guest-state-v3-context-block-exit-checked-gpr-memory-sa0-off-normal-wb-v3'
|
||||
BASELINE_CPU_TARGET = 'x86_64-baseline'
|
||||
SYSTEM_ABI = 'x86_64-sysv-guest-state-v2-block-exit-system-v1'
|
||||
@@ -32,6 +34,10 @@ MOVABS_RAX_IMM64 = b'\x48\xb8'
|
||||
MOV_EDX_IMM32 = b'\xba'
|
||||
X86_RET = b'\xc3'
|
||||
SYSTEM_DECODER_MATTRS = ('+mte',)
|
||||
SERVICE_DECODERS = {
|
||||
SYSTEM_PROFILE: (SYSTEM_DECODER_MATTRS, 'llvm-system-decoding'),
|
||||
CHECKED_PROCESS_PROFILE: (('+pauth-lr',), 'llvm-checked-process-decoding'),
|
||||
}
|
||||
# Independent decoding attributes never grant guest execution features.
|
||||
LEAF_DECODER_MATTRS = ('+sme2', '+sve2p1', '+lut', '+faminmax', '+fp8')
|
||||
SYSTEM_GUEST_BASE = 0x10000000
|
||||
@@ -39,6 +45,7 @@ SERVICE_BINDINGS = {
|
||||
SERVICE_PROFILE: (SERVICE_ABI, ('--software-pauth', '--software-clock')),
|
||||
SYSTEM_PROFILE: (SYSTEM_ABI, ('--system-boundaries', '--cpu-target', BASELINE_CPU_TARGET)),
|
||||
CHECKED_MEMORY_PROFILE: (CHECKED_MEMORY_ABI, ('--checked-memory-sa0-off', '--cpu-target', BASELINE_CPU_TARGET)),
|
||||
CHECKED_PROCESS_PROFILE: (CHECKED_PROCESS_ABI, ('--checked-process-sa0-off', '--cpu-target', BASELINE_CPU_TARGET)),
|
||||
}
|
||||
SCALABLE_PROFILE = 'apple-sme2-streaming-v1'
|
||||
DECLARED_SCALABLE_PROFILE = 'sme-streaming-v2'
|
||||
@@ -792,14 +799,15 @@ def smoke_forms(cli, forms, overrides, directory, mode='leaf', canonical_facts=N
|
||||
sorted(declined), directory / 'llvm-leaf-decoding', mattrs=LEAF_DECODER_MATTRS)
|
||||
if mode == 'service':
|
||||
import a64_disassembly
|
||||
declined = sorted({validate_sample(forms[identity], sample)
|
||||
for identity, row in overrides.items()
|
||||
if row['status'] != 'unsupported' and row['profile'] == SYSTEM_PROFILE
|
||||
for sample in row['smoke_samples']
|
||||
if next(decoder.disasm(struct.pack('<I', validate_sample(forms[identity], sample)), 0), None) is None})
|
||||
if declined:
|
||||
independent_receipts[SYSTEM_DECODER_MATTRS] = a64_disassembly.decode_words(
|
||||
declined, directory / 'llvm-system-decoding', mattrs=SYSTEM_DECODER_MATTRS)
|
||||
for service_profile, (attrs, decoding_directory) in SERVICE_DECODERS.items():
|
||||
declined = sorted({validate_sample(forms[identity], sample)
|
||||
for identity, row in overrides.items()
|
||||
if row['status'] != 'unsupported' and row['profile'] == service_profile
|
||||
for sample in row['smoke_samples']
|
||||
if next(decoder.disasm(struct.pack('<I', validate_sample(forms[identity], sample)), 0), None) is None})
|
||||
if declined:
|
||||
independent_receipts[attrs] = a64_disassembly.decode_words(
|
||||
declined, directory / decoding_directory, mattrs=attrs)
|
||||
if mode == 'scalable':
|
||||
import a64_disassembly
|
||||
declined = {}
|
||||
@@ -848,8 +856,9 @@ def smoke_forms(cli, forms, overrides, directory, mode='leaf', canonical_facts=N
|
||||
independent_receipt = independent_receipts.get(attrs)
|
||||
if independent_receipt is not None:
|
||||
independent_rows = {entry['word']: entry for entry in independent_receipt['rows']}
|
||||
elif mode == 'service' and row['profile'] == SYSTEM_PROFILE:
|
||||
independent_receipt = independent_receipts.get(SYSTEM_DECODER_MATTRS)
|
||||
elif mode == 'service' and row['profile'] in SERVICE_DECODERS:
|
||||
attrs, _ = SERVICE_DECODERS[row['profile']]
|
||||
independent_receipt = independent_receipts.get(attrs)
|
||||
if independent_receipt is not None:
|
||||
independent_rows = {entry['word']: entry for entry in independent_receipt['rows']}
|
||||
mnemonic, assembly, basis = smoke_decoding(
|
||||
|
||||
@@ -82,3 +82,46 @@ fn checked_memory_preparation_rejects_other_service_and_extended_profiles() {
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn checked_process_preparation_is_explicit_and_exclusive() {
|
||||
let args = [
|
||||
"stela",
|
||||
"compile-block",
|
||||
"input.bin",
|
||||
"--output-dir",
|
||||
"output",
|
||||
"--checked-process-sa0-off",
|
||||
];
|
||||
assert!(matches!(
|
||||
Cli::try_parse_from(args).unwrap().command,
|
||||
Command::CompileBlock {
|
||||
checked_process_sa0_off: true,
|
||||
checked_memory_sa0_off: false,
|
||||
..
|
||||
}
|
||||
));
|
||||
for alternative in [
|
||||
"--checked-memory-sa0-off",
|
||||
"--system-boundaries",
|
||||
"--software-pauth",
|
||||
"--thread-registers",
|
||||
] {
|
||||
let mut conflict = args.to_vec();
|
||||
conflict.push(alternative);
|
||||
let error = match Cli::try_parse_from(conflict) {
|
||||
Ok(_) => panic!("conflicting preparation profiles accepted"),
|
||||
Err(error) => error,
|
||||
};
|
||||
assert_eq!(error.kind(), ErrorKind::ArgumentConflict);
|
||||
}
|
||||
assert!(
|
||||
Cli::try_parse_from([
|
||||
"stela",
|
||||
"run-blocks",
|
||||
"input.bin",
|
||||
"--checked-process-sa0-off"
|
||||
])
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
+10
-2
@@ -171,6 +171,9 @@ enum Command {
|
||||
/// Prepare checked GPR memory with SA0 disabled; no CPU/native entry is supplied.
|
||||
#[arg(long, conflicts_with_all = ["system_boundaries", "software_pauth", "software_clock", "thread_registers", "guest_profile"])]
|
||||
checked_memory_sa0_off: bool,
|
||||
/// Prepare checked memory plus PAuth/clock/TSD exits with SA0 disabled; no native entry.
|
||||
#[arg(long, conflicts_with_all = ["checked_memory_sa0_off", "system_boundaries", "software_pauth", "software_clock", "thread_registers", "guest_profile"])]
|
||||
checked_process_sa0_off: bool,
|
||||
},
|
||||
/// Execute trusted raw code through bounded native block dispatch.
|
||||
#[command(group(clap::ArgGroup::new("software_pauth_context").args(["software_pauth_ib_key", "software_pauth_keys"])))]
|
||||
@@ -1516,8 +1519,13 @@ fn run() -> Result<()> {
|
||||
thread_registers,
|
||||
system_boundaries,
|
||||
checked_memory_sa0_off,
|
||||
checked_process_sa0_off,
|
||||
} => {
|
||||
let profile = if checked_memory_sa0_off {
|
||||
let profile = if checked_process_sa0_off {
|
||||
stela_compiler::block::BlockProfile::CheckedMemoryPauthClockThread(
|
||||
stela_compiler::block::CheckedMemoryProfile::SpAlignmentDisabled,
|
||||
)
|
||||
} else if checked_memory_sa0_off {
|
||||
stela_compiler::block::BlockProfile::CheckedMemory(
|
||||
stela_compiler::block::CheckedMemoryProfile::SpAlignmentDisabled,
|
||||
)
|
||||
@@ -1541,7 +1549,7 @@ fn run() -> Result<()> {
|
||||
let window = &source[..source
|
||||
.len()
|
||||
.min(stela_compiler::block::MAX_BLOCK_INSTRUCTIONS * 4)];
|
||||
let checked_plan = if checked_memory_sa0_off {
|
||||
let checked_plan = if checked_memory_sa0_off || checked_process_sa0_off {
|
||||
Some(stela_compiler::block::CompilationPlan::new(
|
||||
window,
|
||||
stela_compiler::GuestAddress(guest_base),
|
||||
|
||||
@@ -2138,15 +2138,15 @@
|
||||
},
|
||||
"facts_sha256": "fff5ee6ca3eb54bc4c9d52f749373725a0261175d843ab23cebfaa5dd87d0db3",
|
||||
"assessment": {
|
||||
"implemented": 3179,
|
||||
"implemented": 3196,
|
||||
"partial": 5,
|
||||
"unsupported": 1148,
|
||||
"unsupported": 1131,
|
||||
"total": 4332,
|
||||
"implementation_percentage": 73.38411819021238,
|
||||
"implementation_percentage": 73.77654662973222,
|
||||
"categories": {
|
||||
"base_integer_system": {
|
||||
"implemented": 582,
|
||||
"unsupported": 367,
|
||||
"implemented": 599,
|
||||
"unsupported": 350,
|
||||
"partial": 5
|
||||
},
|
||||
"fp_simd": {
|
||||
@@ -2163,7 +2163,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"compiler_source_sha256": "f4f13dc7d54fb44caf5068186b14a5531d484f5090acf9ee9e0ee2c798a47c3c",
|
||||
"compiler_source_sha256": "4d02b9fcf55d56d2db18c5f61d3a4a0c25c422cd8278660bfc09caf81a290bce",
|
||||
"evidence_reports": [],
|
||||
"assessment_basis": "reviewed_implementation_and_emission_smoke",
|
||||
"last_verified_checkpoint": {
|
||||
@@ -2223,17 +2223,17 @@
|
||||
{"id":"AUTDB_64P_dp_1src","instruction_id":"AUTDB","mnemonic":"AUTDB","category":"base_integer_system","source_file":"autdb.xml","encoding_mask":"0xfffffc00","encoding_value":"0xdac11c00","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTDZA_64Z_dp_1src","instruction_id":"AUTDA","mnemonic":"AUTDZA","category":"base_integer_system","source_file":"autda.xml","encoding_mask":"0xffffffe0","encoding_value":"0xdac13be0","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTDZB_64Z_dp_1src","instruction_id":"AUTDB","mnemonic":"AUTDZB","category":"base_integer_system","source_file":"autdb.xml","encoding_mask":"0xffffffe0","encoding_value":"0xdac13fe0","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIA171615_64LR_dp_1src","instruction_id":"AUTIA171615","mnemonic":"AUTIA171615","category":"base_integer_system","source_file":"autia171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1bbfe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"AUTIA171615_64LR_dp_1src","instruction_id":"AUTIA171615","mnemonic":"AUTIA171615","category":"base_integer_system","source_file":"autia171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1bbfe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"AUTIA1716_HI_hints","instruction_id":"AUTIA","mnemonic":"AUTIA1716","category":"base_integer_system","source_file":"autia.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503219f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIASPPCR_64LRR_dp_1src","instruction_id":"AUTIASPPCR","mnemonic":"AUTIASPPCR","category":"base_integer_system","source_file":"autiasppcr.xml","encoding_mask":"0xfffffc1f","encoding_value":"0xdac1901e","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"AUTIASPPC_only_dp_1src_imm","instruction_id":"AUTIASPPC_imm","mnemonic":"AUTIASPPC","category":"base_integer_system","source_file":"autiasppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0xf380001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"AUTIASPPCR_64LRR_dp_1src","instruction_id":"AUTIASPPCR","mnemonic":"AUTIASPPCR","category":"base_integer_system","source_file":"autiasppcr.xml","encoding_mask":"0xfffffc1f","encoding_value":"0xdac1901e","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier authenticate of original X30 with original SP and original Xn (Rn31 is XZR), snapshot before alias writes. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"AUTIASPPC_only_dp_1src_imm","instruction_id":"AUTIASPPC_imm","mnemonic":"AUTIASPPC","category":"base_integer_system","source_file":"autiasppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0xf380001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier authenticate of original X30 with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"AUTIASP_HI_hints","instruction_id":"AUTIA","mnemonic":"AUTIASP","category":"base_integer_system","source_file":"autia.xml","encoding_mask":"0xffffffff","encoding_value":"0xd50323bf","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIAZ_HI_hints","instruction_id":"AUTIA","mnemonic":"AUTIAZ","category":"base_integer_system","source_file":"autia.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503239f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIA_64P_dp_1src","instruction_id":"AUTIA","mnemonic":"AUTIA","category":"base_integer_system","source_file":"autia.xml","encoding_mask":"0xfffffc00","encoding_value":"0xdac11000","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIB171615_64LR_dp_1src","instruction_id":"AUTIB171615","mnemonic":"AUTIB171615","category":"base_integer_system","source_file":"autib171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1bffe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"AUTIB171615_64LR_dp_1src","instruction_id":"AUTIB171615","mnemonic":"AUTIB171615","category":"base_integer_system","source_file":"autib171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1bffe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"AUTIB1716_HI_hints","instruction_id":"AUTIB","mnemonic":"AUTIB1716","category":"base_integer_system","source_file":"autib.xml","encoding_mask":"0xffffffff","encoding_value":"0xd50321df","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIBSPPCR_64LRR_dp_1src","instruction_id":"AUTIBSPPCR","mnemonic":"AUTIBSPPCR","category":"base_integer_system","source_file":"autibsppcr.xml","encoding_mask":"0xfffffc1f","encoding_value":"0xdac1941e","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"AUTIBSPPC_only_dp_1src_imm","instruction_id":"AUTIBSPPC_imm","mnemonic":"AUTIBSPPC","category":"base_integer_system","source_file":"autibsppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0xf3a0001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"AUTIBSPPCR_64LRR_dp_1src","instruction_id":"AUTIBSPPCR","mnemonic":"AUTIBSPPCR","category":"base_integer_system","source_file":"autibsppcr.xml","encoding_mask":"0xfffffc1f","encoding_value":"0xdac1941e","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier authenticate of original X30 with original SP and original Xn (Rn31 is XZR), snapshot before alias writes. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"AUTIBSPPC_only_dp_1src_imm","instruction_id":"AUTIBSPPC_imm","mnemonic":"AUTIBSPPC","category":"base_integer_system","source_file":"autibsppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0xf3a0001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier authenticate of original X30 with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"AUTIBSP_HI_hints","instruction_id":"AUTIB","mnemonic":"AUTIBSP","category":"base_integer_system","source_file":"autib.xml","encoding_mask":"0xffffffff","encoding_value":"0xd50323ff","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIBZ_HI_hints","instruction_id":"AUTIB","mnemonic":"AUTIBZ","category":"base_integer_system","source_file":"autib.xml","encoding_mask":"0xffffffff","encoding_value":"0xd50323df","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"AUTIB_64P_dp_1src","instruction_id":"AUTIB","mnemonic":"AUTIB","category":"base_integer_system","source_file":"autib.xml","encoding_mask":"0xfffffc00","encoding_value":"0xdac11400","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
@@ -3585,23 +3585,23 @@
|
||||
{"id":"PACDZA_64Z_dp_1src","instruction_id":"PACDA","mnemonic":"PACDZA","category":"base_integer_system","source_file":"pacda.xml","encoding_mask":"0xffffffe0","encoding_value":"0xdac12be0","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACDZB_64Z_dp_1src","instruction_id":"PACDB","mnemonic":"PACDZB","category":"base_integer_system","source_file":"pacdb.xml","encoding_mask":"0xffffffe0","encoding_value":"0xdac12fe0","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACGA_64P_dp_2src","instruction_id":"PACGA","mnemonic":"PACGA","category":"base_integer_system","source_file":"pacga.xml","encoding_mask":"0xffe0fc00","encoding_value":"0x9ac03000","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete PACGA form in explicit QARMA5 Context profile stela-classic-arm64e-qarma5-va47-itbi0-dtbi1-explicit-keys-ga-v1 with an independently supplied APGA key; Rn31 is ZR, Rm31 is SP, Rd31 discards only after key/service validation; lower32 result bits zero; original flags/FP/SIMD preserved. No Apple hardware key identity or architectural exception delivery claim."}]},
|
||||
{"id":"PACIA171615_64LR_dp_1src","instruction_id":"PACIA171615","mnemonic":"PACIA171615","category":"base_integer_system","source_file":"pacia171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac18bfe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"PACIA171615_64LR_dp_1src","instruction_id":"PACIA171615","mnemonic":"PACIA171615","category":"base_integer_system","source_file":"pacia171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac18bfe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"PACIA1716_HI_hints","instruction_id":"PACIA","mnemonic":"PACIA1716","category":"base_integer_system","source_file":"pacia.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503211f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIASPPC_64LR_dp_1src","instruction_id":"PACIASPPC","mnemonic":"PACIASPPC","category":"base_integer_system","source_file":"paciasppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1a3fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"PACIASPPC_64LR_dp_1src","instruction_id":"PACIASPPC","mnemonic":"PACIASPPC","category":"base_integer_system","source_file":"paciasppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1a3fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"PACIASP_HI_hints","instruction_id":"PACIA","mnemonic":"PACIASP","category":"base_integer_system","source_file":"pacia.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503233f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIAZ_HI_hints","instruction_id":"PACIA","mnemonic":"PACIAZ","category":"base_integer_system","source_file":"pacia.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503231f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIA_64P_dp_1src","instruction_id":"PACIA","mnemonic":"PACIA","category":"base_integer_system","source_file":"pacia.xml","encoding_mask":"0xfffffc00","encoding_value":"0xdac10000","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIB171615_64LR_dp_1src","instruction_id":"PACIB171615","mnemonic":"PACIB171615","category":"base_integer_system","source_file":"pacib171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac18ffe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"PACIB171615_64LR_dp_1src","instruction_id":"PACIB171615","mnemonic":"PACIB171615","category":"base_integer_system","source_file":"pacib171615.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac18ffe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"PACIB1716_HI_hints","instruction_id":"PACIB","mnemonic":"PACIB1716","category":"base_integer_system","source_file":"pacib.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503215f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIBSPPC_64LR_dp_1src","instruction_id":"PACIBSPPC","mnemonic":"PACIBSPPC","category":"base_integer_system","source_file":"pacibsppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1a7fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"PACIBSPPC_64LR_dp_1src","instruction_id":"PACIBSPPC","mnemonic":"PACIBSPPC","category":"base_integer_system","source_file":"pacibsppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac1a7fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"PACIBSP_HI_hints","instruction_id":"PACIB","mnemonic":"PACIBSP","category":"base_integer_system","source_file":"pacib.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503237f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIBZ_HI_hints","instruction_id":"PACIB","mnemonic":"PACIBZ","category":"base_integer_system","source_file":"pacib.xml","encoding_mask":"0xffffffff","encoding_value":"0xd503235f","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIB_64P_dp_1src","instruction_id":"PACIB","mnemonic":"PACIB","category":"base_integer_system","source_file":"pacib.xml","encoding_mask":"0xfffffc00","encoding_value":"0xdac10400","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIZA_64Z_dp_1src","instruction_id":"PACIA","mnemonic":"PACIZA","category":"base_integer_system","source_file":"pacia.xml","encoding_mask":"0xffffffe0","encoding_value":"0xdac123e0","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACIZB_64Z_dp_1src","instruction_id":"PACIB","mnemonic":"PACIZB","category":"base_integer_system","source_file":"pacib.xml","encoding_mask":"0xffffffe0","encoding_value":"0xdac127e0","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"PACM_HI_hints","instruction_id":"PACM","mnemonic":"PACM","category":"base_integer_system","source_file":"pacm.xml","encoding_mask":"0xffffffff","encoding_value":"0xd50324ff","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"PACNBIASPPC_64LR_dp_1src","instruction_id":"PACNBIASPPC","mnemonic":"PACNBIASPPC","category":"base_integer_system","source_file":"pacnbiasppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac183fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"PACNBIBSPPC_64LR_dp_1src","instruction_id":"PACNBIBSPPC","mnemonic":"PACNBIBSPPC","category":"base_integer_system","source_file":"pacnbibsppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac187fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"PACM_HI_hints","instruction_id":"PACM","mnemonic":"PACM","category":"base_integer_system","source_file":"pacm.xml","encoding_mask":"0xffffffff","encoding_value":"0xd50324ff","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Actual EL0 EnPACM0 sets or clears the sole PSTATE.PACM bit; no GPR or NZCV change. Feature-absent PACM is architecturally HINT NOP, retained as source/model control; the bounded LR-present process refuses unavailable storage/profile before entry. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"PACNBIASPPC_64LR_dp_1src","instruction_id":"PACNBIASPPC","mnemonic":"PACNBIASPPC","category":"base_integer_system","source_file":"pacnbiasppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac183fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"PACNBIBSPPC_64LR_dp_1src","instruction_id":"PACNBIBSPPC","mnemonic":"PACNBIBSPPC","category":"base_integer_system","source_file":"pacnbibsppc.xml","encoding_mask":"0xffffffff","encoding_value":"0xdac187fe","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"PMULL_asimddiff_L","instruction_id":"PMULL_advsimd","mnemonic":"PMULL","category":"fp_simd","source_file":"pmull_advsimd.xml","encoding_mask":"0xbf20fc00","encoding_value":"0x0e20e000","features":[{"feature":"FEAT_AdvSIMD","name":"v8Ap0"}],"status":"implemented","profiles":[{"profile":"direct-private-ram-leaf-v2","status":"implemented","scope":"Enabled FP/AdvSIMD/PMULL. PMUL byte lanes and PMULL byte/64-bit carryless full products; all allocated scalar/vector/by-element SQDMULH/SQRDMULH/SQDMULL/SQDMLAL/SQDMLSL shapes. Correct high-source halves and indexed register/lane selection, aliased inputs and accumulators, scalar/Q=0 upper clearing. Doubling products saturate before independent accumulating saturation; active saturation sets sticky FPSR.QC. Polynomial forms preserve FPSR; all forms preserve NZCV/FPCR, other status bits and RAM. Disabled-feature traps, streaming SME and complete process execution remain separate."}]},
|
||||
{"id":"PMUL_asimdsame_only","instruction_id":"PMUL_advsimd","mnemonic":"PMUL","category":"fp_simd","source_file":"pmul_advsimd.xml","encoding_mask":"0xbf20fc00","encoding_value":"0x2e209c00","features":[{"feature":"FEAT_AdvSIMD","name":"v8Ap0"}],"status":"implemented","profiles":[{"profile":"direct-private-ram-leaf-v2","status":"implemented","scope":"Enabled FP/AdvSIMD/PMULL. PMUL byte lanes and PMULL byte/64-bit carryless full products; all allocated scalar/vector/by-element SQDMULH/SQRDMULH/SQDMULL/SQDMLAL/SQDMLSL shapes. Correct high-source halves and indexed register/lane selection, aliased inputs and accumulators, scalar/Q=0 upper clearing. Doubling products saturate before independent accumulating saturation; active saturation sets sticky FPSR.QC. Polynomial forms preserve FPSR; all forms preserve NZCV/FPCR, other status bits and RAM. Disabled-feature traps, streaming SME and complete process execution remain separate."}]},
|
||||
{"id":"PRFM_P_ldst_pos","instruction_id":"PRFM_imm","mnemonic":"PRFM","category":"base_integer_system","source_file":"prfm_imm.xml","encoding_mask":"0xffc00000","encoding_value":"0xf9800000","features":[],"status":"implemented","profiles":[{"profile":"direct-private-ram-leaf-v2","status":"implemented","scope":"Untagged/authenticated, checked-pointer-disabled addresses; all allocated raw hints/addresses, baseline data-prefetch hints and source-authorized no-action choice for unavailable hints. No SP alignment trap, RAM/register effects or synchronous data fault. Register RPRFM neighbors remain a separate unsupported class."}]},
|
||||
@@ -3678,11 +3678,11 @@
|
||||
{"id":"RCWSWPPL_128_memop_128","instruction_id":"RCWSWPP","mnemonic":"RCWSWPPL","category":"base_integer_system","source_file":"rcwswpp.xml","encoding_mask":"0xffe0fc00","encoding_value":"0x1960a000","features":[{"feature":"FEAT_D128 && FEAT_THE","name":"v9Ap4 && v8Ap9"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"RCWSWPP_128_memop_128","instruction_id":"RCWSWPP","mnemonic":"RCWSWPP","category":"base_integer_system","source_file":"rcwswpp.xml","encoding_mask":"0xffe0fc00","encoding_value":"0x1920a000","features":[{"feature":"FEAT_D128 && FEAT_THE","name":"v9Ap4 && v8Ap9"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"RCWSWP_64_memop","instruction_id":"RCWSWP","mnemonic":"RCWSWP","category":"base_integer_system","source_file":"rcwswp.xml","encoding_mask":"0xffe0fc00","encoding_value":"0x3820a000","features":[{"feature":"FEAT_THE","name":"v8Ap9"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"RETAASPPCR_64M_branch_reg","instruction_id":"RETASPPCR_reg","mnemonic":"RETAASPPCR","category":"base_integer_system","source_file":"retasppcr_reg.xml","encoding_mask":"0xffffffe0","encoding_value":"0xd65f0be0","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"RETAASPPC_only_miscbranch","instruction_id":"RETASPPC_imm","mnemonic":"RETAASPPC","category":"base_integer_system","source_file":"retasppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0x5500001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"RETAASPPCR_64M_branch_reg","instruction_id":"RETASPPCR_reg","mnemonic":"RETAASPPCR","category":"base_integer_system","source_file":"retasppcr_reg.xml","encoding_mask":"0xffffffe0","encoding_value":"0xd65f0be0","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and original Xn; Rm31 belongs to legacy RETAA/RETAB and is excluded from this form. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"RETAASPPC_only_miscbranch","instruction_id":"RETASPPC_imm","mnemonic":"RETAASPPC","category":"base_integer_system","source_file":"retasppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0x5500001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"RETAA_64E_branch_reg","instruction_id":"RETA","mnemonic":"RETAA","category":"base_integer_system","source_file":"reta.xml","encoding_mask":"0xffffffff","encoding_value":"0xd65f0bff","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"RETABSPPCR_64M_branch_reg","instruction_id":"RETASPPCR_reg","mnemonic":"RETABSPPCR","category":"base_integer_system","source_file":"retasppcr_reg.xml","encoding_mask":"0xffffffe0","encoding_value":"0xd65f0fe0","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"RETABSPPC_only_miscbranch","instruction_id":"RETASPPC_imm","mnemonic":"RETABSPPC","category":"base_integer_system","source_file":"retasppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0x5520001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"unsupported","profiles":[]},
|
||||
{"id":"RETABSPPCR_64M_branch_reg","instruction_id":"RETASPPCR_reg","mnemonic":"RETABSPPCR","category":"base_integer_system","source_file":"retasppcr_reg.xml","encoding_mask":"0xffffffe0","encoding_value":"0xd65f0fe0","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and original Xn; Rm31 belongs to legacy RETAA/RETAB and is excluded from this form. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"RETABSPPC_only_miscbranch","instruction_id":"RETASPPC_imm","mnemonic":"RETABSPPC","category":"base_integer_system","source_file":"retasppc_imm.xml","encoding_mask":"0xffe0001f","encoding_value":"0x5520001f","features":[{"feature":"FEAT_PAuth_LR","name":"v9Ap5"}],"status":"implemented","profiles":[{"profile":"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1","status":"implemented","scope":"Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. "}]},
|
||||
{"id":"RETAB_64E_branch_reg","instruction_id":"RETA","mnemonic":"RETAB","category":"base_integer_system","source_file":"reta.xml","encoding_mask":"0xffffffff","encoding_value":"0xd65f0fff","features":[{"feature":"FEAT_PAuth","name":"v8Ap3"}],"status":"implemented","profiles":[{"profile":"apple-arm64e-software-pauth-clock-v1","status":"implemented","scope":"Complete form in explicit classic software PAuth1 execution profile; GCS/BTI and PAuth_LR/FPAC disabled, exact immutable-source helper boundary."}]},
|
||||
{"id":"RET_64R_branch_reg","instruction_id":"RET","mnemonic":"RET","category":"base_integer_system","source_file":"ret.xml","encoding_mask":"0xfffffc1f","encoding_value":"0xd65f0000","features":[],"status":"implemented","profiles":[{"profile":"direct-private-ram-leaf-v2","status":"partial","scope":"Only RET X30 as a terminal leaf/harness boundary; arbitrary guest return target dispatch and return faults unsupported."},{"profile":"direct-private-ram-block-v1","status":"implemented","scope":"Ordinary control transfer returns the next guest PC and exit kind to serialized dispatch, with X30=PC+4 for calls and original-target capture for BLR X30. Conditional transfers preserve guest NZCV. Guest address arithmetic must not wrap. GCS is disabled and executable pages are unguarded; no PAC, PSTATE.BTYPE or exception delivery is claimed."}]},
|
||||
{"id":"REV16_32_dp_1src","instruction_id":"REV16_int","mnemonic":"REV16","category":"base_integer_system","source_file":"rev16_int.xml","encoding_mask":"0xfffffc00","encoding_value":"0x5ac00400","features":[],"status":"implemented","profiles":[{"profile":"direct-private-ram-leaf-v2","status":"implemented","scope":"Reverse bytes independently within both 16-bit halfwords of Wn. All Rd/Rn operands, in-place/discard/ZR behavior, W writes zero-extend, and NZCV preservation in the declared leaf profile. Complete PSTATE/DIT and platform integration remain outside profile."}]},
|
||||
|
||||
@@ -177,6 +177,7 @@
|
||||
"crates/stela-compiler/src/x86_64/simd/memory_checked/tests.rs",
|
||||
"crates/stela-compiler/src/block/thread.rs",
|
||||
"crates/stela-compiler/src/block/pauth_memory.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-compiler/src/x86_64/block.rs",
|
||||
"crates/stela-compiler/src/aarch64/bitfield.rs",
|
||||
"crates/stela-compiler/src/x86_64/bitfield.rs",
|
||||
@@ -420,6 +421,20 @@
|
||||
"Debug register bank, raw producer, alternate PE/provider or fabricated native permission"
|
||||
]
|
||||
}
|
||||
,
|
||||
"checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1": {
|
||||
"id": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"compiler_mode": "service",
|
||||
"abi": "x86_64-sysv-guest-state-v3-context-block-exit-checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"description": "Fresh retained EL0 NormalWB/SA0-off checked process with same-Snapshot APA6/PACM2, explicit Full PACM, actual key/control/outer owner and canonical source-validated staged effects. Each reviewed form declares its admitted scope; this profile alone grants no instruction.",
|
||||
"outside_scope": [
|
||||
"EL1/EL2/EL3, exceptions/traps/services/exception return or architectural fault delivery in LR-present scope",
|
||||
"BTI/GCS/BRBE/SPE/debug/CONSTPACFIELD-present effects, unknown extended controls or inferred key/control/PACM state",
|
||||
"Enabled signing of noncanonical lower-VA47 inputs; native pointer or guest feature adoption without qualification",
|
||||
"Feature-absent guest HINT/UNDEF execution outside the declared LR-present profile, full process/OS/boot acceptance",
|
||||
"Physical LR-capable Apple original execution or performance equivalence; model qualification is explicitly derived"
|
||||
]
|
||||
}
|
||||
},
|
||||
"status_policy": "Block and leaf counts are separate profile assessments of canonical forms. Nine forms overlap; counts must not be added. No Apple ISA or compatibility denominator is established.",
|
||||
"evidence_groups": {
|
||||
@@ -625,6 +640,74 @@
|
||||
"crates/stela-runtime/src/memory/monitor.rs"
|
||||
]
|
||||
}
|
||||
,
|
||||
"checked_pauth_lr17_current": {
|
||||
"harness": ".stela/research/crash-recovery-2026-10-15/macos/retained-pauth-lr-1/native_gate_2.py",
|
||||
"report": ".stela/research/crash-recovery-2026-10-15/macos/retained-pauth-lr-1/evidence-1.json",
|
||||
"kind": "retained_lr_present_model_native_v1",
|
||||
"comparison_field": "full_state_model_comparisons",
|
||||
"required_positive_counts": [
|
||||
"full_state_model_comparisons",
|
||||
"typed_authentication_faults",
|
||||
"blocked_retry_checks",
|
||||
"qualification_controls",
|
||||
"actual_native_entries",
|
||||
"prepared_entry_declines",
|
||||
"complete_body_transfers"
|
||||
],
|
||||
"required_measurements": {
|
||||
"canonical_forms": 17,
|
||||
"full_state_model_comparisons": 103,
|
||||
"typed_authentication_faults": 20,
|
||||
"blocked_retry_checks": 20,
|
||||
"qualification_controls": 21,
|
||||
"actual_native_entries": 105,
|
||||
"prepared_entry_declines": 19,
|
||||
"complete_body_transfers": 124,
|
||||
"fresh_original_executions": 0
|
||||
},
|
||||
"abi": "x86_64-sysv-guest-state-v3-context-block-exit-checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"require_current_executable": true,
|
||||
"required_shared_sources": [
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/lib.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/diagnostics.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/entry_controls/tests.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/entry_controls.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/mod.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr/tests.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_policy.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/provider.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/source.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/process.rs",
|
||||
"crates/stela-runtime/src/blocks.rs",
|
||||
"crates/stela-runtime/src/memory/domain/lifecycle.rs",
|
||||
"crates/stela-runtime/src/pauth/conditional.rs",
|
||||
"crates/stela-runtime/src/pauth/features/lr_tests.rs",
|
||||
"crates/stela-runtime/src/pauth/features.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_context/tests.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_context.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_service.rs",
|
||||
"crates/stela-runtime/src/pauth/pauth_lr_tests.rs",
|
||||
"crates/stela-runtime/src/pauth/two_modifier/tests.rs",
|
||||
"crates/stela-runtime/src/pauth/two_modifier.rs",
|
||||
"crates/stela-runtime/src/pauth.rs",
|
||||
"crates/stela-runtime/src/system/identification_snapshot/qualifiers.rs",
|
||||
"crates/stela-runtime/src/system/process_memory/extended_controls/tests.rs",
|
||||
"crates/stela-runtime/src/system/process_memory/extended_controls.rs",
|
||||
"crates/stela-runtime/src/system/process_memory/source.rs",
|
||||
"crates/stela-runtime/src/system/process_memory.rs",
|
||||
"crates/stela-runtime/src/system/state/pacm.rs",
|
||||
"crates/stela-runtime/src/system/state/pacm_tests.rs",
|
||||
"crates/stela-runtime/src/system/state.rs"
|
||||
],
|
||||
"review_status": "Independent actual source/native/state/body/CLI review passed; exact publication metadata approval follows.",
|
||||
"limits": "Derived June-source model, not physical-original LR execution. Actual host-native body target and baseline emission are separate. Typed precise fault stop and blocked retry are not guest exception delivery. PACM feature-absent HINT is an architectural contract/model control, not execution admitted by this LR-present profile."
|
||||
}
|
||||
},
|
||||
"forms": [
|
||||
{
|
||||
@@ -3874,5 +3957,669 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
{
|
||||
"id": "AUTIA171615_64LR_dp_1src",
|
||||
"mnemonic": "AUTIA171615",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "autia171615.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac1bbfe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "4588e0a9fe14037b502499b0a06b084d3c7f1678f595e4224c4f300bd5e3ff89",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac1bbfe",
|
||||
"expected_mnemonics": [
|
||||
"autia171615"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "AUTIASPPCR_64LRR_dp_1src",
|
||||
"mnemonic": "AUTIASPPCR",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "autiasppcr.xml",
|
||||
"encoding_mask": "0xfffffc1f",
|
||||
"encoding_value": "0xdac1901e",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "fe00822a1b315c1f230fc4359ae9fb04fd454d67d5041988215e3a5e29a8248c",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier authenticate of original X30 with original SP and original Xn (Rn31 is XZR), snapshot before alias writes. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac1901e",
|
||||
"expected_mnemonics": [
|
||||
"autiasppcr"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "AUTIASPPC_only_dp_1src_imm",
|
||||
"mnemonic": "AUTIASPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "autiasppc_imm.xml",
|
||||
"encoding_mask": "0xffe0001f",
|
||||
"encoding_value": "0xf380001f",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "22cda57d0c70c85fda0f230bace9bf4f0873e57fd07b99747e2db89d6b86fbdb",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier authenticate of original X30 with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xf380001f",
|
||||
"expected_mnemonics": [
|
||||
"autiasppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "AUTIB171615_64LR_dp_1src",
|
||||
"mnemonic": "AUTIB171615",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "autib171615.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac1bffe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "9737f4a45fc2f541e56eab912b043481097f5ae4208516336ccbc517edad6a06",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac1bffe",
|
||||
"expected_mnemonics": [
|
||||
"autib171615"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "AUTIBSPPCR_64LRR_dp_1src",
|
||||
"mnemonic": "AUTIBSPPCR",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "autibsppcr.xml",
|
||||
"encoding_mask": "0xfffffc1f",
|
||||
"encoding_value": "0xdac1941e",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "9784102b8c5bfd1d845b861ebda9b135ab0fc2735b623c383c3c3cba736c7f1a",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier authenticate of original X30 with original SP and original Xn (Rn31 is XZR), snapshot before alias writes. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac1941e",
|
||||
"expected_mnemonics": [
|
||||
"autibsppcr"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "AUTIBSPPC_only_dp_1src_imm",
|
||||
"mnemonic": "AUTIBSPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "autibsppc_imm.xml",
|
||||
"encoding_mask": "0xffe0001f",
|
||||
"encoding_value": "0xf3a0001f",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "64c27883603eeaff0d32886ca3392a5520b78c395fb5db1dd14176d28175c6f2",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier authenticate of original X30 with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xf3a0001f",
|
||||
"expected_mnemonics": [
|
||||
"autibsppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PACIA171615_64LR_dp_1src",
|
||||
"mnemonic": "PACIA171615",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "pacia171615.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac18bfe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "abfb676b79985ec228d1bf58b43a8fab3899da3ebd776f9b13a32ff8e125eb14",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac18bfe",
|
||||
"expected_mnemonics": [
|
||||
"pacia171615"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PACIASPPC_64LR_dp_1src",
|
||||
"mnemonic": "PACIASPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "paciasppc.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac1a3fe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "c46d8fd1e05d607e394524be87a22549002280fe08157863f10a242b2bbd8112",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac1a3fe",
|
||||
"expected_mnemonics": [
|
||||
"paciasppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PACIB171615_64LR_dp_1src",
|
||||
"mnemonic": "PACIB171615",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "pacib171615.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac18ffe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "eaf33ece2143c805782301c3540df8ccc1ccb90d612f4b60374ff12b068e54c3",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier X17 instruction-key operation reads original X16 and X15 before any destination effect, regardless of PACM. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac18ffe",
|
||||
"expected_mnemonics": [
|
||||
"pacib171615"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PACIBSPPC_64LR_dp_1src",
|
||||
"mnemonic": "PACIBSPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "pacibsppc.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac1a7fe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "575d49b8a6b70c5608e9895bd742bde9afd8c922202bfd6fa999397c9a807426",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac1a7fe",
|
||||
"expected_mnemonics": [
|
||||
"pacibsppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PACM_HI_hints",
|
||||
"mnemonic": "PACM",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "pacm.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xd50324ff",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "529f835713acb47ec9848acc6a426c3cd8a930f6275a7ea2606ae40146ecac20",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Actual EL0 EnPACM0 sets or clears the sole PSTATE.PACM bit; no GPR or NZCV change. Feature-absent PACM is architecturally HINT NOP, retained as source/model control; the bounded LR-present process refuses unavailable storage/profile before entry. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xd50324ff",
|
||||
"expected_mnemonics": [
|
||||
"hint"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PACNBIASPPC_64LR_dp_1src",
|
||||
"mnemonic": "PACNBIASPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "pacnbiasppc.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac183fe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "6d541827f64074416bdf663f8f5d7f885e370d760a3ddc62d5ff026202feefad",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac183fe",
|
||||
"expected_mnemonics": [
|
||||
"pacnbiasppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PACNBIBSPPC_64LR_dp_1src",
|
||||
"mnemonic": "PACNBIBSPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "pacnbibsppc.xml",
|
||||
"encoding_mask": "0xffffffff",
|
||||
"encoding_value": "0xdac187fe",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "ef8fd66c3a9f627522bee17e3458096b8ea211fea8e776e954029c02e4de0ba4",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier sign of original X30 with original SP and the exact source instruction PC, regardless of PACM; PACNB variants retain their source-defined absence of implicit BTI. Enabled noncanonical lower-VA47 signing refuses before mutation. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xdac187fe",
|
||||
"expected_mnemonics": [
|
||||
"pacnbibsppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "RETAASPPCR_64M_branch_reg",
|
||||
"mnemonic": "RETAASPPCR",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "retasppcr_reg.xml",
|
||||
"encoding_mask": "0xffffffe0",
|
||||
"encoding_value": "0xd65f0be0",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "73d14d5cd061001e7286dff689732e203819b67150becef5d1140faa8444f8fa",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and original Xn; Rm31 belongs to legacy RETAA/RETAB and is excluded from this form. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xd65f0be0",
|
||||
"expected_mnemonics": [
|
||||
"retaasppcr"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "RETAASPPC_only_miscbranch",
|
||||
"mnemonic": "RETAASPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "retasppc_imm.xml",
|
||||
"encoding_mask": "0xffe0001f",
|
||||
"encoding_value": "0x5500001f",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "83b0f6c869061b4eabc0e859d5d2d879d79c4f21e88d74215e9c5a3cd7a41e6a",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0x5500001f",
|
||||
"expected_mnemonics": [
|
||||
"retaasppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "RETABSPPCR_64M_branch_reg",
|
||||
"mnemonic": "RETABSPPCR",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "retasppcr_reg.xml",
|
||||
"encoding_mask": "0xffffffe0",
|
||||
"encoding_value": "0xd65f0fe0",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "73d14d5cd061001e7286dff689732e203819b67150becef5d1140faa8444f8fa",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and original Xn; Rm31 belongs to legacy RETAA/RETAB and is excluded from this form. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0xd65f0fe0",
|
||||
"expected_mnemonics": [
|
||||
"retabsppcr"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "RETABSPPC_only_miscbranch",
|
||||
"mnemonic": "RETABSPPC",
|
||||
"category": "base_integer_system",
|
||||
"source_file": "retasppc_imm.xml",
|
||||
"encoding_mask": "0xffe0001f",
|
||||
"encoding_value": "0x5520001f",
|
||||
"features": [
|
||||
{
|
||||
"feature": "FEAT_PAuth_LR",
|
||||
"name": "v9Ap5"
|
||||
}
|
||||
],
|
||||
"alias": false,
|
||||
"source_sha256": "83b0f6c869061b4eabc0e859d5d2d879d79c4f21e88d74215e9c5a3cd7a41e6a",
|
||||
"profile": "checked-gpr-memory-sa0-off-normal-wb-pauth-clock-thread-v1",
|
||||
"status": "implemented",
|
||||
"review": "Reviewed canonical same-owner LR source, actual103 full-State model/native matches,20 precise faults/blocked retries,21 controls and current124 complete-body/ABI/source-map transfer; pinned source/model oracle limits retained.",
|
||||
"compiler_sources": [
|
||||
"crates/stela-compiler/src/block.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_instruction.rs",
|
||||
"crates/stela-runtime/src/pauth/lr_effects.rs",
|
||||
"crates/stela-runtime/src/blocks/retirement/checked/pauth_lr.rs"
|
||||
],
|
||||
"evidence_groups": [
|
||||
"checked_pauth_lr17_current"
|
||||
],
|
||||
"scope": "Explicit two-modifier return authenticates original X30 into a temporary branch target with original SP and source PC minus unsigned imm16 shifted by two, with 64-bit wrapping. Signed X30 is preserved; BTI/GCS/BRBE effects are absent in the bounded profile. Fresh declared EL0 APA6/PACM2, Full PACM, lower-VA47 instruction TBI off, sole same-Snapshot keys/controls and original outer loan; selected-key disable bypass precedes lookup/canonicalization. Canonical Active stages effects and commits PC once; enabled authentication fault preserves destination/link/PACM/PC and blocks re-entry. NZCV/FP/RAM are preserved. Derived model/native evidence only; no physical Apple original or exception-delivery claim. ",
|
||||
"smoke_samples": [
|
||||
{
|
||||
"word": "0x5520001f",
|
||||
"expected_mnemonics": [
|
||||
"retabsppc"
|
||||
],
|
||||
"consumed_source_bytes": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -177,6 +177,7 @@
|
||||
"crates/stela-compiler/src/x86_64/simd/memory_checked/tests.rs",
|
||||
"crates/stela-compiler/src/block/thread.rs",
|
||||
"crates/stela-compiler/src/block/pauth_memory.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-compiler/src/x86_64/block.rs",
|
||||
"crates/stela-compiler/src/aarch64/bitfield.rs",
|
||||
"crates/stela-compiler/src/x86_64/bitfield.rs",
|
||||
|
||||
@@ -48426,6 +48426,7 @@
|
||||
"crates/stela-compiler/src/x86_64/simd/memory_checked/tests.rs",
|
||||
"crates/stela-compiler/src/block/thread.rs",
|
||||
"crates/stela-compiler/src/block/pauth_memory.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-compiler/src/x86_64/block.rs",
|
||||
"crates/stela-compiler/src/aarch64/bitfield.rs",
|
||||
"crates/stela-compiler/src/x86_64/bitfield.rs",
|
||||
|
||||
@@ -177,6 +177,7 @@
|
||||
"crates/stela-compiler/src/x86_64/simd/memory_checked/tests.rs",
|
||||
"crates/stela-compiler/src/block/thread.rs",
|
||||
"crates/stela-compiler/src/block/pauth_memory.rs",
|
||||
"crates/stela-compiler/src/block/pauth_lr.rs",
|
||||
"crates/stela-compiler/src/x86_64/block.rs",
|
||||
"crates/stela-compiler/src/aarch64/bitfield.rs",
|
||||
"crates/stela-compiler/src/x86_64/bitfield.rs",
|
||||
|
||||
Reference in new issue
Block a user