fuse-overlayfs: honor mode for devices with xattr_permissions

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2023-10-30 18:07:11 +01:00
parent acfb6a27d1
commit 2d8613e7f5
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772

6
main.c
View File

@ -4914,6 +4914,7 @@ ovl_mknod (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev
struct fuse_entry_param e; struct fuse_entry_param e;
const struct fuse_ctx *ctx = fuse_req_ctx (req); const struct fuse_ctx *ctx = fuse_req_ctx (req);
char wd_tmp_file_name[32]; char wd_tmp_file_name[32];
mode_t backing_file_mode = mode | (lo->xattr_permissions ? 0755 : 0);
if (UNLIKELY (ovl_debug (req))) if (UNLIKELY (ovl_debug (req)))
fprintf (stderr, "ovl_mknod(ino=%" PRIu64 ", name=%s, mode=%d, rdev=%lu)\n", fprintf (stderr, "ovl_mknod(ino=%" PRIu64 ", name=%s, mode=%d, rdev=%lu)\n",
@ -4927,9 +4928,6 @@ ovl_mknod (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev
mode = mode & ~ctx->umask; mode = mode & ~ctx->umask;
if (lo->xattr_permissions)
mode |= 0755;
node = do_lookup_file (lo, parent, name); node = do_lookup_file (lo, parent, name);
if (node != NULL && ! node->whiteout) if (node != NULL && ! node->whiteout)
{ {
@ -4951,7 +4949,7 @@ ovl_mknod (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev
return; return;
} }
sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ()); sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ());
ret = mknodat (lo->workdir_fd, wd_tmp_file_name, mode, rdev); ret = mknodat (lo->workdir_fd, wd_tmp_file_name, backing_file_mode, rdev);
if (ret < 0) if (ret < 0)
{ {
fuse_reply_err (req, errno); fuse_reply_err (req, errno);