lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZcqmZdZ6x5w54nTI@tycho.pizza>
Date: Mon, 12 Feb 2024 16:14:45 -0700
From: Tycho Andersen <tycho@...ho.pizza>
To: Kees Cook <keescook@...omium.org>
Cc: Arnd Bergmann <arnd@...nel.org>, Arnd Bergmann <arnd@...db.de>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] samples: user-trap: fix strict-aliasing warning

On Mon, Feb 12, 2024 at 10:42:27AM -0800, Kees Cook wrote:
> On Mon, 12 Feb 2024 12:17:31 +0100, Arnd Bergmann wrote:
> > I started getting warnings for this one file, though I can't see what changed
> > since it was originally introduced in commit fec7b6690541 ("samples: add an
> > example of seccomp user trap").
> > 
> > samples/seccomp/user-trap.c: In function 'send_fd':
> > samples/seccomp/user-trap.c:50:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
> >    50 |         *((int *)CMSG_DATA(cmsg)) = fd;
> >       |          ~^~~~~~~~~~~~~~~~~~~~~~~
> > samples/seccomp/user-trap.c: In function 'recv_fd':
> > samples/seccomp/user-trap.c:83:18: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
> >    83 |         return *((int *)CMSG_DATA(cmsg));
> >       |                 ~^~~~~~~~~~~~~~~~~~~~~~~
> > 
> > [...]
> 
> Applied to for-next/seccomp, thanks!
> 
> [1/1] samples: user-trap: fix strict-aliasing warning
>       https://git.kernel.org/kees/c/9ad28ca5238d
> 
> Take care,

If you happen to update the trailers, looks good to me too:

Acked-by: Tycho Andersen <tandersen@...flix.com>

I also don't understand what changed, or why this really fixes it.
We're still "violating" strict aliasing as far as I can tell, since we
just introduce `int *fd_ptr` insted of memcpy()-ing out the fd into
an int?

But whatever shuts the compiler up works for me.

Tycho

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ