[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190212145450.2200-3-demiobenour@gmail.com>
Date: Tue, 12 Feb 2019 09:54:46 -0500
From: demiobenour@...il.com
To: Alexander Viro <viro@...iv.linux.org.uk>,
Jeff Layton <jlayton@...nel.org>,
"J. Bruce Fields" <bfields@...ldses.org>,
linux-fsdevel@...r.kernel.org (open list:FILESYSTEMS (VFS and
infrastructure)), linux-kernel@...r.kernel.org (open list)
Cc: "Demi M. Obenour" <demiobenour@...il.com>
Subject: [PATCH 3/4] Add AT_PATHSTATIC to linkat()
From: "Demi M. Obenour" <demiobenour@...il.com>
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
Powered by blists - more mailing lists