Skip to content

Commit 79aa284

Browse files
dhowellsbrauner
authored andcommitted
cachefiles: Allow the cache to be non-root
Set mode 0600 on files in the cache so that cachefilesd can run as an unprivileged user rather than leaving the files all with 0. Directories are already set to 0700. Userspace then needs to set the uid and gid before issuing the "bind" command and the cache must've been chown'd to those IDs. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> cc: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-erofs@lists.ozlabs.org cc: linux-fsdevel@vger.kernel.org Message-Id: <1853230.1684516880@warthog.procyon.org.uk> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 26e293f commit 79aa284

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/cachefiles/namei.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ struct file *cachefiles_create_tmpfile(struct cachefiles_object *object)
451451

452452
ret = cachefiles_inject_write_error();
453453
if (ret == 0) {
454-
file = vfs_tmpfile_open(&nop_mnt_idmap, &parentpath, S_IFREG,
454+
file = vfs_tmpfile_open(&nop_mnt_idmap, &parentpath,
455+
S_IFREG | 0600,
455456
O_RDWR | O_LARGEFILE | O_DIRECT,
456457
cache->cache_cred);
457458
ret = PTR_ERR_OR_ZERO(file);

0 commit comments

Comments
 (0)