public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed
@ 2026-01-15  7:35 Thomas Weißschuh
  2026-01-15  7:35 ` [PATCH 1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value " Thomas Weißschuh
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2026-01-15  7:35 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Hans de Goede, Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-hyperv, linux-kernel, llvm, Thomas Weißschuh,
	kernel test robot

The unpacked unions within a packed struct generates alignment warnings
on clang for 32-bit ARM.

With the recent changes to compile-test the UAPI headers in more cases,
these warning in combination with CONFIG_WERROR breaks the build.

Fix the warnings.

Intended for the kbuild tree.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Thomas Weißschuh (2):
      hyper-v: Mark inner union in hv_kvp_exchg_msg_value as packed
      virt: vbox: uapi: Mark inner unions in packed structs as packed

 include/uapi/linux/hyperv.h            | 2 +-
 include/uapi/linux/vbox_vmmdev_types.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: e3970d77ec504e54c3f91a48b2125775c16ba4c0
change-id: 20260115-kbuild-alignment-vbox-d0409134d335

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>


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

* [PATCH 1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value as packed
  2026-01-15  7:35 [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed Thomas Weißschuh
@ 2026-01-15  7:35 ` Thomas Weißschuh
  2026-01-15 18:22   ` Wei Liu
  2026-01-15  7:35 ` [PATCH 2/2] virt: vbox: uapi: Mark inner unions in packed structs " Thomas Weißschuh
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Thomas Weißschuh @ 2026-01-15  7:35 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Hans de Goede, Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-hyperv, linux-kernel, llvm, Thomas Weißschuh,
	kernel test robot

The unpacked union within a packed struct generates alignment warnings
on clang for 32-bit ARM:

./usr/include/linux/hyperv.h:361:2: error: field  within 'struct hv_kvp_exchg_msg_value'
  is less aligned than 'union hv_kvp_exchg_msg_value::(anonymous at ./usr/include/linux/hyperv.h:361:2)'
  and is usually due to 'struct hv_kvp_exchg_msg_value' being packed,
  which can lead to unaligned accesses [-Werror,-Wunaligned-access]
     361 |         union {
         |         ^

With the recent changes to compile-test the UAPI headers in more cases,
this warning in combination with CONFIG_WERROR breaks the build.

Fix the warning.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512140314.DzDxpIVn-lkp@intel.com/
Reported-by: Nathan Chancellor <nathan@kernel.org>
Closes: https://lore.kernel.org/linux-kbuild/20260110-uapi-test-disable-headers-arm-clang-unaligned-access-v1-1-b7b0fa541daa@kernel.org/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/linux-kbuild/29b2e736-d462-45b7-a0a9-85f8d8a3de56@app.fastmail.com/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 include/uapi/linux/hyperv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index aaa502a7bff4..1749b35ab2c2 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -362,7 +362,7 @@ struct hv_kvp_exchg_msg_value {
 		__u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
 		__u32 value_u32;
 		__u64 value_u64;
-	};
+	} __attribute__((packed));
 } __attribute__((packed));
 
 struct hv_kvp_msg_enumerate {

-- 
2.52.0


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

* [PATCH 2/2] virt: vbox: uapi: Mark inner unions in packed structs as packed
  2026-01-15  7:35 [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed Thomas Weißschuh
  2026-01-15  7:35 ` [PATCH 1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value " Thomas Weißschuh
@ 2026-01-15  7:35 ` Thomas Weißschuh
  2026-01-16 15:52 ` [PATCH 0/2] kbuild, " Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2026-01-15  7:35 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Hans de Goede, Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-hyperv, linux-kernel, llvm, Thomas Weißschuh,
	kernel test robot

The unpacked unions within a packed struct generates alignment warnings
on clang for 32-bit ARM:

./usr/include/linux/vbox_vmmdev_types.h:239:4: error: field u within 'struct vmmdev_hgcm_function_parameter32'
  is less aligned than 'union (unnamed union at ./usr/include/linux/vbox_vmmdev_types.h:223:2)'
  and is usually due to 'struct vmmdev_hgcm_function_parameter32' being packed,
  which can lead to unaligned accesses [-Werror,-Wunaligned-access]
     239 |         } u;
         |           ^

./usr/include/linux/vbox_vmmdev_types.h:254:6: error: field u within
  'struct vmmdev_hgcm_function_parameter64::(anonymous union)::(unnamed at ./usr/include/linux/vbox_vmmdev_types.h:249:3)'
  is less aligned than 'union (unnamed union at ./usr/include/linux/vbox_vmmdev_types.h:251:4)' and is usually due to
  'struct vmmdev_hgcm_function_parameter64::(anonymous union)::(unnamed at ./usr/include/linux/vbox_vmmdev_types.h:249:3)'
  being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]

With the recent changes to compile-test the UAPI headers in more cases,
these warning in combination with CONFIG_WERROR breaks the build.

Fix the warnings.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512140314.DzDxpIVn-lkp@intel.com/
Reported-by: Nathan Chancellor <nathan@kernel.org>
Closes: https://lore.kernel.org/linux-kbuild/20260110-uapi-test-disable-headers-arm-clang-unaligned-access-v1-1-b7b0fa541daa@kernel.org/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/linux-kbuild/29b2e736-d462-45b7-a0a9-85f8d8a3de56@app.fastmail.com/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 include/uapi/linux/vbox_vmmdev_types.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/vbox_vmmdev_types.h b/include/uapi/linux/vbox_vmmdev_types.h
index 6073858d52a2..11f3627c3729 100644
--- a/include/uapi/linux/vbox_vmmdev_types.h
+++ b/include/uapi/linux/vbox_vmmdev_types.h
@@ -236,7 +236,7 @@ struct vmmdev_hgcm_function_parameter32 {
 			/** Relative to the request header. */
 			__u32 offset;
 		} page_list;
-	} u;
+	} __packed u;
 } __packed;
 VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter32, 4 + 8);
 
@@ -251,7 +251,7 @@ struct vmmdev_hgcm_function_parameter64 {
 			union {
 				__u64 phys_addr;
 				__u64 linear_addr;
-			} u;
+			} __packed u;
 		} __packed pointer;
 		struct {
 			/** Size of the buffer described by the page list. */

-- 
2.52.0


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

* Re: [PATCH 1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value as packed
  2026-01-15  7:35 ` [PATCH 1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value " Thomas Weißschuh
@ 2026-01-15 18:22   ` Wei Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2026-01-15 18:22 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Hans de Goede, Arnd Bergmann, Greg Kroah-Hartman, linux-hyperv,
	linux-kernel, llvm, kernel test robot

On Thu, Jan 15, 2026 at 08:35:44AM +0100, Thomas Weißschuh wrote:
> The unpacked union within a packed struct generates alignment warnings
> on clang for 32-bit ARM:
> 
> ./usr/include/linux/hyperv.h:361:2: error: field  within 'struct hv_kvp_exchg_msg_value'
>   is less aligned than 'union hv_kvp_exchg_msg_value::(anonymous at ./usr/include/linux/hyperv.h:361:2)'
>   and is usually due to 'struct hv_kvp_exchg_msg_value' being packed,
>   which can lead to unaligned accesses [-Werror,-Wunaligned-access]
>      361 |         union {
>          |         ^
> 
> With the recent changes to compile-test the UAPI headers in more cases,
> this warning in combination with CONFIG_WERROR breaks the build.
> 
> Fix the warning.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202512140314.DzDxpIVn-lkp@intel.com/
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Closes: https://lore.kernel.org/linux-kbuild/20260110-uapi-test-disable-headers-arm-clang-unaligned-access-v1-1-b7b0fa541daa@kernel.org/
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Link: https://lore.kernel.org/linux-kbuild/29b2e736-d462-45b7-a0a9-85f8d8a3de56@app.fastmail.com/
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>

Acked-by: Wei Liu (Microsoft) <wei.liu@kernel.org>

> ---
>  include/uapi/linux/hyperv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
> index aaa502a7bff4..1749b35ab2c2 100644
> --- a/include/uapi/linux/hyperv.h
> +++ b/include/uapi/linux/hyperv.h
> @@ -362,7 +362,7 @@ struct hv_kvp_exchg_msg_value {
>  		__u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
>  		__u32 value_u32;
>  		__u64 value_u64;
> -	};
> +	} __attribute__((packed));
>  } __attribute__((packed));
>  
>  struct hv_kvp_msg_enumerate {
> 
> -- 
> 2.52.0
> 
> 

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

* Re: [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed
  2026-01-15  7:35 [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed Thomas Weißschuh
  2026-01-15  7:35 ` [PATCH 1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value " Thomas Weißschuh
  2026-01-15  7:35 ` [PATCH 2/2] virt: vbox: uapi: Mark inner unions in packed structs " Thomas Weißschuh
@ 2026-01-16 15:52 ` Greg Kroah-Hartman
  2026-01-16 19:57 ` Nicolas Schier
  2026-01-16 22:06 ` Nathan Chancellor
  4 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-01-16 15:52 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Hans de Goede, Arnd Bergmann, linux-hyperv, linux-kernel, llvm,
	kernel test robot

On Thu, Jan 15, 2026 at 08:35:43AM +0100, Thomas Weißschuh wrote:
> The unpacked unions within a packed struct generates alignment warnings
> on clang for 32-bit ARM.
> 
> With the recent changes to compile-test the UAPI headers in more cases,
> these warning in combination with CONFIG_WERROR breaks the build.
> 
> Fix the warnings.
> 
> Intended for the kbuild tree.
> 
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> Thomas Weißschuh (2):
>       hyper-v: Mark inner union in hv_kvp_exchg_msg_value as packed
>       virt: vbox: uapi: Mark inner unions in packed structs as packed
> 
>  include/uapi/linux/hyperv.h            | 2 +-
>  include/uapi/linux/vbox_vmmdev_types.h | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> ---
> base-commit: e3970d77ec504e54c3f91a48b2125775c16ba4c0
> change-id: 20260115-kbuild-alignment-vbox-d0409134d335
> 
> Best regards,
> -- 
> Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> 

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed
  2026-01-15  7:35 [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-01-16 15:52 ` [PATCH 0/2] kbuild, " Greg Kroah-Hartman
@ 2026-01-16 19:57 ` Nicolas Schier
  2026-01-16 22:06 ` Nathan Chancellor
  4 siblings, 0 replies; 7+ messages in thread
From: Nicolas Schier @ 2026-01-16 19:57 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Hans de Goede, Arnd Bergmann, Greg Kroah-Hartman, linux-hyperv,
	linux-kernel, llvm, kernel test robot, linux-kbuild

Cc += linux-kbuild

On Thu, Jan 15, 2026 at 08:35:43AM +0100, Thomas Weißschuh wrote:
> The unpacked unions within a packed struct generates alignment warnings
> on clang for 32-bit ARM.
> 
> With the recent changes to compile-test the UAPI headers in more cases,
> these warning in combination with CONFIG_WERROR breaks the build.
> 
> Fix the warnings.
> 
> Intended for the kbuild tree.
> 
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> Thomas Weißschuh (2):
>       hyper-v: Mark inner union in hv_kvp_exchg_msg_value as packed
>       virt: vbox: uapi: Mark inner unions in packed structs as packed
> 
>  include/uapi/linux/hyperv.h            | 2 +-
>  include/uapi/linux/vbox_vmmdev_types.h | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> ---
> base-commit: e3970d77ec504e54c3f91a48b2125775c16ba4c0
> change-id: 20260115-kbuild-alignment-vbox-d0409134d335
> 
> Best regards,
> -- 
> Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> 

Thanks!

Tested-by: Nicolas Schier <nsc@kernel.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>

Kind regards,
Nicolas

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

* Re: [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed
  2026-01-15  7:35 [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed Thomas Weißschuh
                   ` (3 preceding siblings ...)
  2026-01-16 19:57 ` Nicolas Schier
@ 2026-01-16 22:06 ` Nathan Chancellor
  4 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2026-01-16 22:06 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Hans de Goede, Arnd Bergmann, Greg Kroah-Hartman,
	Thomas Weißschuh
  Cc: linux-hyperv, linux-kernel, llvm, kernel test robot

On Thu, 15 Jan 2026 08:35:43 +0100, Thomas Weißschuh wrote:
> The unpacked unions within a packed struct generates alignment warnings
> on clang for 32-bit ARM.
> 
> With the recent changes to compile-test the UAPI headers in more cases,
> these warning in combination with CONFIG_WERROR breaks the build.
> 
> Fix the warnings.
> 
> [...]

Applied to

  https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next

Thanks!

[1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value as packed
      https://git.kernel.org/kbuild/c/1e5271393d777
[2/2] virt: vbox: uapi: Mark inner unions in packed structs as packed
      https://git.kernel.org/kbuild/c/c25d01e1c4f2d

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


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

end of thread, other threads:[~2026-01-16 22:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15  7:35 [PATCH 0/2] kbuild, uapi: Mark inner unions in packed structs as packed Thomas Weißschuh
2026-01-15  7:35 ` [PATCH 1/2] hyper-v: Mark inner union in hv_kvp_exchg_msg_value " Thomas Weißschuh
2026-01-15 18:22   ` Wei Liu
2026-01-15  7:35 ` [PATCH 2/2] virt: vbox: uapi: Mark inner unions in packed structs " Thomas Weißschuh
2026-01-16 15:52 ` [PATCH 0/2] kbuild, " Greg Kroah-Hartman
2026-01-16 19:57 ` Nicolas Schier
2026-01-16 22:06 ` Nathan Chancellor

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