Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110101129
D46267.id141976.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D46267.id141976.diff
View Options
diff --git a/bin/ln/symlink.7 b/bin/ln/symlink.7
--- a/bin/ln/symlink.7
+++ b/bin/ln/symlink.7
@@ -144,6 +144,7 @@
.Dv AT_SYMLINK_NOFOLLOW
flag:
.Xr chflagsat 2 ,
+.Xr faccessat 2 ,
.Xr fchmodat 2 ,
.Xr fchownat 2 ,
.Xr fstatat 2
diff --git a/lib/libsys/access.2 b/lib/libsys/access.2
--- a/lib/libsys/access.2
+++ b/lib/libsys/access.2
@@ -154,6 +154,10 @@
is equal to
.Dv AT_FDCWD ,
operate on the current working directory.
+.It Dv AT_SYMLINK_NOFOLLOW
+If
+.Fa path
+names a symbolic link, access of the symbolic link is evaluated.
.El
.Pp
Even if a process's real or effective user has appropriate privileges
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -636,8 +636,7 @@
{
int flags, unsupported;
- /* XXX. AT_SYMLINK_NOFOLLOW is not supported by kern_accessat */
- unsupported = args->flags & ~(LINUX_AT_EACCESS | LINUX_AT_EMPTY_PATH);
+ unsupported = args->flags & ~(LINUX_AT_EACCESS | LINUX_AT_EMPTY_PATH | LINUX_AT_SYMLINK_NOFOLLOW);
if (unsupported != 0) {
linux_msg(td, "faccessat2 unsupported flag 0x%x", unsupported);
return (EINVAL);
@@ -647,6 +646,8 @@
AT_EACCESS;
flags |= (args->flags & LINUX_AT_EMPTY_PATH) == 0 ? 0 :
AT_EMPTY_PATH;
+ flags |= (args->flags & LINUX_AT_SYMLINK_NOFOLLOW) == 0 ? 0 :
+ AT_SYMLINK_NOFOLLOW;
return (linux_do_accessat(td, args->dfd, args->filename, args->amode,
flags));
}
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -43,6 +43,7 @@
#ifdef COMPAT_FREEBSD11
#include <sys/abi_compat.h>
#endif
+
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/capsicum.h>
@@ -2151,8 +2152,9 @@
struct nameidata nd;
int error;
- if ((flag & ~(AT_EACCESS | AT_RESOLVE_BENEATH | AT_EMPTY_PATH)) != 0)
+ if ((flag & ~(AT_EACCESS | AT_RESOLVE_BENEATH | AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW)) != 0) {
return (EINVAL);
+ }
if (amode != F_OK && (amode & ~(R_OK | W_OK | X_OK)) != 0)
return (EINVAL);
@@ -2171,8 +2173,8 @@
} else
usecred = cred;
AUDIT_ARG_VALUE(amode);
- NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF |
- AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH |
+ NDINIT_ATRIGHTS(&nd, LOOKUP, LOCKSHARED | LOCKLEAF |
+ AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH | AT_SYMLINK_NOFOLLOW |
AT_EMPTY_PATH), pathseg, path, fd, &cap_fstat_rights);
if ((error = namei(&nd)) != 0)
goto out;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 14, 3:21 PM (21 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16644334
Default Alt Text
D46267.id141976.diff (2 KB)
Attached To
Mode
D46267: faccessat(2): Honor AT_SYMLINK_NOFOLLOW
Attached
Detach File
Event Timeline
Log In to Comment