4.5.10 on AIX 7.1 [possible solution]

Albert Chin samba-technical at mlists.thewrittenword.com
Mon May 29 18:26:52 UTC 2017


On Mon, May 29, 2017 at 12:55:05PM -0500, Albert Chin via samba-technical wrote:
> Digging deeper:
>   $ cd /opt/build/samba-4.5.10/bin/default/source3/lib/unix_msg
>   ./unix_msg_test.inst
>   sending a 0-length message
>   zsh: segmentation fault (core dumped)  ./unix_msg_test.inst
> 
>   $ dbx unix_msg_test.inst core
>   (dbx) where
>   unnamed block in unix_dgram_send(ctx = 0x20009688, dst = 0x2ff217ec, iov = 0x2ff21308, iovlen = 1, fds = (nil), num_fds = 0), line 630 in "unix_msg.c"
>   unix_dgram_send(ctx = 0x20009688, dst = 0x2ff217ec, iov = 0x2ff21308, iovlen = 1, fds = (nil), num_fds = 0), line 630 in "unix_msg.c" unnamed block in unix_msg_send(ctx = 0x20009658, dst = 0x2ff217ec, iov = (nil), iovlen = 0, fds = (nil), num_fds = 0), line 816 in "unix_msg.c"
>   unix_msg_send(ctx = 0x20009658, dst = 0x2ff217ec, iov = (nil), iovlen = 0, fds = (nil), num_fds = 0), line 816 in "unix_msg.c"
>   main(), line 103 in "tests.c"
> 
> Works on RHEL and Solaris.

So, the problem seems to be the following code in
source3/lib/unix_msg.c:
	fdlen = msghdr_prep_fds(&msg, NULL, 0, fds, num_fds);
	if (fdlen == -1) {
		return EINVAL;
	}

	{
		uint8_t buf[fdlen];
		msghdr_prep_fds(&msg, buf, fdlen, fds, num_fds);

		ret = sendmsg(ctx->sock, &msg, 0);
	}

AIX doesn't like 0-length arrays. If I modify:
		uint8_t buf[fdlen];
to:
		uint8_t buf[fdlen+1];
then things seem to work. Need to do some further testing.

So, what is the best wa to fix this?

-- 
albert chin (china at thewrittenword.com)



More information about the samba-technical mailing list