vhost_user_fs: Add the WRITE_KILL_PRIV write flag.

Add the WRITE_KILL_PRIV write flag, corresponding to
FUSE_WRITE_KILL_PRIV introduced in 7.31, and use to only remove the
setuid and setgid bits (by switching credentials) conditionally.

Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
Sergio Lopez
2020-04-16 13:40:04 +02:00
committed by Rob Bradford
parent 0870028fde
commit b7faf4fdc1
4 changed files with 16 additions and 6 deletions
+4 -3
View File
@@ -682,11 +682,11 @@ pub trait FileSystem {
/// implementation did not return a `Handle` from `open` then the contents of `handle` are
/// undefined.
///
/// If the `FsOptions::HANDLE_KILLPRIV` feature is not enabled then then the file system is
/// expected to clear the setuid and setgid bits.
///
/// If `delayed_write` is true then it indicates that this is a write for buffered data.
///
/// If `kill_priv` is true then it indicates that the file system is expected to clear the
/// setuid and setgid bits.
///
/// This method should return exactly the number of bytes requested by the kernel, except in the
/// case of error. An exception to this rule is if the file was opened with the "direct I/O"
/// option (`libc::O_DIRECT`), in which case the kernel will forward the return code from this
@@ -702,6 +702,7 @@ pub trait FileSystem {
offset: u64,
lock_owner: Option<u64>,
delayed_write: bool,
kill_priv: bool,
flags: u32,
) -> io::Result<usize> {
Err(io::Error::from_raw_os_error(libc::ENOSYS))