r263096 sparc64: casperd: Unable to receive message from client: Cannot allocate memory.

Alexey Dokuchaev danfe at FreeBSD.org
Sun Mar 30 10:36:17 UTC 2014


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


More information about the freebsd-current mailing list