On 8/20/21 4:44 PM, Jeffle Xu wrote:
From: Miklos Szeredi <mszeredi(a)redhat.com>
commit 4a2abf99f9c2877039006b8dfb3ec4e0d1278fe8 upstream
In the FOPEN_DIRECT_IO case the write path doesn't call file_remove_privs()
and that means setuid bit is not cleared if unpriviliged user writes to a
file with setuid bit set.
pjdfstest chmod test 12.t tests this and fails.
Fix this by adding a flag to the FUSE_WRITE message that requests clearing
privileges on the given file. This needs
This better than just calling fuse_remove_privs(), because the attributes
may not be up to date, so in that case a write may miss clearing the
privileges.
Test case:
$ passthrough_ll /mnt/pasthrough-mnt -o default_permissions,allow_other,cache=never
$ mkdir /mnt/pasthrough-mnt/testdir
$ cd /mnt/pasthrough-mnt/testdir
$ prove -rv pjdfstests/tests/chmod/12.t
Reported-by: Vivek Goyal <vgoyal(a)redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi(a)redhat.com>
Tested-by: Vivek Goyal <vgoyal(a)redhat.com>
Signed-off-by: Jeffle Xu <jefflexu(a)linux.alibaba.com>
As discussed, it is used in virtiofsd.
Reviewed-by: Joseph Qi <joseph.qi(a)linux.alibaba.com>