svn commit: r357671 - head/contrib/netbsd-tests/lib/libc/c063

Kyle Evans kevans at FreeBSD.org
Fri Feb 7 22:36:38 UTC 2020


Author: kevans
Date: Fri Feb  7 22:36:37 2020
New Revision: 357671
URL: https://svnweb.freebsd.org/changeset/base/357671

Log:
  O_SEARCH test: mark revokex an expected fail on NFS
  
  The revokex test does not work when the scratch directory is created on NFS.
  Given the nature of NFS, it likely can never work without looking like a
  security hole since O_SEARCH would rely on the server knowing that the
  directory did have +x at the time of open and that it's OK for it to have
  been revoked based on POSIX specification for O_SEARCH.
  
  This does mean that O_SEARCH is only partially functional on NFS in general,
  but I suspect the execute bit getting revoked in the process is likely not
  common.
  
  Reviewed by:	kib
  Differential Revision:	https://reviews.freebsd.org/D23573

Modified:
  head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c

Modified: head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c	Fri Feb  7 22:28:04 2020	(r357670)
+++ head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c	Fri Feb  7 22:36:37 2020	(r357671)
@@ -34,6 +34,11 @@ __RCSID("$NetBSD: t_o_search.c,v 1.9 2020/02/06 12:18:
 #include <atf-c.h>
 
 #include <sys/types.h>
+#ifdef __FreeBSD__
+#include <sys/mount.h>
+#else
+#include <sys/statvfs.h>
+#endif
 #include <sys/stat.h>
 
 #include <dirent.h>
@@ -322,6 +327,23 @@ ATF_TC_BODY(o_search_revokex, tc)
 
 	/* Drop permissions. The kernel must still not check the exec bit. */
 	ATF_REQUIRE(chmod(DIR, 0000) == 0);
+	{
+		const char *fstypename;
+#ifdef __FreeBSD__
+		struct statfs st;
+
+		fstatfs(dfd, &st);
+		fstypename = st.f_fstypename;
+#else
+		struct statvfs vst;
+
+		fstatvfs(dfd, &vst);
+		fstypename = vst.f_fstypename;
+#endif
+		if (strcmp(fstypename, "nfs") == 0)
+			atf_tc_expect_fail(
+			    "NFS protocol cannot observe O_SEARCH semantics");
+	}
 	ATF_REQUIRE(fstatat(dfd, BASEFILE, &sb, 0) == 0);
 
 	ATF_REQUIRE(close(dfd) == 0);


More information about the svn-src-all mailing list