[CRIU] Re: [PATCH 4/5] util-net: Fix strict aliasing problem on certain compilers

Cyrill Gorcunov gorcunov at openvz.org
Tue Jul 31 07:06:37 EDT 2012


On Tue, Jul 31, 2012 at 02:18:50PM +0400, Pavel Emelyanov wrote:
> On 07/31/2012 02:13 PM, Cyrill Gorcunov wrote:
> > On Tue, Jul 31, 2012 at 02:10:47PM +0400, Pavel Emelyanov wrote:
> >>>  	cmsg				= CMSG_FIRSTHDR(&fdset->hdr);
> >>> -	cmsg->cmsg_len			= fdset->hdr.msg_controllen;
> >>> -	cmsg->cmsg_level		= SOL_SOCKET;
> >>> -	cmsg->cmsg_type			= SCM_RIGHTS;
> >>
> >> Huh? How does the net/core/rtnetlink.c work then?! It uses such tricks all the way around!
> >>
> >>> +	from.cmsg_len			= fdset->hdr.msg_controllen;
> >>> +	from.cmsg_level			= SOL_SOCKET;
> >>> +	from.cmsg_type			= SCM_RIGHTS;
> >>> +
> >>> +	builtin_memcpy(cmsg, &from, sizeof(from));
> > 
> > I believe it depends on compiler version. On my F16 machine there is no such
> > problem, but only on the compiler 4.4.5.
> 
> Check this issue in kernel please.

Hehe, top-level Makefile has

KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
		   -fno-strict-aliasing -fno-common \
		   -Werror-implicit-function-declaration \
		   -Wno-format-security \
		   -fno-delete-null-pointer-checks

see -fno-strict-aliasing here which prevents from error messages.
Not sure if we should do the same though.

	Cyrill


More information about the CRIU mailing list