From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAE06606E449 for ; Tue, 10 Nov 2026 12:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=vHmgeWKR; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.a=rsa-sha256 header.s=google header.b=e2Gf0Ur/ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:To: From:Subject:Cc:Message-Id:Date:Content-Type:Content-Transfer-Encoding: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=K4NCnFvaGrDIOTRc5HujFwwUmTQ2N/bdVeWHbEi7j9U=; b=vHmgeWKROrKqkU DnMO6vNIoFky9uplX7UK2I8CtYUc9A+7hOKd6ZebEjx6zCkAm8yBU0ZQHdcbKfJF0kqi0MHT0d2KB 37xVyvO9n+iL2CSuPGN29QTsJPi2+dP2pH9yocJUWUN60dA77gDbhAHW7OFil22I6RZltSzMrlXmf ckNr6PvmM6ixOxEFmIRsC/bYt3dvpWBgmxwaOS6ZbfPbGHKt7HzeREXOCV4VMRgDFo2EC7W8aMnBp laJ5jZJmAoM/TE7o4JgXZ0G4eX2ai4uvElbGtYfF0xqO7njOE5d/+1vWfsgmlYQqKpmQs0n+myZe+ mTl3bqOiDOJ3f0zfAUDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQlP6-00000003w41-1QGg; Tue, 10 Nov 2026 12:56:48 +0000 Received: from mail-vk1-xa2e.google.com ([2607:f8b0:4864:20::a2e]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQlP2-00000003w2G-3b7e for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2026 12:56:47 +0000 Received: by mail-vk1-xa2e.google.com with SMTP id 71dfb90a1353d-5ec690faf85so641850e0c.0 for ; Tue, 10 Nov 2026 04:56:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1794315404; x=1794920204; darn=lists.infradead.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=K4NCnFvaGrDIOTRc5HujFwwUmTQ2N/bdVeWHbEi7j9U=; b=e2Gf0Ur/SxVLYwMknMMVsWuWzPgNiSkVUp+CDDApz2oFWFqaNXNkq19hz+SPExw07G 9sQuazZVhYofcLLjY6y0MYIbOkCacvgK5olSLnnNkn4Q+YOqhnaFenWxkL5KX/GjkC9c CrwsIPYm7qofSv6HfXbxrWfhjZr2vg3H0fqHzLXrxppOrW1O9MKZ0YdD5UHg7cjmLgLH V0OzH8iaiqDNuTbvXJk8J6UeV5DnrVZkvL91sFN/qqMFp3R3EWEmuOlfli/0qddUzdic gzq6Jvec+rSXryeRMLrsObWjtpT04e3pvGrbUj0DKJ/9B/yuqZh9R1lqx5YAJCQ3t2jn 1iEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794315404; x=1794920204; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=K4NCnFvaGrDIOT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+zzJM5VDMFJbZms n6tHMOwWH9LKXXUpGiGElFUFBIHtwJPox6498adXprWGUdUlce5foCMnExVZwYuCzn5WA/fnxu1 119XY84ceiXellYFPil/9gsu4ObejnfSYPzr3JIPnhJ/GlT9YJvmvbWTqJ7h9o767uJ5JCuDagL cNdNAZ58PgVhWO/0l1t8F+82Oy17oOQxbyfCrlTHmCBpm8X10zJAueYFuigjDMvINy0rJZ3NlIX s85WzX43u70N08vzi8gn8FxWb35ILYxxPHcSD2RdnLS0mwsqb39YA X-Received: by 2002:a05:6122:3407:b0:5ec:3e18:a8da with SMTP id 71dfb90a1353d-5ee0d14a2e5mr823009e0c.17.1794315403552; Tue, 10 Nov 2026 04:56:43 -0800 (PST) Received: from localhost (64.167.245.35.bc.googleusercontent.com. [35.245.167.64]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5ee0c5b2233sm1547234e0c.10.2026.11.10.04.56.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Nov 2026 04:56:42 -0800 (PST) X-Archived-By: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 10 Nov 2026 07:56:41 -0500 Message-Id: Cc: , , "Pratyush Yadav" , , , , , , , , , Subject: Re: [PATCH v4 01/19] liveupdate, kho: Remove __packed from KHO, LUO and memfd ABI structures From: "Pasha Tatashin" To: "Tarun Sahu" , "Pasha Tatashin" , "Mike Rapoport" , , , , "David Matlack" , "Alexander Graf" , , , , , , , "Bjorn Helgaas" , , , , , "Andrew Morton" , , X-Mailer: aerc 0.22.0-39-g5d7784875be2 References: <20261110050202.529473-1-tarunsahu@google.com> <20261110050202.529473-2-tarunsahu@google.com> In-Reply-To: <20261110050202.529473-2-tarunsahu@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261110_045644_917303_249101A5 X-CRM114-Status: GOOD ( 27.19 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Tue Nov 10, 2026 at 12:01 AM EST, Tarun Sahu wrote: > All structures in include/linux/kho/abi/block.h (struct > kho_block_header_ser), include/linux/kho/abi/luo.h (struct luo_ser, > struct luo_file_ser, struct luo_file_set_ser, struct luo_session_ser, > struct luo_flb_header_ser, struct luo_flb_ser) and > include/linux/kho/abi/memfd.h (struct memfd_luo_folio_ser, struct > memfd_luo_ser) have naturally aligned fields on 64-bit architectures, > with no padding holes between fields or tail padding. Assert both the > structure size and 8-byte alignment under CONFIG_64BIT at compile time. > Any future unaligned field addition should come with reserved field to > keep the structure aligned. Just state: Remove __packed, as it may break natural alignment. Instead, ensure that=20 all padding holes are explicitly covered by reserved or similar fields,=20 as is already done for KHO/LUO serialized data, so no functional changes=20 are intended by this change. > > Signed-off-by: Tarun Sahu > --- > include/linux/kho/abi/block.h | 10 +++++++-- > include/linux/kho/abi/luo.h | 38 +++++++++++++++++++++++++++++------ > include/linux/kho/abi/memfd.h | 16 ++++++++++++--- > 3 files changed, 53 insertions(+), 11 deletions(-) > > diff --git a/include/linux/kho/abi/block.h b/include/linux/kho/abi/block.= h > index d06d64b963be..36bdbaf9b3b8 100644 > --- a/include/linux/kho/abi/block.h > +++ b/include/linux/kho/abi/block.h > @@ -12,7 +12,7 @@ > * pre-update kernel to a post-update kernel. > * > * This interface is a contract. Any modification to the structure field= s, > - * compatible strings, or the layout of the `__packed` serialization > + * compatible strings, or the layout of the serialization > * structures defined here constitutes a breaking change. Such changes r= equire > * incrementing the version number in the `KHO_FDT_COMPATIBLE` string to > * prevent a new kernel from misinterpreting data from an old kernel. > @@ -26,6 +26,8 @@ > #define _LINUX_KHO_ABI_BLOCK_H > =20 > #include > +#include > +#include > #include > =20 > /** > @@ -49,6 +51,10 @@ > struct kho_block_header_ser { > u64 next; > u64 count; > -} __packed; > +}; > + > +static_assert(sizeof(struct kho_block_header_ser) =3D=3D 16); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct kho_block_header_ser) =3D=3D 8); > =20 > #endif /* _LINUX_KHO_ABI_BLOCK_H */ > diff --git a/include/linux/kho/abi/luo.h b/include/linux/kho/abi/luo.h > index 288076de6d4a..721949374fa1 100644 > --- a/include/linux/kho/abi/luo.h > +++ b/include/linux/kho/abi/luo.h > @@ -58,6 +58,8 @@ > #define _LINUX_KHO_ABI_LUO_H > =20 > #include > +#include > +#include > #include > #include > =20 > @@ -82,7 +84,11 @@ struct luo_ser { > u64 liveupdate_num; > u64 sessions_pa; > u64 flbs_pa; > -} __packed; > +}; > + > +static_assert(sizeof(struct luo_ser) =3D=3D 32); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct luo_ser) =3D=3D 8); Please remove the two assertions above throughout this patch, as they=20 are replaced later in the series. In general, introducing add -> remove=20 -> add churn across a patch series is discouraged, as it indicates a=20 lack of planning. > =20 > #define LIVEUPDATE_HNDL_COMPAT_LENGTH 48 > =20 > @@ -98,7 +104,11 @@ struct luo_file_ser { > char compatible[LIVEUPDATE_HNDL_COMPAT_LENGTH]; > u64 data; > u64 token; > -} __packed; > +}; > + > +static_assert(sizeof(struct luo_file_ser) =3D=3D 64); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct luo_file_ser) =3D=3D 8); > =20 > /** > * struct luo_file_set_ser - Represents the serialized metadata for file= set > @@ -113,7 +123,11 @@ struct luo_file_ser { > struct luo_file_set_ser { > u64 files; > u64 count; > -} __packed; > +}; > + > +static_assert(sizeof(struct luo_file_set_ser) =3D=3D 16); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct luo_file_set_ser) =3D=3D 8); > =20 > /** > * struct luo_session_ser - Represents the serialized metadata for a LUO= session. > @@ -131,7 +145,11 @@ struct luo_file_set_ser { > struct luo_session_ser { > char name[LIVEUPDATE_SESSION_NAME_LENGTH]; > struct luo_file_set_ser file_set_ser; > -} __packed; > +}; > + > +static_assert(sizeof(struct luo_session_ser) =3D=3D 80); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct luo_session_ser) =3D=3D 8); > =20 > /* The max size is set so it can be reliably used during in serializatio= n */ > #define LIVEUPDATE_FLB_COMPAT_LENGTH 48 > @@ -152,7 +170,11 @@ struct luo_session_ser { > struct luo_flb_header_ser { > u64 pgcnt; > u64 count; > -} __packed; > +}; > + > +static_assert(sizeof(struct luo_flb_header_ser) =3D=3D 16); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct luo_flb_header_ser) =3D=3D 8); > =20 > /** > * struct luo_flb_ser - Represents the serialized state of a single FLB = object. > @@ -175,7 +197,11 @@ struct luo_flb_ser { > char name[LIVEUPDATE_FLB_COMPAT_LENGTH]; > u64 data; > u64 count; > -} __packed; > +}; > + > +static_assert(sizeof(struct luo_flb_ser) =3D=3D 64); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct luo_flb_ser) =3D=3D 8); > =20 > /* Kernel Live Update Test ABI */ > #ifdef CONFIG_LIVEUPDATE_TEST > diff --git a/include/linux/kho/abi/memfd.h b/include/linux/kho/abi/memfd.= h > index 08b10fea2afc..376a724a1d8c 100644 > --- a/include/linux/kho/abi/memfd.h > +++ b/include/linux/kho/abi/memfd.h > @@ -11,6 +11,8 @@ > #ifndef _LINUX_KHO_ABI_MEMFD_H > #define _LINUX_KHO_ABI_MEMFD_H > =20 > +#include > +#include > #include > #include > =20 > @@ -20,7 +22,7 @@ > * memfd uses the ABI defined below for preserving its state across a ke= xec > * reboot using the LUO. > * > - * The state is serialized into a packed structure `struct memfd_luo_ser= ` > + * The state is serialized into `struct memfd_luo_ser` > * which is handed over to the next kernel via the KHO mechanism. > * > * This interface is a contract. Any modification to the structure layou= t > @@ -54,7 +56,11 @@ struct memfd_luo_folio_ser { > u64 pfn:52; > u64 flags:12; > u64 index; > -} __packed; > +}; > + > +static_assert(sizeof(struct memfd_luo_folio_ser) =3D=3D 16); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct memfd_luo_folio_ser) =3D=3D 8); > =20 > /* > * The set of seals this version supports preserving. If support for any= new > @@ -85,7 +91,11 @@ struct memfd_luo_ser { > u32 flags; > u64 nr_folios; > struct kho_vmalloc folios; > -} __packed; > +}; > + > +static_assert(sizeof(struct memfd_luo_ser) =3D=3D 48); > +static_assert(!IS_ENABLED(CONFIG_64BIT) || > + __alignof__(struct memfd_luo_ser) =3D=3D 8); > =20 > /* The compatibility string for memfd file handler */ > #define MEMFD_LUO_FH_COMPATIBLE "memfd-v2" --=20 Pasha