svn commit: r324635 - head/sys/kern
Tijl Coosemans
tijl at FreeBSD.org
Sun Oct 15 18:53:22 UTC 2017
Author: tijl
Date: Sun Oct 15 18:53:21 2017
New Revision: 324635
URL: https://svnweb.freebsd.org/changeset/base/324635
Log:
When a Linux program tries to access a /path the kernel tries
/compat/linux/path before /path. Stop following symbolic links when
looking up /compat/linux/path so dead symbolic links aren't ignored.
This allows syscalls like readlink(2) and lstat(2) to work on such links.
And open(2) will return an error now instead of trying /path.
Modified:
head/sys/kern/vfs_lookup.c
Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c Sun Oct 15 16:19:09 2017 (r324634)
+++ head/sys/kern/vfs_lookup.c Sun Oct 15 18:53:21 2017 (r324635)
@@ -1390,13 +1390,13 @@ kern_alternate_path(struct thread *td, const char *pre
for (cp = &ptr[len] - 1; *cp != '/'; cp--);
*cp = '\0';
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
+ NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td);
error = namei(&nd);
*cp = '/';
if (error != 0)
goto keeporig;
} else {
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
+ NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td);
error = namei(&nd);
if (error != 0)
More information about the svn-src-all
mailing list