Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bind-mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include "utils.h"
#include "bind-mount.h"

/* MS_NOSYMFOLLOW was added in Linux 5.10 */
#ifndef MS_NOSYMFOLLOW
#define MS_NOSYMFOLLOW 256
#endif

static char *
skip_token (char *line, bool eat_whitespace)
{
Expand Down Expand Up @@ -93,6 +98,7 @@ decode_mountoptions (const char *options)
{ MS_NOSUID, "nosuid" },
{ MS_NODEV, "nodev" },
{ MS_NOEXEC, "noexec" },
{ MS_NOSYMFOLLOW, "nosymfollow" },
{ MS_NOATIME, "noatime" },
{ MS_NODIRATIME, "nodiratime" },
{ MS_RELATIME, "relatime" },
Expand Down
6 changes: 6 additions & 0 deletions tests/test-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ else
fi
ok "--symlink doesn't overwrite a conflicting symlink"

# A nosymfollow source must stay nosymfollow across the fixup remount
if unshare -rm sh -c 'mount -t tmpfs -o nosymfollow tmpfs /tmp && : >/tmp/x && ln -s x /tmp/l && '"$BWRAP"' --ro-bind / / cat /tmp/l' 2>/dev/null; then
assert_not_reached "nosymfollow dropped by bind fixup; symlink was followed"
fi
ok "bind mount preserves nosymfollow"

# Test devices
$RUN --unshare-pid --dev /dev ls -al /dev/{stdin,stdout,stderr,null,random,urandom,fd,core} >/dev/null
ok "all expected devices were created"
Expand Down