[PATCH v1 0/3] Switch get/put unaligned to use memcpy

Ian Rogers posted 3 patches 3 months, 3 weeks ago
There is a newer version of this series
include/vdso/unaligned.h        | 48 ++++++++++++++++++++++++++++-----
tools/include/linux/unaligned.h |  4 ---
tools/include/vdso/unaligned.h  | 48 ++++++++++++++++++++++++++++-----
3 files changed, 84 insertions(+), 16 deletions(-)
[PATCH v1 0/3] Switch get/put unaligned to use memcpy
Posted by Ian Rogers 3 months, 3 weeks ago
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