Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Switch get/put unaligned to use memcpy
@ 2025-06-17  0:57 Ian Rogers
  2025-06-17  0:57 ` [PATCH v1 1/3] vdso: Switch get/put unaligned from packed struct to memcpy Ian Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ian Rogers @ 2025-06-17  0:57 UTC (permalink / raw)
  To: Eric Biggers, Yuzhuo Jing, Andy Lutomirski, Thomas Gleixner,
	Vincenzo Frascino, Arnaldo Carvalho de Melo, Al Viro,
	Christophe Leroy, Jason A. Donenfeld, linux-kernel,
	linux-perf-users
  Cc: Ian Rogers

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-06-17 18:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17  0:57 [PATCH v1 0/3] Switch get/put unaligned to use memcpy Ian Rogers
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox