Skip to content

Commit

Permalink
fixup! [LibOS] Move trusted and allowed files logic to LibOS
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
  • Loading branch information
Dmitrii Kuvaiskii committed Jul 29, 2024
1 parent d4c6f52 commit 52d1de2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libos/src/fs/chroot/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static int chroot_temp_open(struct libos_dentry* dent, PAL_HANDLE* out_palhdl) {
return ret;

if (!is_open_allowed(dent, PAL_ACCESS_RDONLY)) {
ret = -EPERM;
ret = -EACCES;
goto out;
}

Expand Down Expand Up @@ -422,7 +422,7 @@ static int chroot_open(struct libos_handle* hdl, struct libos_dentry* dent, int
assert(dent->inode);

if (!is_open_allowed(dent, LINUX_OPEN_FLAGS_TO_PAL_ACCESS(flags)))
return -EPERM;
return -EACCES;

return chroot_do_open(hdl, dent, dent->inode->type, flags, /*perm=*/0);
}
Expand Down Expand Up @@ -462,7 +462,7 @@ static int chroot_creat(struct libos_handle* hdl, struct libos_dentry* dent, int
goto out;

if (!is_create_allowed(uri)) {
ret = -EPERM;
ret = -EACCES;
goto out;
}

Expand Down Expand Up @@ -562,7 +562,7 @@ static ssize_t chroot_write(struct libos_handle* hdl, const void* buf, size_t co

if (is_trusted_from_inode_data(hdl->inode)) {
log_warning("Writing to a trusted file is disallowed!");
return -EPERM;
return -EACCES;
}

size_t actual_count = count;
Expand Down

0 comments on commit 52d1de2

Please sign in to comment.