From a2110bbaa5263274597275b14bca620c50c7a7ad Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Sat, 1 Aug 2026 18:51:46 +1000 Subject: [PATCH] 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 Co-authored-by: @4lDO2 --- src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a67ccba637..7f4842d6de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -662,6 +662,9 @@ pub mod call { flags: syscall::CallFlags, metadata: &[u64], ) -> Result { + 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 { + if flags.contains(syscall::CallFlags::READ) { + return Err(Error::new(syscall::EINVAL)); + } unsafe { fd.raw_call( payload.as_ptr().cast_mut(),