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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250617063236.GI8289@sol>
Date: Mon, 16 Jun 2025 23:32:36 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Ian Rogers <irogers@...gle.com>, Yuzhuo Jing <yuzhuo@...gle.com>,
	Andy Lutomirski <luto@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Vincenzo Frascino <vincenzo.frascino@....com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	"Jason A. Donenfeld" <Jason@...c4.com>,
	linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v1 1/3] vdso: Switch get/put unaligned from packed struct
 to memcpy

On Tue, Jun 17, 2025 at 07:22:57AM +0200, Christophe Leroy wrote:
> 
> 
> Le 17/06/2025 à 02:57, Ian Rogers a écrit :
> > Type punning is necessary for get/put unaligned but the use of a
> > packed struct violates strict aliasing rules, requiring
> > -fno-strict-aliasing to be passed to the C compiler. Switch to using
> > memcpy so that -fno-strict-aliasing isn't necessary.
> 
> VDSO build fails with this patch:
> 
>   VDSO32L arch/powerpc/kernel/vdso/vdso32.so.dbg
> arch/powerpc/kernel/vdso/vdso32.so.dbg: dynamic relocations are not
> supported
> make[2]: *** [arch/powerpc/kernel/vdso/Makefile:79:
> arch/powerpc/kernel/vdso/vdso32.so.dbg] Error 1
> 
> Behind the relocation issue, calling memcpy() for a single 4-bytes word
> kills performance.

memcpy() does normally do the right thing for unaligned accesses of 1, 2, 4, or
8-byte values.  The snag here seems to be that the VDSO is built with
-fno-builtin (and -ffreestanding which implies -fno-builtin).  That causes the
compiler to no longer optimize out the calls to memcpy().  If __builtin_memcpy()
is used instead of memcpy(), it does work and generates the same code as before.

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ