From owner-freebsd-current@FreeBSD.ORG Sun Mar 30 10:36:17 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 5FDC5732; Sun, 30 Mar 2014 10:36:17 +0000 (UTC) Date: Sun, 30 Mar 2014 10:36:17 +0000 From: Alexey Dokuchaev To: Jilles Tjoelker Subject: Re: r263096 sparc64: casperd: Unable to receive message from client: Cannot allocate memory. Message-ID: <20140330103617.GA19088@FreeBSD.org> References: <201403131214.s2DCEsvW084517@mech-cluster241.men.bris.ac.uk> <20140314135442.GC5792@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140314135442.GC5792@stack.nl> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: Anton Shterenlikht , freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 30 Mar 2014 10:36:17 -0000 On Fri, Mar 14, 2014 at 02:54:43PM +0100, Jilles Tjoelker wrote: > On Thu, Mar 13, 2014 at 05:14:56AM -0700, Anton Shterenlikht wrote: > > Mar 13 12:08:48 casperd[1313]: [ERROR] (casperd) Unable to receive message from client: Cannot allocate memory. > > Mar 13 12:08:50 last message repeated 2 times > > Mar 13 12:09:57 casperd[1313]: [ERROR] (casperd) Unable to receive message from client: Cannot allocate memory. I'm seeing this as well on fresh -CURRENT/powerpc when trying to ping(8) something with casperd(8) enabled; albeit a bit different (s/Cannot allocate memory/Invalid argument/). > It looks like a bug causes the "big endian" flag to be lost. As a > result, the bits are interpreted as little endian and an extremely large > allocation is attempted. Try this patch: > > Index: lib/libnv/nvlist.c > =================================================================== > --- lib/libnv/nvlist.c (revision 262358) > +++ lib/libnv/nvlist.c (working copy) > @@ -582,7 +582,7 @@ nvlist_check_header(struct nvlist_header *nvlhdrp) > errno = EINVAL; > return (false); > } > - if ((nvlhdrp->nvlh_flags &= ~NV_FLAG_ALL_MASK) != 0) { > + if ((nvlhdrp->nvlh_flags & ~NV_FLAG_ALL_MASK) != 0) { > errno = EINVAL; > return (false); > } This patch alone (without touching lib/libnv/msgio.c) fixed it for me (applied, rebuilt/reinstalled libnv, restared casperd(8)), thank you! :) ./danfe