svn commit: r347928 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Alexander Motin mav at FreeBSD.org
Fri May 17 16:41:19 UTC 2019


Author: mav
Date: Fri May 17 16:41:18 2019
New Revision: 347928
URL: https://svnweb.freebsd.org/changeset/base/347928

Log:
  MFC r346390: Change the way FreeBSD GID inheritance is hacked.
  
  I believe previous ifdef caused NULL dereference in later zfs_log_create()
  on attempt to create file inside directory belonging to ephemeral group
  created on illumos, trying to write to log information about GID domain
  of the newly created file, inheriting the ephemeral GID.
  
  This patch reuses original illumos SGID code with exception that due to
  lack of ID mapping code on FreeBSD ephemeral GID will turn into GID_NOBODY
  by another ifdef inside zfs_fuid_map_id().
  
  Sponsored by:	iXsystems, Inc.

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
==============================================================================
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c	Fri May 17 15:52:17 2019	(r347927)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c	Fri May 17 16:41:18 2019	(r347928)
@@ -1655,7 +1655,9 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va
 				acl_ids->z_fgid = 0;
 		}
 		if (acl_ids->z_fgid == 0) {
+#ifndef __FreeBSD_kernel__
 			if (dzp->z_mode & S_ISGID) {
+#endif
 				char		*domain;
 				uint32_t	rid;
 
@@ -1674,15 +1676,13 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va
 					    FUID_INDEX(acl_ids->z_fgid),
 					    acl_ids->z_fgid, ZFS_GROUP);
 				}
+#ifndef __FreeBSD_kernel__
 			} else {
 				acl_ids->z_fgid = zfs_fuid_create_cred(zfsvfs,
 				    ZFS_GROUP, cr, &acl_ids->z_fuidp);
-#ifdef __FreeBSD_kernel__
-				gid = acl_ids->z_fgid = dzp->z_gid;
-#else
 				gid = crgetgid(cr);
-#endif
 			}
+#endif
 		}
 	}
 


More information about the svn-src-all mailing list