mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: s390: add explicit padding to struct kvm_s390_keyop
@ 2026-02-06  9:17 Arnd Bergmann
  2026-02-06 10:33 ` Claudio Imbrenda
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-02-06  9:17 UTC (permalink / raw)
  To: Paolo Bonzini, Claudio Imbrenda, Heiko Carstens
  Cc: Arnd Bergmann, Oliver Upton, Sean Christopherson, Anup Patel,
	Binbin Wu, Marc Zyngier, Jiaqi Yan, kvm, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The newly added structure causes a warning about implied padding:

./usr/include/linux/kvm.h:1247:1: error: padding struct size to alignment boundary with 6 bytes [-Werror=padded]

The padding can lead to leaking kernel data and ABI incompatibilies
when used on x86. Neither of these is a problem in this specific
patch, but it's best to avoid it and use explicit padding fields
in general.

Fixes: 0ee4ddc1647b ("KVM: s390: Storage key manipulation IOCTL")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I have a long series to add annotations to all existing structures,
but that will take a while. For now, I'm sending fixes when new
instances show up in linux-next.
---
 include/uapi/linux/kvm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index a68b1741045c..1225fbd017e5 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -1255,6 +1255,7 @@ struct kvm_s390_keyop {
 	__u64 guest_addr;
 	__u8  key;
 	__u8  operation;
+	__u8  pad[6];
 };
 
 /*
-- 
2.39.5


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

* Re: [PATCH] KVM: s390: add explicit padding to struct kvm_s390_keyop
  2026-02-06  9:17 [PATCH] KVM: s390: add explicit padding to struct kvm_s390_keyop Arnd Bergmann
@ 2026-02-06 10:33 ` Claudio Imbrenda
  0 siblings, 0 replies; 2+ messages in thread
From: Claudio Imbrenda @ 2026-02-06 10:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Paolo Bonzini, Heiko Carstens, Arnd Bergmann, Oliver Upton,
	Sean Christopherson, Anup Patel, Binbin Wu, Marc Zyngier,
	Jiaqi Yan, kvm, linux-kernel

On Fri,  6 Feb 2026 10:17:30 +0100
Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> The newly added structure causes a warning about implied padding:
> 
> ./usr/include/linux/kvm.h:1247:1: error: padding struct size to alignment boundary with 6 bytes [-Werror=padded]
> 
> The padding can lead to leaking kernel data and ABI incompatibilies
> when used on x86. Neither of these is a problem in this specific
> patch, but it's best to avoid it and use explicit padding fields
> in general.
> 
> Fixes: 0ee4ddc1647b ("KVM: s390: Storage key manipulation IOCTL")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
> I have a long series to add annotations to all existing structures,
> but that will take a while. For now, I'm sending fixes when new
> instances show up in linux-next.
> ---
>  include/uapi/linux/kvm.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index a68b1741045c..1225fbd017e5 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -1255,6 +1255,7 @@ struct kvm_s390_keyop {
>  	__u64 guest_addr;
>  	__u8  key;
>  	__u8  operation;
> +	__u8  pad[6];
>  };
>  
>  /*


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

end of thread, other threads:[~2026-02-06 10:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-06  9:17 [PATCH] KVM: s390: add explicit padding to struct kvm_s390_keyop Arnd Bergmann
2026-02-06 10:33 ` Claudio Imbrenda

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

all inboxes | Powered by JetHome®