pub struct SystemIO { /* private fields */ }
Expand description
A RuleSet
representing syscalls that perform IO - open/close/read/write/seek/stat.
Configurable to allow subsets of IO syscalls and specific fds.
Implementations
sourceimpl SystemIO
impl SystemIO
sourcepub fn everything() -> SystemIO
pub fn everything() -> SystemIO
Allow all IO syscalls.
sourcepub fn allow_read(self) -> SystemIO
pub fn allow_read(self) -> SystemIO
Allow read
syscalls.
sourcepub fn allow_write(self) -> SystemIO
pub fn allow_write(self) -> SystemIO
Allow write
syscalls.
sourcepub fn allow_open(self) -> YesReally<SystemIO>
pub fn allow_open(self) -> YesReally<SystemIO>
sourcepub fn allow_open_readonly(self) -> SystemIO
pub fn allow_open_readonly(self) -> SystemIO
Allow open
syscalls but not with write flags.
Note that the openat2
syscall (which is not exposed by glibc anyway according to the
syscall manpage, and so probably isn’t very common) is not supported here because it has a
separate configuration struct instead of a flag bitset.
sourcepub fn allow_metadata(self) -> SystemIO
pub fn allow_metadata(self) -> SystemIO
Allow stat
syscalls.
sourcepub fn allow_ioctl(self) -> SystemIO
pub fn allow_ioctl(self) -> SystemIO
Allow ioctl
and fcntl
syscalls.
sourcepub fn allow_close(self) -> SystemIO
pub fn allow_close(self) -> SystemIO
Allow close
syscalls.
sourcepub fn allow_stdin(self) -> SystemIO
pub fn allow_stdin(self) -> SystemIO
Allow reading from stdin
sourcepub fn allow_stdout(self) -> SystemIO
pub fn allow_stdout(self) -> SystemIO
Allow writing to stdout
sourcepub fn allow_stderr(self) -> SystemIO
pub fn allow_stderr(self) -> SystemIO
Allow writing to stderr
sourcepub fn allow_file_read(self, file: &File) -> SystemIO
pub fn allow_file_read(self, file: &File) -> SystemIO
Allow reading a given open File. Note that with just this function, you will not be able to close the file under this context.
Security considerations
If another file or socket is opened after the file provided to this function is closed, it’s possible that the fd will be reused and therefore may be read from.
sourcepub fn allow_file_write(self, file: &File) -> SystemIO
pub fn allow_file_write(self, file: &File) -> SystemIO
Allow writing to a given open File. Note that with just this, you will not be able to close the file under this context.
Security considerations
If another file or socket is opened after the file provided to this function is closed, it’s possible that the fd will be reused and therefore may be written to.
Trait Implementations
sourceimpl RuleSet for SystemIO
impl RuleSet for SystemIO
sourcefn simple_rules(&self) -> Vec<Sysno>
fn simple_rules(&self) -> Vec<Sysno>
A simple rule is one that just allows the syscall without restriction.
Auto Trait Implementations
impl RefUnwindSafe for SystemIO
impl Send for SystemIO
impl Sync for SystemIO
impl Unpin for SystemIO
impl UnwindSafe for SystemIO
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more