MCPcopy Create free account
hub / github.com/Starry-OS/StarryOS / validate_cap_header

Function validate_cap_header

api/src/syscall/task/ctl.rs:13–23  ·  view source on GitHub ↗
(header_ptr: *mut __user_cap_header_struct)

Source from the content-addressed store, hash-verified

11const CAPABILITY_VERSION_3: u32 = 0x20080522;
12
13fn validate_cap_header(header_ptr: *mut __user_cap_header_struct) -> AxResult<()> {
14 // FIXME: AnyBitPattern
15 let mut header = unsafe { header_ptr.vm_read_uninit()?.assume_init() };
16 if header.version != CAPABILITY_VERSION_3 {
17 header.version = CAPABILITY_VERSION_3;
18 header_ptr.vm_write(header)?;
19 return Err(AxError::InvalidInput);
20 }
21 let _ = get_process_data(header.pid as u32)?;
22 Ok(())
23}
24
25pub fn sys_capget(
26 header: *mut __user_cap_header_struct,

Callers 2

sys_capgetFunction · 0.85
sys_capsetFunction · 0.85

Calls 1

get_process_dataFunction · 0.85

Tested by

no test coverage detected