Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Oct 2017 18:53:21 +0000 (UTC)
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324635 - head/sys/kern
Message-ID:  <201710151853.v9FIrLqR064063@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710151853.v9FIrLqR064063>