[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251204123507.2e6091a9@pumpkin>
Date: Thu, 4 Dec 2025 12:35:07 +0000
From: David Laight <david.laight.linux@...il.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: "Theodore Ts'o" <tytso@....edu>, Andreas Dilger
<adilger.kernel@...ger.ca>, Jan Kara <jack@...e.cz>, "Darrick J. Wong"
<djwong@...nel.org>, Arnd Bergmann <arnd@...db.de>,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext4: fix ext4_tune_sb_params padding
On Thu, 4 Dec 2025 11:19:10 +0100
Arnd Bergmann <arnd@...nel.org> wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> The padding at the end of struct ext4_tune_sb_params is architecture
> specific and in particular is different between x86-32 and x86-64,
> since the __u64 member only enforces struct alignment on the latter.
Is it worth adding a compile-time check for the size somewhere?
Since the intention seems to be that any extensions will use the padding.
David
>
> This shows up as a new warning when test-building the headers with
> -Wpadded:
>
> include/linux/ext4.h:144:1: error: padding struct size to alignment boundary with 4 bytes [-Werror=padded]
>
> All members inside the structure are naturally aligned, so the only
> difference here is the amount of padding at the end. Make the padding
> explicit, to have a consistent sizeof(struct ext4_tune_sb_params) of
> 232 on all architectures and avoid adding compat ioctl handling for
> EXT4_IOC_GET_TUNE_SB_PARAM/EXT4_IOC_SET_TUNE_SB_PARAM.
>
> This is an ABI break on x86-32 but hopefully this can go into 6.18.y early
> enough as a fixup so no actual users will be affected. Alternatively, the
> kernel could handle the ioctl commands for both sizes (232 and 228 bytes)
> on all architectures.
>
> Fixes: 04a91570ac67 ("ext4: implemet new ioctls to set and get superblock parameters")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> include/uapi/linux/ext4.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/ext4.h b/include/uapi/linux/ext4.h
> index 411dcc1e4a35..9c683991c32f 100644
> --- a/include/uapi/linux/ext4.h
> +++ b/include/uapi/linux/ext4.h
> @@ -139,7 +139,7 @@ struct ext4_tune_sb_params {
> __u32 clear_feature_incompat_mask;
> __u32 clear_feature_ro_compat_mask;
> __u8 mount_opts[64];
> - __u8 pad[64];
> + __u8 pad[68];
> };
>
> #define EXT4_TUNE_FL_ERRORS_BEHAVIOR 0x00000001
Powered by blists - more mailing lists