mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Rob Bradford
parent
0870028fde
commit
b7faf4fdc1
@@ -998,11 +998,15 @@ impl FileSystem for PassthroughFs {
|
||||
offset: u64,
|
||||
_lock_owner: Option<u64>,
|
||||
_delayed_write: bool,
|
||||
kill_priv: bool,
|
||||
_flags: u32,
|
||||
) -> io::Result<usize> {
|
||||
// We need to change credentials during a write so that the kernel will remove setuid or
|
||||
// setgid bits from the file if it was written to by someone other than the owner.
|
||||
let (_uid, _gid) = set_creds(ctx.uid, ctx.gid)?;
|
||||
if kill_priv {
|
||||
// We need to change credentials during a write so that the kernel will remove setuid
|
||||
// or setgid bits from the file if it was written to by someone other than the owner.
|
||||
let (_uid, _gid) = set_creds(ctx.uid, ctx.gid)?;
|
||||
}
|
||||
|
||||
let data = self
|
||||
.handles
|
||||
.read()
|
||||
|
||||
Reference in New Issue
Block a user