From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Ian Rogers <irogers@google.com>,
Eric Biggers <ebiggers@google.com>,
Yuzhuo Jing <yuzhuo@google.com>,
Andy Lutomirski <luto@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 0/3] Switch get/put unaligned to use memcpy
Date: Wed, 18 Jun 2025 13:42:53 +0200 [thread overview]
Message-ID: <51bc73ca-3b1f-4f1a-b75b-7bdeffd7a395@csgroup.eu> (raw)
In-Reply-To: <20250617205320.1580946-1-irogers@google.com>
Le 17/06/2025 à 22:53, Ian Rogers a écrit :
> The existing type punning approach with packed structs requires
> -fno-strict-aliasing to be passed to the compiler for
> correctness. This is true in the kernel tree but not in the tools
> directory resulting in this suggested patch from Eric Biggers
> <ebiggers@google.com>:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Flkml%2F20250614044133.660848-2-ebiggers%40kernel.org%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cf05413010ecc40ad1bdf08ddade1316a%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638857904894967529%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=29QUBLnUowncZiTH4z74Ec1olUlX0OTYnUNGDvWxX1o%3D&reserved=0
>
> Requiring -fno-strict-aliasing seems unfortunate and so this patch
> makes the unaligned code work via memcpy for type punning rather than
> the packed attribute.
>
> v2: switch memcpy to __builtin_memcpy to avoid potential/disallowed
> memcpy calls in vdso caused by -fno-builtin. Reported by
> Christophe Leroy <christophe.leroy@csgroup.eu>:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Flkml%2Fc57de5bf-d55c-48c5-9dfa-e2fb844dafe9%40csgroup.eu%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cf05413010ecc40ad1bdf08ddade1316a%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638857904894985987%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=l1LJP3XPKVuhDpiHxxkfWBiNPMYaBT9YXGBFzs6wLpY%3D&reserved=0
>
Does this new version also fixes the failures reported by the robots:
- arm64-randconfig with clang 21
- i386-randconfig with gcc 12
Christophe
> Ian Rogers (3):
> vdso: Switch get/put unaligned from packed struct to memcpy
> tools headers: Update the linux/unaligned.h copy with the kernel
> sources
> tools headers: Remove unneeded ignoring of warnings in unaligned.h
>
> include/vdso/unaligned.h | 48 ++++++++++++++++++++++++++++-----
> tools/include/linux/unaligned.h | 4 ---
> tools/include/vdso/unaligned.h | 48 ++++++++++++++++++++++++++++-----
> 3 files changed, 84 insertions(+), 16 deletions(-)
>
next prev parent reply other threads:[~2025-06-18 11:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 20:53 [PATCH v2 0/3] Switch get/put unaligned to use memcpy Ian Rogers
2025-06-17 20:53 ` [PATCH v2 1/3] vdso: Switch get/put unaligned from packed struct to memcpy Ian Rogers
2025-06-18 11:40 ` Christophe Leroy
2025-06-18 13:14 ` kernel test robot
2025-06-20 13:34 ` David Laight
2025-06-17 20:53 ` [PATCH v2 2/3] tools headers: Update the linux/unaligned.h copy with the kernel sources Ian Rogers
2025-06-17 20:53 ` [PATCH v2 3/3] tools headers: Remove unneeded ignoring of warnings in unaligned.h Ian Rogers
2025-06-18 11:42 ` Christophe Leroy [this message]
2025-06-25 18:06 ` [PATCH v2 0/3] Switch get/put unaligned to use memcpy Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51bc73ca-3b1f-4f1a-b75b-7bdeffd7a395@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=Jason@zx2c4.com \
--cc=acme@redhat.com \
--cc=ebiggers@google.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=luto@kernel.org \
--cc=tglx@linutronix.de \
--cc=vincenzo.frascino@arm.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yuzhuo@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).