Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Mar 2014 10:36:17 +0000
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        Anton Shterenlikht <mexas@bris.ac.uk>, freebsd-current@freebsd.org
Subject:   Re: r263096 sparc64: casperd: Unable to receive message from client: Cannot allocate memory.
Message-ID:  <20140330103617.GA19088@FreeBSD.org>
In-Reply-To: <20140314135442.GC5792@stack.nl>
References:  <201403131214.s2DCEsvW084517@mech-cluster241.men.bris.ac.uk> <20140314135442.GC5792@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140330103617.GA19088>