From: Alexander Mikhalitsyn Date: Mon, 5 May 2025 16:01:38 +0000 (+0200) Subject: lxc/conf: support nosymfollow mount flag X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e08794e063f46178bb2abe563d9e81d1a553161;p=thirdparty%2Flxc.git lxc/conf: support nosymfollow mount flag Signed-off-by: Alexander Mikhalitsyn --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index a01b0852d..9c95cd020 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -140,6 +140,7 @@ static struct mount_opt mount_opt[] = { { "noexec", 0, false, MOUNT_ATTR_NOEXEC, MS_NOEXEC }, { "norelatime", 1, false, MOUNT_ATTR_RELATIME, MS_RELATIME }, { "nostrictatime", 1, false, MOUNT_ATTR_STRICTATIME, MS_STRICTATIME }, + { "nosymfollow", 0, false, MOUNT_ATTR_NOSYMFOLLOW, MS_NOSYMFOLLOW }, { "nosuid", 0, false, MOUNT_ATTR_NOSUID, MS_NOSUID }, { "relatime", 0, false, MOUNT_ATTR_RELATIME, MS_RELATIME }, { "ro", 0, false, MOUNT_ATTR_RDONLY, MS_RDONLY }, diff --git a/src/lxc/macro.h b/src/lxc/macro.h index 58e3a7f25..ae984c1fe 100644 --- a/src/lxc/macro.h +++ b/src/lxc/macro.h @@ -626,6 +626,10 @@ enum { #define MS_REC 16384 #endif +#ifndef MS_NOSYMFOLLOW +#define MS_NOSYMFOLLOW 256 /* Do not follow symlinks */ +#endif + /* open */ #ifndef O_PATH #define O_PATH 010000000 diff --git a/src/lxc/mount_utils.h b/src/lxc/mount_utils.h index a76f7bd1f..d616b6e6d 100644 --- a/src/lxc/mount_utils.h +++ b/src/lxc/mount_utils.h @@ -176,6 +176,10 @@ struct lxc_rootfs; #define MOUNT_ATTR_IDMAP 0x00100000 #endif +#ifndef MOUNT_ATTR_NOSYMFOLLOW +#define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks */ +#endif + #if !HAVE_MOVE_MOUNT static inline int move_mount_lxc(int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname,