From owner-svn-src-head@FreeBSD.ORG Tue Nov 30 21:04:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9C5A106564A; Tue, 30 Nov 2010 21:04:05 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97E088FC0C; Tue, 30 Nov 2010 21:04:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAUL45lK034095; Tue, 30 Nov 2010 21:04:05 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAUL45KN034093; Tue, 30 Nov 2010 21:04:05 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201011302104.oAUL45KN034093@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 30 Nov 2010 21:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216084 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Nov 2010 21:04:05 -0000 Author: trasz Date: Tue Nov 30 21:04:05 2010 New Revision: 216084 URL: http://svn.freebsd.org/changeset/base/216084 Log: Don't panic when we read an empty ACL from ZFS. Apparently this may happen with filesystems created under MacOS X ZFS port. This is kind of filesystem corruption (we don't allow for setting empty ACLs), so make acl_get_file(3) and related syscalls fail with EINVAL in that case. In theory, we could return empty ACL to userland, but I'm afraid this would break some code. MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c Tue Nov 30 20:54:14 2010 (r216083) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c Tue Nov 30 21:04:05 2010 (r216084) @@ -105,7 +105,10 @@ acl_from_aces(struct acl *aclp, const ac struct acl_entry *entry; const ace_t *ace; - KASSERT(nentries >= 1, ("empty ZFS ACL")); + if (nentries < 1) { + printf("acl_from_aces: empty ZFS ACL; returning EINVAL.\n"); + return (EINVAL); + } if (nentries > ACL_MAX_ENTRIES) { /*