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)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to