lkml.org 
[lkml]   [2020]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/1] samples/seccomp: eliminate two compile warnings in user-trap.c
On Wed, Sep 02, 2020 at 09:33:06AM +0800, Leizhen (ThunderTown) wrote:
> On 2020/9/1 16:39, Zhen Lei wrote:
> > samples/seccomp/user-trap.c is compiled with $(userccflags), and the
> > latter does not contain -fno-strict-aliasing, so the warnings reported as
> > below. Due to add "userccflags += -fno-strict-aliasing" will impact other
> > files, so use __attribute__((__may_alias__)) to suppress it exactly.
> >
> > My gcc version is 5.5.0 20171010.
> >
> > ----------
> > samples/seccomp/user-trap.c: In function ‘send_fd’:
> > samples/seccomp/user-trap.c:50:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
> > *((int *)CMSG_DATA(cmsg)) = fd;
> > ^
> > samples/seccomp/user-trap.c: In function ‘recv_fd’:
> > samples/seccomp/user-trap.c:83:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
> > return *((int *)CMSG_DATA(cmsg));
> > ^
>
> Doesn't anyone care about this? Or is it that everyone hasn't encountered this problem?
> Why do these two warnings occur every time I compiled?

Hi!

I think the samples have been a bit ignored lately because they have a
lot of weird build issues with regard to native vs compat and needing
the kernel headers to be built first, etc.

That said, yes, I'd like to fix warnings. However, I can't reproduce
this. How are you building? I tried x86_64 and cross-compiled to i386.

--
Kees Cook

\
 
 \ /
  Last update: 2020-09-09 01:43    [W:0.055 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site