[PATCH 3/4] Add AT_PATHSTATIC to linkat()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux