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] [day] [month] [year] [list]
Message-ID: <6ailuetf6jt66q2suzlnqo6ersf4tdqfllgltw6ef3gulvvd64@v2rg6wkulzrc>
Date: Mon, 1 Sep 2025 20:04:50 +0200
From: Michal Koutný <mkoutny@...e.com>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: Tejun Heo <tj@...nel.org>, Johannes Weiner <hannes@...xchg.org>, 
	cgroups@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>, 
	linux-hardening@...r.kernel.org, "Gustavo A. R. Silva" <gustavoars@...nel.org>, 
	Chen Ridong <chenridong@...weicloud.com>
Subject: Re: [RFC] cgroup: Avoid thousands of -Wflex-array-member-not-at-end
 warnings

On Mon, Sep 01, 2025 at 05:44:38PM +0200, "Gustavo A. R. Silva" <gustavo@...eddedor.com> wrote:
> Oh, a correction about this. Actually, if we need to use __packed, we would
> have to pass it as an argument to TRAILING_OVERLAP(), like this:
> 
> -#define TRAILING_OVERLAP(TYPE, NAME, FAM, MEMBERS)                             \
> +#define TRAILING_OVERLAP(TYPE, NAME, FAM, MEMBERS, ATTRS)                              \
>         union {                                                                 \
>                 TYPE NAME;                                                      \
>                 struct {                                                        \
>                         unsigned char __offset_to_##FAM[offsetof(TYPE, FAM)];   \
>                         MEMBERS                                                 \
> -               };                                                              \
> +               } ATTRS;                                                                \
>         }
> 
> However, in this case MEMBERS is only cgrp_ancestor_storage, and it's correctly
> aligned to __offset_to_##FAM[offsetof(TYPE, FAM)]; inside the helper. So, we
> don't really need to pack that internal struct.

My intention with the attribute was to prevent a gap (padding) occurring
between 
	unsigned char __offset_to_##FAM
and
	MEMBERS                                                 
which would make the address of the first member to mismatch the address
of FAM (the example in struct cgroup_root notwithstanding).

(But perhaps it's guaranteed that first member's offset in the struct is
always equal to offsetof(TYPE, FAM).)

Michal

Download attachment "signature.asc" of type "application/pgp-signature" (266 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ