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: <7a3964b9-e21e-4ece-98f0-f0a2bb013d2c@embeddedor.com>
Date: Fri, 12 Sep 2025 12:51:15 +0200
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Uwe Kleine-König <u.kleine-koenig@...libre.com>,
 "Gustavo A. R. Silva" <gustavoars@...nel.org>, Kees Cook <kees@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/2] stddef: Simplify TRAILING_OVERLAP() and improve docs



On 9/12/25 12:28, Uwe Kleine-König wrote:
> Hello,
> 
> as a follup to the discussion I had with Gustavo in reply to
> https://lore.kernel.org/linux-pwm/aJtRPZpc-Lv-C6zD@kspp here comes my
> suggestion to improve TRAILING_OVERLAP() for wider audience.
> 
> While working at it, I wonder if __packed should also better be part of the
> macro to ensure that

I have patch ready for this:

diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index dab49e2ec8c0..b20ff76778d5 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -93,6 +93,14 @@ enum {
  #define DECLARE_FLEX_ARRAY(TYPE, NAME) \
         __DECLARE_FLEX_ARRAY(TYPE, NAME)

+#define __TRAILING_OVERLAP(TYPE, NAME, FAM, MEMBERS, ATTRS)                            \
+       union {                                                                 \
+               TYPE NAME;                                                      \
+               struct {                                                        \
+                       unsigned char __offset_to_##FAM[offsetof(TYPE, FAM)];   \
+                       MEMBERS                                                 \
+               } ATTRS;                                                                \
+       }
  /**
   * TRAILING_OVERLAP() - Overlap a flexible-array member with trailing members.
   *

Thanks
-Gustavo



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ