Skip to content

Commit

Permalink
libsandbox: always permit access to '/memfd:'
Browse files Browse the repository at this point in the history
For memfd objects, the kernel populates the target for symlinks under
/proc/$PID/fd as "/memfd:name". Said target does not actually exist.

It is unfortunate that the kernel includes the leading slash, but we
will just have to work around it.

Bug: https://bugs.gentoo.org/910561
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
  • Loading branch information
floppym committed Jul 31, 2023
1 parent 6a6a6a6 commit 27232d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libsandbox/libsandbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,12 @@ static int check_access(sbcontext_t *sbcontext, int sb_nr, const char *func,
/* Fall in a read/write denied path, Deny Access */
goto out;

if (!strncmp(resolv_path, "/memfd:", strlen("/memfd:"))) {
/* Allow operations on memfd objects #910561 */
result = 1;
goto out;
}

if (!sym_func) {
retval = check_prefixes(sbcontext->deny_prefixes,
sbcontext->num_deny_prefixes, resolv_path);
Expand Down

0 comments on commit 27232d5

Please sign in to comment.