This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
Tags: google/capsicum-linux
Tags
capsicum: add syscalls to limit FD rights Add the cap_rights_get(2) and cap_rights_set(2) syscalls to allow retrieval and modification of the rights associated with a file descriptor. When a normal file descriptor has its rights restricted in any way, it becomes a Capsicum capability file descriptor. This is a wrapper struct file that is installed in the fdtable in place of the original file. From this point on, when the FD is converted to a struct file by fget() (or equivalent), the wrapper is checked for the appropriate rights and the wrapped inner normal file is returned. When a Capsicum capability file descriptor has its rights restricted further (they cannot be expanded), a new wrapper is created with the restricted rights, also wrapping the same inner normal file. In other words, the .underlying field in a struct capsicum_capability is always a normal file, never another Capsicum capability file. These syscalls specify the different components of the compound rights structure separately, allowing components to be unspecified for no change. Note that in FreeBSD 10.x the function of this pair of syscalls is implemented as 3 distinct pairs of syscalls, one pair for each component of the compound rights (primary/fcntl/ioctl). Signed-off-by: David Drysdale <[email protected]>