From owner-freebsd-current@FreeBSD.ORG Thu May 14 22:48:28 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2FB41065673 for ; Thu, 14 May 2009 22:48:28 +0000 (UTC) (envelope-from james-freebsd-current@jrv.org) Received: from mail.jrv.org (rrcs-24-73-246-106.sw.biz.rr.com [24.73.246.106]) by mx1.freebsd.org (Postfix) with ESMTP id 6B9938FC13 for ; Thu, 14 May 2009 22:48:28 +0000 (UTC) (envelope-from james-freebsd-current@jrv.org) Received: from kremvax.housenet.jrv (kremvax.housenet.jrv [192.168.3.124]) by mail.jrv.org (8.14.3/8.14.3) with ESMTP id n4EMSSUF094062; Thu, 14 May 2009 17:28:29 -0500 (CDT) (envelope-from james-freebsd-current@jrv.org) Authentication-Results: mail.jrv.org; domainkeys=pass (testing) header.from=james-freebsd-current@jrv.org DomainKey-Signature: a=rsa-sha1; s=enigma; d=jrv.org; c=nofws; q=dns; h=message-id:date:from:user-agent:mime-version:to:cc:subject: references:in-reply-to:content-type:content-transfer-encoding; b=A7cNHtrU1pPrYGXLvlbiygrGFAA+Z8A1HgmY3eKTLlg0iuyX4oYKnqWd6p/KdeXfy viLEX9Nj/lv4xVUXJisstcVjRu9obCYk+a9KMLLNb4kGgie/LiQhx0XFLT/HxrKzkc2 1jVlLol+dFpUNwPaNL3cx+18YSB7+7s4wU13JXo= Message-ID: <4A0C9B0C.4050403@jrv.org> Date: Thu, 14 May 2009 17:28:28 -0500 From: "James R. Van Artsdalen" User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Thomas Backman References: <08D1E6DF-89D3-4887-9234-C3DB9164D794@exscape.org> <20090514133017.362075dhcdy7o2bs@webmail.leidinger.net> <7CD27FF0-CBFA-48B7-9E18-763D8C3ED9B8@exscape.org> In-Reply-To: <7CD27FF0-CBFA-48B7-9E18-763D8C3ED9B8@exscape.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: zfs send -R segfault, anyone else? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:48:29 -0000 Thomas Backman wrote: > [root@chaos ~]# zfs send -R -I $OLD tank@$NOW > diff-snap > [root@chaos ~]# cat diff-snap | zfs recv -Fvd slave > Segmentation fault: 11 (core dumped) > > Same kinda backtrace, but what's up with strcmp()? > I suppose the issue stems from libzfs, and is not within libc: Different problem The SIGSEGV is happening in strcmp because it is called with strcmp(0,0) and tries to dereference address -4 (probably another bug itself). This hack gets around the issue but someone familiar with this needs to decide the correct action. The first change is actually unrelated (a sorry attempt at fixing the previous zfs send bug). The last change may be unnecessary as that case may never happen unless the pool can be renamed? Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c =================================================================== --- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c (revision 190917) +++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c (working copy) @@ -240,6 +240,8 @@ zfs_prop_t prop = zfs_name_to_prop(propname); nvlist_t *propnv; + if (prop == ZPROP_INVAL) + continue; if (!zfs_prop_user(propname) && zfs_prop_readonly(prop)) continue; @@ -1126,7 +1128,7 @@ uint64_t originguid = 0; uint64_t stream_originguid = 0; uint64_t parent_fromsnap_guid, stream_parent_fromsnap_guid; - char *fsname, *stream_fsname; + char *fsname, *stream_fsname, *p1, *p2; nextfselem = nvlist_next_nvpair(local_nv, fselem); @@ -1295,10 +1297,12 @@ "parentfromsnap", &stream_parent_fromsnap_guid)); /* check for rename */ + p1 = strrchr(fsname, '/'); + p2 = strrchr(stream_fsname, '/'); if ((stream_parent_fromsnap_guid != 0 && stream_parent_fromsnap_guid != parent_fromsnap_guid) || - strcmp(strrchr(fsname, '/'), - strrchr(stream_fsname, '/')) != 0) { + (p1 != NULL && p2 != NULL && strcmp (p1, p2) != 0) || + ((p1 == NULL) ^ (p2 == NULL))) { nvlist_t *parent; char tryname[ZFS_MAXNAMELEN]; @@ -1317,7 +1321,7 @@ VERIFY(0 == nvlist_lookup_string(parent, "name", &pname)); (void) snprintf(tryname, sizeof (tryname), - "%s%s", pname, strrchr(stream_fsname, '/')); + "%s%s", pname, p2 ? p2 : ""); } else { tryname[0] = '\0'; if (flags.verbose) {