fix(call): verify flags in call_{ro,wo}

Bail if `CallFlags::READ` is set in `call_wo` as that will allow the
caller to mutate immutable slices. Similarly, bail if `CallFlags::WRITE`
is set in `call_ro`.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
Co-authored-by: @4lDO2
This commit is contained in:
Anhad Singh
2026-08-01 18:51:46 +10:00
parent 7c4dbc2b9b
commit a2110bbaa5
+6
View File
@@ -662,6 +662,9 @@ pub mod call {
flags: syscall::CallFlags,
metadata: &[u64],
) -> Result<usize> {
if flags.contains(syscall::CallFlags::WRITE) {
return Err(Error::new(syscall::EINVAL));
}
unsafe {
fd.raw_call(
payload.as_mut_ptr(),
@@ -679,6 +682,9 @@ pub mod call {
flags: syscall::CallFlags,
metadata: &[u64],
) -> Result<usize> {
if flags.contains(syscall::CallFlags::READ) {
return Err(Error::new(syscall::EINVAL));
}
unsafe {
fd.raw_call(
payload.as_ptr().cast_mut(),