Skip to content

Commit

Permalink
lsm: harden read_file_at()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 26, 2021
1 parent 78a14d8 commit d81eb91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lxc/lsm/apparmor.c
Expand Up @@ -447,7 +447,7 @@ static char *apparmor_process_label_get_at(struct lsm_ops *ops, int fd_pid)
__do_free char *label = NULL;
size_t len;

label = read_file_at(fd_pid, "attr/current", PROTECT_OPEN, 0);
label = read_file_at(fd_pid, "attr/current", PROTECT_OPEN, PROTECT_LOOKUP_BENEATH);
if (!label)
return log_error_errno(NULL, errno, "Failed to get AppArmor context");

Expand Down
2 changes: 1 addition & 1 deletion src/lxc/lsm/selinux.c
Expand Up @@ -57,7 +57,7 @@ static char *selinux_process_label_get_at(struct lsm_ops *ops, int fd_pid)
__do_free char *label = NULL;
size_t len;

label = read_file_at(fd_pid, "attr/current", PROTECT_OPEN, 0);
label = read_file_at(fd_pid, "attr/current", PROTECT_OPEN, PROTECT_LOOKUP_BENEATH);
if (!label)
return log_error_errno(NULL, errno, "Failed to get SELinux context");

Expand Down

0 comments on commit d81eb91

Please sign in to comment.