From nobody@FreeBSD.org  Sat Apr 17 14:14:45 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C59F01065675
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Apr 2010 14:14:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id B406D8FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Apr 2010 14:14:45 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o3HEEjQW052462
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Apr 2010 14:14:45 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o3HEEjg8052461;
	Sat, 17 Apr 2010 14:14:45 GMT
	(envelope-from nobody)
Message-Id: <201004171414.o3HEEjg8052461@www.freebsd.org>
Date: Sat, 17 Apr 2010 14:14:45 GMT
From: Alistair Phipps <freebsd@alistairphipps.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: zfs: panic in zfs_fuid_map_id (known issue fixed in opensolaris)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         145778
>Category:       kern
>Synopsis:       [zfs] [panic] panic in zfs_fuid_map_id (known issue fixed in opensolaris)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-fs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 17 14:20:01 UTC 2010
>Closed-Date:    Wed Aug 11 14:37:08 UTC 2010
>Last-Modified:  Wed Sep 15 16:20:01 UTC 2010
>Originator:     Alistair Phipps
>Release:        8.0-STABLE
>Organization:
>Environment:
FreeBSD teabsd 8.0-STABLE FreeBSD 8.0-STABLE #1: Thu Apr 15 17:24:41 EDT 2010     root@teabsd:/usr/obj/usr/src/sys/TEABSD  i386

>Description:
Certain files on my zfs pool imported from Solaris cause a kernel panic when accessed, even just listing a directory.  The console says "panic: zfs_fuid_map_id".  I believe this issue is http://bugs.opensolaris.org/view_bug.do?bug_id=6746456 -- can this fix go into freebsd?
>How-To-Repeat:
With my zpool, I can reproduce the panic all the time by accessing a particular directory.  It also occurs when running a scrub.
>Fix:
http://bugs.opensolaris.org/view_bug.do?bug_id=6746456 -- not sure how to find source change for this

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Apr 17 14:57:21 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=145778 

From: Alistair Phipps <freebsd@alistairphipps.com>
To: bug-followup@FreeBSD.org, pjd@freebsd.org
Cc:  
Subject: Re: kern/145778: [zfs] [panic] panic in zfs_fuid_map_id (known issue 
	fixed in opensolaris)
Date: Sat, 8 May 2010 14:37:08 -0400

 The box is crashing nightly with this panic when running
 /etc/periodic/daily/450.status-security.
 
 I figured out how to get a crash dump and think I was too hasty in
 associating this with the opensolaris bug.   Here's the backtrace:
 
 #0  doadump () at pcpu.h:246
 #1  0x805b1447 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:416
 #2  0x805b1739 in panic (fmt=Variable "fmt" is not available.
 ) at /usr/src/sys/kern/kern_shutdown.c:579
 #3  0x84cd17ad in zfs_fuid_map_id (zfsvfs=0x86573000, fuid=4294967314,
     cr=0x86a6c980, type=ZFS_GROUP)
     at /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c:395
 #4  0x84cd181f in zfs_groupmember (zfsvfs=0x86573000, id=Unhandled
 dwarf expression opcode 0x93
 )
     at /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c:713
 #5  0x84ce1a9d in zfs_zaccess_common (zp=0x88033000, v4_mode=Variable
 "v4_mode" is not available.
 )
     at /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c:2292
 #6  0x84ce1dc7 in zfs_zaccess (zp=0x88033000, mode=128, flags=0, skipaclchk=0,
     cr=0x86a6c980)
     at /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c:2411
 #7  0x84cf6ab4 in zfs_freebsd_getattr (ap=0xd6ac7ac4)
     at /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:2356
 #8  0x80844ea2 in VOP_GETATTR_APV (vop=0x84d5aaa0, a=0xd6ac7ac4)
     at vnode_if.c:697
 #9  0x806490c9 in vn_stat (vp=0x879a5c90, sb=0xd6ac7afc,
     active_cred=0x86a6c980, file_cred=0x0, td=0x86ff4000) at vnode_if.h:309
 #10 0x806404ed in kern_statat_vnhook (td=0x86ff4000, flag=512, fd=-100,
     path=0x2824b6b8 <Address 0x2824b6b8 out of bounds>, pathseg=UIO_USERSPACE,
     sbp=0xd6ac7c18, hook=0) at /usr/src/sys/kern/vfs_syscalls.c:2358
 #11 0x8064062c in kern_statat (td=0x86ff4000, flag=512, fd=-100,
     path=0x2824b6b8 <Address 0x2824b6b8 out of bounds>, pathseg=UIO_USERSPACE,
     sbp=0xd6ac7c18) at /usr/src/sys/kern/vfs_syscalls.c:2336
 #12 0x80640666 in kern_lstat (td=0x86ff4000,
     path=0x2824b6b8 <Address 0x2824b6b8 out of bounds>, pathseg=UIO_USERSPACE,
     sbp=0xd6ac7c18) at /usr/src/sys/kern/vfs_syscalls.c:2409
 #13 0x8064070f in lstat (td=0x86ff4000, uap=0xd6ac7cf8)
     at /usr/src/sys/kern/vfs_syscalls.c:2399
 #14 0x8082fb93 in syscall (frame=0xd6ac7d38)
     at /usr/src/sys/i386/i386/trap.c:1111
 #15 0x80812390 in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:261
 #16 0x00000033 in ?? ()
 
 Here's the offending code:
 
 #ifdef TODO
         if (type == ZFS_OWNER || type == ZFS_ACE_USER) {
                 (void) kidmap_getuidbysid(crgetzone(cr), domain,
                     FUID_RID(fuid), &id);
         } else {
                 (void) kidmap_getgidbysid(crgetzone(cr), domain,
                     FUID_RID(fuid), &id);
         }
 #else
         panic(__func__);
 #endif
 
 The code in opensolaris doesn't have the ifdef TODO block:
 http://src.opensolaris.org/source/xref/systemz/sirius/usr/src/uts/common/fs/zfs/zfs_fuid.c
 
 Based on the function names, it *sounds* as if Windows/CIFS SIDs are
 stored instead of UIDs when a ZFS partition is accessed using the
 sharesmb functionality on OpenSolaris.  However, sharesmb appears to
 not be supported under FreeBSD (reports "unsupported share protocol:
 1") and it looks like FreeBSD has some unimplemented code where it
 will panic upon encountering files with associated SIDs set up on
 OpenSolaris (the TODO block above).
 
 Should this be listed on the ZFS known issues page
 (http://wiki.freebsd.org/ZFS)?  Is there a workaround for this, e.g.
 some way to strip the SIDs from my ZFS?  I don't have a need to
 preserve them.  If I change the panic line to return 0, will that make
 the offending files owned by root?
 
 Thanks for any help.

From: Alistair Phipps <freebsd@alistairphipps.com>
To: bug-followup@freebsd.org, pjd@freebsd.org
Cc:  
Subject: Re: kern/145778: [zfs] [panic] panic in zfs_fuid_map_id (known issue 
	fixed in opensolaris)
Date: Sat, 8 May 2010 19:40:22 -0400

 I tried changing the panic to a return (uid_t) 0; and it seems to have
 worked -- no more panic and I'm able to access my files.  This seems
 to be an acceptable workaround for others in the same situation.  I
 think the files now have uid/gid 0 (root:wheel) which could be a
 security risk on a multi-user system.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/145778: commit references a PR
Date: Thu, 22 Jul 2010 23:30:35 +0000 (UTC)

 Author: mm
 Date: Thu Jul 22 23:30:24 2010
 New Revision: 210398
 URL: http://svn.freebsd.org/changeset/base/210398
 
 Log:
   Enable fake resolving of SMB RIDs by using nulldomain and UID_NOBODY
   - fixes panics when Solaris/OpenSolaris pools that contain files
   uploaded with the SMB protocol are accessed
   
   Enable seting/unsetting the sharesmb property (dummy action)
   - allows users who import pools from Solaris/Opensolaris to unset
   the sharesmb property and get rid of annoying messages
   
   PR:		kern/145778, kern/148709
   Approved by:	pjd, delphij (mentor)
   MFC after:	7 weeks
 
 Modified:
   head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c
 
 Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
 ==============================================================================
 --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Thu Jul 22 23:23:39 2010	(r210397)
 +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Thu Jul 22 23:30:24 2010	(r210398)
 @@ -1265,7 +1265,6 @@ zfs_prop_set(zfs_handle_t *zhp, const ch
  	case ZFS_PROP_XATTR:
  	case ZFS_PROP_VSCAN:
  	case ZFS_PROP_NBMAND:
 -	case ZFS_PROP_SHARESMB:
  		(void) snprintf(errbuf, sizeof (errbuf),
  		    "property '%s' not supported on FreeBSD", propname);
  		ret = zfs_error(hdl, EZFS_PERM, errbuf);
 
 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c
 ==============================================================================
 --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c	Thu Jul 22 23:23:39 2010	(r210397)
 +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c	Thu Jul 22 23:30:24 2010	(r210398)
 @@ -410,7 +410,7 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64
  	domain = zfs_fuid_find_by_idx(zfsvfs, index);
  	ASSERT(domain != NULL);
  
 -#ifdef TODO
 +#ifdef sun
  	if (type == ZFS_OWNER || type == ZFS_ACE_USER) {
  		(void) kidmap_getuidbysid(crgetzone(cr), domain,
  		    FUID_RID(fuid), &id);
 @@ -418,9 +418,9 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64
  		(void) kidmap_getgidbysid(crgetzone(cr), domain,
  		    FUID_RID(fuid), &id);
  	}
 -#else
 -	panic(__func__);
 -#endif
 +#else	/* sun */
 +	id = UID_NOBODY;
 +#endif	/* sun */
  	return (id);
  }
  
 @@ -514,21 +514,21 @@ zfs_fuid_create_cred(zfsvfs_t *zfsvfs, z
  	if (!zfsvfs->z_use_fuids || !IS_EPHEMERAL(id))
  		return ((uint64_t)id);
  
 -#ifdef TODO
 +#ifdef sun
  	ksid = crgetsid(cr, (type == ZFS_OWNER) ? KSID_OWNER : KSID_GROUP);
  
  	VERIFY(ksid != NULL);
  	rid = ksid_getrid(ksid);
  	domain = ksid_getdomain(ksid);
 -
 +#else	/* sun */
 +	rid = UID_NOBODY;
 +	domain = nulldomain;
 +#endif	/* sun */
  	idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, B_TRUE);
  
  	zfs_fuid_node_add(fuidp, kdomain, rid, idx, id, type);
  
  	return (FUID_ENCODE(idx, rid));
 -#else
 -	panic(__func__);
 -#endif
  }
  
  /*
 @@ -597,7 +597,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64
  		};
  		domain = fuidp->z_domain_table[idx -1];
  	} else {
 -#ifdef TODO
 +#ifdef sun
  		if (type == ZFS_OWNER || type == ZFS_ACE_USER)
  			status = kidmap_getsidbyuid(crgetzone(cr), id,
  			    &domain, &rid);
 @@ -606,6 +606,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64
  			    &domain, &rid);
  
  		if (status != 0) {
 +#endif	/* sun */
  			/*
  			 * When returning nobody we will need to
  			 * make a dummy fuid table entry for logging
 @@ -613,10 +614,9 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64
  			 */
  			rid = UID_NOBODY;
  			domain = nulldomain;
 +#ifdef sun
  		}
 -#else
 -		panic(__func__);
 -#endif
 +#endif	/* sun */
  	}
  
  	idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, B_TRUE);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: jh 
State-Changed-When: Wed Aug 11 14:37:07 UTC 2010 
State-Changed-Why:  
Duplicate of kern/148709. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=145778 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/145778: commit references a PR
Date: Wed, 15 Sep 2010 16:10:50 +0000 (UTC)

 Author: mm
 Date: Wed Sep 15 16:10:38 2010
 New Revision: 212670
 URL: http://svn.freebsd.org/changeset/base/212670
 
 Log:
   MFC r210398:
   
   Enable fake resolving of SMB RIDs by using nulldomain and UID_NOBODY
   - fixes panics when Solaris/OpenSolaris pools that contain files
   uploaded with the SMB protocol are accessed
   
   Enable seting/unsetting the sharesmb property (dummy action)
   - allows users who import pools from Solaris/Opensolaris to unset
   the sharesmb property and get rid of annoying messages
   
   PR:		kern/145778, kern/148709
   Approved by:	pjd, delphij (mentor))
 
 Modified:
   stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
   stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c
 Directory Properties:
   stable/8/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/xen/xenpci/   (props changed)
 
 Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
 ==============================================================================
 --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Wed Sep 15 16:05:51 2010	(r212669)
 +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Wed Sep 15 16:10:38 2010	(r212670)
 @@ -1265,7 +1265,6 @@ zfs_prop_set(zfs_handle_t *zhp, const ch
  	case ZFS_PROP_XATTR:
  	case ZFS_PROP_VSCAN:
  	case ZFS_PROP_NBMAND:
 -	case ZFS_PROP_SHARESMB:
  		(void) snprintf(errbuf, sizeof (errbuf),
  		    "property '%s' not supported on FreeBSD", propname);
  		ret = zfs_error(hdl, EZFS_PERM, errbuf);
 
 Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c
 ==============================================================================
 --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c	Wed Sep 15 16:05:51 2010	(r212669)
 +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c	Wed Sep 15 16:10:38 2010	(r212670)
 @@ -410,7 +410,7 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64
  	domain = zfs_fuid_find_by_idx(zfsvfs, index);
  	ASSERT(domain != NULL);
  
 -#ifdef TODO
 +#ifdef sun
  	if (type == ZFS_OWNER || type == ZFS_ACE_USER) {
  		(void) kidmap_getuidbysid(crgetzone(cr), domain,
  		    FUID_RID(fuid), &id);
 @@ -418,9 +418,9 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64
  		(void) kidmap_getgidbysid(crgetzone(cr), domain,
  		    FUID_RID(fuid), &id);
  	}
 -#else
 -	panic(__func__);
 -#endif
 +#else	/* sun */
 +	id = UID_NOBODY;
 +#endif	/* sun */
  	return (id);
  }
  
 @@ -514,21 +514,21 @@ zfs_fuid_create_cred(zfsvfs_t *zfsvfs, z
  	if (!zfsvfs->z_use_fuids || !IS_EPHEMERAL(id))
  		return ((uint64_t)id);
  
 -#ifdef TODO
 +#ifdef sun
  	ksid = crgetsid(cr, (type == ZFS_OWNER) ? KSID_OWNER : KSID_GROUP);
  
  	VERIFY(ksid != NULL);
  	rid = ksid_getrid(ksid);
  	domain = ksid_getdomain(ksid);
 -
 +#else	/* sun */
 +	rid = UID_NOBODY;
 +	domain = nulldomain;
 +#endif	/* sun */
  	idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, B_TRUE);
  
  	zfs_fuid_node_add(fuidp, kdomain, rid, idx, id, type);
  
  	return (FUID_ENCODE(idx, rid));
 -#else
 -	panic(__func__);
 -#endif
  }
  
  /*
 @@ -597,7 +597,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64
  		};
  		domain = fuidp->z_domain_table[idx -1];
  	} else {
 -#ifdef TODO
 +#ifdef sun
  		if (type == ZFS_OWNER || type == ZFS_ACE_USER)
  			status = kidmap_getsidbyuid(crgetzone(cr), id,
  			    &domain, &rid);
 @@ -606,6 +606,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64
  			    &domain, &rid);
  
  		if (status != 0) {
 +#endif	/* sun */
  			/*
  			 * When returning nobody we will need to
  			 * make a dummy fuid table entry for logging
 @@ -613,10 +614,9 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64
  			 */
  			rid = UID_NOBODY;
  			domain = nulldomain;
 +#ifdef sun
  		}
 -#else
 -		panic(__func__);
 -#endif
 +#endif	/* sun */
  	}
  
  	idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, B_TRUE);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
