All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: 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>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	 "Jason A. Donenfeld" <Jason@zx2c4.com>,
	linux-kernel@vger.kernel.org,  linux-perf-users@vger.kernel.org
Cc: Ian Rogers <irogers@google.com>
Subject: [PATCH v1 0/3] Switch get/put unaligned to use memcpy
Date: Mon, 16 Jun 2025 17:57:57 -0700	[thread overview]
Message-ID: <20250617005800.1410112-1-irogers@google.com> (raw)

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://lore.kernel.org/lkml/20250614044133.660848-2-ebiggers@kernel.org/

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.

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(-)

-- 
2.50.0.rc2.692.g299adb8693-goog


             reply	other threads:[~2025-06-17  0:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  0:57 Ian Rogers [this message]
2025-06-17  0:57 ` [PATCH v1 1/3] vdso: Switch get/put unaligned from packed struct to memcpy Ian Rogers
2025-06-17  5:22   ` Christophe Leroy
2025-06-17  6:32     ` Eric Biggers
2025-06-17  9:13       ` Christophe Leroy
2025-06-17 17:21   ` kernel test robot
2025-06-17 18:55   ` kernel test robot
2025-06-17  0:57 ` [PATCH v1 2/3] tools headers: Update the linux/unaligned.h copy with the kernel sources Ian Rogers
2025-06-17  0:58 ` [PATCH v1 3/3] tools headers: Remove unneeded ignoring of warnings in unaligned.h 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=20250617005800.1410112-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=Jason@zx2c4.com \
    --cc=acme@redhat.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=ebiggers@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.