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

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
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)
> _at__at_ -582,7 +582,7 _at__at_ 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
Received on Sun Mar 30 2014 - 08:36:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:48 UTC