From: "Demi M. Obenour" <demiobenour@xxxxxxxxx> This has the same meaning as O_PATHSTATIC does in openat(), and has the same uses. --- fs/namei.c | 8 +++++++- include/uapi/linux/fcntl.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 4c90f265c103..b47f89af00f2 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4291,8 +4291,14 @@ int do_linkat(int olddfd, const char __user *oldname, int newdfd, how = LOOKUP_EMPTY; } - if (flags & AT_SYMLINK_FOLLOW) + if (flags & AT_SYMLINK_FOLLOW) { + if (flags & AT_PATHSTATIC) + return -EINVAL; how |= LOOKUP_FOLLOW; + } + + if (flags & AT_PATHSTATIC) + how |= LOOKUP_NEVER_FOLLOW; retry: error = user_path_at(olddfd, oldname, how, &old_path); if (error) diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h index 6448cdd9a350..a2f65635c8fc 100644 --- a/include/uapi/linux/fcntl.h +++ b/include/uapi/linux/fcntl.h @@ -89,6 +89,7 @@ #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ #define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ #define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ +#define AT_PATHSTATIC 0x8000 /* Do not follow symbolic links anywhere. */ #endif /* _UAPI_LINUX_FCNTL_H */ -- 2.20.1