mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] system certificates: specify byte alignment
@ 2025-09-12 10:00 Giuliano Procida
  2025-09-22 16:38 ` Will Deacon
  2025-09-23  8:13 ` [PATCH v2] certs: " Giuliano Procida
  0 siblings, 2 replies; 8+ messages in thread
From: Giuliano Procida @ 2025-09-12 10:00 UTC (permalink / raw)
  To: dhowells, dwmw2; +Cc: gregkh, keyrings, linux-kernel, Giuliano Procida

The .align macro is architecture dependent. On arm64 it behaves as
.p2align. The various alignments in this file are all bytes.

So use the .balign macro to avoid unnecessary padding due to
over-alignment.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 certs/system_certificates.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/certs/system_certificates.S b/certs/system_certificates.S
index 003e25d4a17e..ea6984b427c9 100644
--- a/certs/system_certificates.S
+++ b/certs/system_certificates.S
@@ -4,7 +4,7 @@
 
 	__INITRODATA
 
-	.align 8
+	.balign 8
 	.globl system_certificate_list
 system_certificate_list:
 __cert_list_start:
@@ -20,14 +20,14 @@ __cert_list_end:
 system_extra_cert:
 	.fill CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE, 1, 0
 
-	.align 4
+	.balign 4
 	.globl system_extra_cert_used
 system_extra_cert_used:
 	.int 0
 
 #endif /* CONFIG_SYSTEM_EXTRA_CERTIFICATE */
 
-	.align 8
+	.balign 8
 	.globl system_certificate_list_size
 system_certificate_list_size:
 #ifdef CONFIG_64BIT
@@ -36,7 +36,7 @@ system_certificate_list_size:
 	.long __cert_list_end - __cert_list_start
 #endif
 
-	.align 8
+	.balign 8
 	.globl module_cert_size
 module_cert_size:
 #ifdef CONFIG_64BIT
-- 
2.51.0.384.g4c02a37b29-goog


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

* Re: [PATCH] system certificates: specify byte alignment
  2025-09-12 10:00 [PATCH] system certificates: specify byte alignment Giuliano Procida
@ 2025-09-22 16:38 ` Will Deacon
  2025-09-22 20:17   ` Giuliano Procida
  2025-09-23  8:13 ` [PATCH v2] certs: " Giuliano Procida
  1 sibling, 1 reply; 8+ messages in thread
From: Will Deacon @ 2025-09-22 16:38 UTC (permalink / raw)
  To: Giuliano Procida; +Cc: dhowells, dwmw2, gregkh, keyrings, linux-kernel

On Fri, Sep 12, 2025 at 11:00:15AM +0100, Giuliano Procida wrote:
> The .align macro is architecture dependent. On arm64 it behaves as
> .p2align. The various alignments in this file are all bytes.
> 
> So use the .balign macro to avoid unnecessary padding due to
> over-alignment.
> 
> Signed-off-by: Giuliano Procida <gprocida@google.com>
> ---
>  certs/system_certificates.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Does certs/revocation_certificates.S need fixing as well?

Will

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

* Re: [PATCH] system certificates: specify byte alignment
  2025-09-22 16:38 ` Will Deacon
@ 2025-09-22 20:17   ` Giuliano Procida
  0 siblings, 0 replies; 8+ messages in thread
From: Giuliano Procida @ 2025-09-22 20:17 UTC (permalink / raw)
  To: Will Deacon; +Cc: dhowells, dwmw2, gregkh, keyrings, linux-kernel

On Mon, 22 Sept 2025 at 17:38, Will Deacon <will@kernel.org> wrote:
>
> On Fri, Sep 12, 2025 at 11:00:15AM +0100, Giuliano Procida wrote:
> > The .align macro is architecture dependent. On arm64 it behaves as
> > .p2align. The various alignments in this file are all bytes.
> >
> > So use the .balign macro to avoid unnecessary padding due to
> > over-alignment.
> >
> > Signed-off-by: Giuliano Procida <gprocida@google.com>
> > ---
> >  certs/system_certificates.S | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
>
> Does certs/revocation_certificates.S need fixing as well?

Yes. I will post a v2.

> Will

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

* [PATCH v2] certs: specify byte alignment
  2025-09-12 10:00 [PATCH] system certificates: specify byte alignment Giuliano Procida
  2025-09-22 16:38 ` Will Deacon
@ 2025-09-23  8:13 ` Giuliano Procida
  2025-09-23  9:08   ` Will Deacon
  1 sibling, 1 reply; 8+ messages in thread
From: Giuliano Procida @ 2025-09-23  8:13 UTC (permalink / raw)
  To: dhowells, dwmw2; +Cc: Giuliano Procida, gregkh, keyrings, linux-kernel, will

The alignments specified in system_certificates.S and
revocation_certificates.S are intended to be byte quantities.

However, the .align macro is architecture dependent and on arm64 it
behaves as .p2align. So use the .balign macro to avoid unnecessary
padding due to over-alignment.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 certs/revocation_certificates.S | 4 ++--
 certs/system_certificates.S     | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/certs/revocation_certificates.S b/certs/revocation_certificates.S
index f21aae8a8f0e..a53b49d49931 100644
--- a/certs/revocation_certificates.S
+++ b/certs/revocation_certificates.S
@@ -4,14 +4,14 @@
 
 	__INITRODATA
 
-	.align 8
+	.balign 8
 	.globl revocation_certificate_list
 revocation_certificate_list:
 __revocation_list_start:
 	.incbin "certs/x509_revocation_list"
 __revocation_list_end:
 
-	.align 8
+	.balign 8
 	.globl revocation_certificate_list_size
 revocation_certificate_list_size:
 #ifdef CONFIG_64BIT
diff --git a/certs/system_certificates.S b/certs/system_certificates.S
index 003e25d4a17e..ea6984b427c9 100644
--- a/certs/system_certificates.S
+++ b/certs/system_certificates.S
@@ -4,7 +4,7 @@
 
 	__INITRODATA
 
-	.align 8
+	.balign 8
 	.globl system_certificate_list
 system_certificate_list:
 __cert_list_start:
@@ -20,14 +20,14 @@ __cert_list_end:
 system_extra_cert:
 	.fill CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE, 1, 0
 
-	.align 4
+	.balign 4
 	.globl system_extra_cert_used
 system_extra_cert_used:
 	.int 0
 
 #endif /* CONFIG_SYSTEM_EXTRA_CERTIFICATE */
 
-	.align 8
+	.balign 8
 	.globl system_certificate_list_size
 system_certificate_list_size:
 #ifdef CONFIG_64BIT
@@ -36,7 +36,7 @@ system_certificate_list_size:
 	.long __cert_list_end - __cert_list_start
 #endif
 
-	.align 8
+	.balign 8
 	.globl module_cert_size
 module_cert_size:
 #ifdef CONFIG_64BIT
-- 
2.51.0.534.gc79095c0ca-goog


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

* Re: [PATCH v2] certs: specify byte alignment
  2025-09-23  8:13 ` [PATCH v2] certs: " Giuliano Procida
@ 2025-09-23  9:08   ` Will Deacon
  2026-08-06 13:50     ` Xi Ruoyao
  0 siblings, 1 reply; 8+ messages in thread
From: Will Deacon @ 2025-09-23  9:08 UTC (permalink / raw)
  To: Giuliano Procida; +Cc: dhowells, dwmw2, gregkh, keyrings, linux-kernel

On Tue, Sep 23, 2025 at 09:13:42AM +0100, Giuliano Procida wrote:
> The alignments specified in system_certificates.S and
> revocation_certificates.S are intended to be byte quantities.
> 
> However, the .align macro is architecture dependent and on arm64 it
> behaves as .p2align. So use the .balign macro to avoid unnecessary
> padding due to over-alignment.
> 
> Signed-off-by: Giuliano Procida <gprocida@google.com>
> ---
>  certs/revocation_certificates.S | 4 ++--
>  certs/system_certificates.S     | 8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)

Acked-by: Will Deacon <will@kernel.org>

Will

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

* Re: [PATCH v2] certs: specify byte alignment
  2025-09-23  9:08   ` Will Deacon
@ 2026-08-06 13:50     ` Xi Ruoyao
  2026-08-06 14:32       ` Giuliano Procida
  0 siblings, 1 reply; 8+ messages in thread
From: Xi Ruoyao @ 2026-08-06 13:50 UTC (permalink / raw)
  To: Will Deacon, Giuliano Procida
  Cc: dhowells, dwmw2, gregkh, keyrings, linux-kernel, Kexy Biscuit

On Tue, 2025-09-23 at 10:08 +0100, Will Deacon wrote:
> On Tue, Sep 23, 2025 at 09:13:42AM +0100, Giuliano Procida wrote:
> > The alignments specified in system_certificates.S and
> > revocation_certificates.S are intended to be byte quantities.
> > 
> > However, the .align macro is architecture dependent and on arm64 it
> > behaves as .p2align. So use the .balign macro to avoid unnecessary
> > padding due to over-alignment.
> > 
> > Signed-off-by: Giuliano Procida <gprocida@google.com>
> > ---
> >  certs/revocation_certificates.S | 4 ++--
> >  certs/system_certificates.S     | 8 ++++----
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> Acked-by: Will Deacon <will@kernel.org>
> 
> Will

Hi,

It seems this patch somehow got lost?

Kexy found MIPS is specifically affected by the .align directive: on
MIPS it not only behaves as p2align and introduces a lot of extra
padding, but also moved before the __revocation_list_end label in the
case of

__revocation_list_end:

    .align 8

in revocation_certificates.S.  It seems the GNU assembler moves the
.align earlier to mimic the IRIX assembler behavior described at page
110 of https://irix7.com/techpubs/007-2418-006.pdf:


    Labels immediately preceding an automatic or explicit
    alignment are also realigned. For example, foo:
    .align 3; .word 0 is the same as .align 3;
    foo: .word 0.

Kexy's AI proposed the same fix as this patch.  So maybe we should apply
it now?

-- 
Xi Ruoyao <xry111@xry111.site>

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

* Re: [PATCH v2] certs: specify byte alignment
  2026-08-06 13:50     ` Xi Ruoyao
@ 2026-08-06 14:32       ` Giuliano Procida
  2026-08-08 18:49         ` Xi Ruoyao
  0 siblings, 1 reply; 8+ messages in thread
From: Giuliano Procida @ 2026-08-06 14:32 UTC (permalink / raw)
  To: Xi Ruoyao
  Cc: Will Deacon, dhowells, dwmw2, gregkh, keyrings, linux-kernel,
	Kexy Biscuit

Hi.

On Thu, 6 Aug 2026 at 14:51, Xi Ruoyao <xry111@xry111.site> wrote:
>
> On Tue, 2025-09-23 at 10:08 +0100, Will Deacon wrote:
> > On Tue, Sep 23, 2025 at 09:13:42AM +0100, Giuliano Procida wrote:
> > > The alignments specified in system_certificates.S and
> > > revocation_certificates.S are intended to be byte quantities.
> > >
> > > However, the .align macro is architecture dependent and on arm64 it
> > > behaves as .p2align. So use the .balign macro to avoid unnecessary
> > > padding due to over-alignment.
> > >
> > > Signed-off-by: Giuliano Procida <gprocida@google.com>
> > > ---
> > >  certs/revocation_certificates.S | 4 ++--
> > >  certs/system_certificates.S     | 8 ++++----
> > >  2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > Acked-by: Will Deacon <will@kernel.org>
> >
> > Will
>
> Hi,
>
> It seems this patch somehow got lost?
>
> Kexy found MIPS is specifically affected by the .align directive: on
> MIPS it not only behaves as p2align and introduces a lot of extra
> padding, but also moved before the __revocation_list_end label in the
> case of
>
> __revocation_list_end:
>
>     .align 8
>
> in revocation_certificates.S.  It seems the GNU assembler moves the
> .align earlier to mimic the IRIX assembler behavior described at page
> 110 of https://irix7.com/techpubs/007-2418-006.pdf:
>
>
>     Labels immediately preceding an automatic or explicit
>     alignment are also realigned. For example, foo:
>     .align 3; .word 0 is the same as .align 3;
>     foo: .word 0.
>
> Kexy's AI proposed the same fix as this patch.  So maybe we should apply
> it now?

That seems like a good idea. A colleague raised it again this week.
We were considering just applying it to ACK and forgetting about upstream.
I'm glad there's other interest though.

Could you raise this with the relevant maintainer?

> --
> Xi Ruoyao <xry111@xry111.site>

Thanks,
Giuliano.

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

* Re: [PATCH v2] certs: specify byte alignment
  2026-08-06 14:32       ` Giuliano Procida
@ 2026-08-08 18:49         ` Xi Ruoyao
  0 siblings, 0 replies; 8+ messages in thread
From: Xi Ruoyao @ 2026-08-08 18:49 UTC (permalink / raw)
  To: Giuliano Procida
  Cc: Will Deacon, dhowells, dwmw2, gregkh, keyrings, linux-kernel,
	Kexy Biscuit

On Thu, 2026-08-06 at 15:32 +0100, Giuliano Procida wrote:
> Hi.
> 
> On Thu, 6 Aug 2026 at 14:51, Xi Ruoyao <xry111@xry111.site> wrote:
> > 
> > On Tue, 2025-09-23 at 10:08 +0100, Will Deacon wrote:
> > > On Tue, Sep 23, 2025 at 09:13:42AM +0100, Giuliano Procida wrote:
> > > > The alignments specified in system_certificates.S and
> > > > revocation_certificates.S are intended to be byte quantities.
> > > > 
> > > > However, the .align macro is architecture dependent and on arm64 it
> > > > behaves as .p2align. So use the .balign macro to avoid unnecessary
> > > > padding due to over-alignment.
> > > > 
> > > > Signed-off-by: Giuliano Procida <gprocida@google.com>
> > > > ---
> > > >  certs/revocation_certificates.S | 4 ++--
> > > >  certs/system_certificates.S     | 8 ++++----
> > > >  2 files changed, 6 insertions(+), 6 deletions(-)
> > > 
> > > Acked-by: Will Deacon <will@kernel.org>
> > > 
> > > Will
> > 
> > Hi,
> > 
> > It seems this patch somehow got lost?
> > 
> > Kexy found MIPS is specifically affected by the .align directive: on
> > MIPS it not only behaves as p2align and introduces a lot of extra
> > padding, but also moved before the __revocation_list_end label in the
> > case of
> > 
> > __revocation_list_end:
> > 
> >     .align 8
> > 
> > in revocation_certificates.S.  It seems the GNU assembler moves the
> > .align earlier to mimic the IRIX assembler behavior described at page
> > 110 of https://irix7.com/techpubs/007-2418-006.pdf:
> > 
> > 
> >     Labels immediately preceding an automatic or explicit
> >     alignment are also realigned. For example, foo:
> >     .align 3; .word 0 is the same as .align 3;
> >     foo: .word 0.
> > 
> > Kexy's AI proposed the same fix as this patch.  So maybe we should apply
> > it now?
> 
> That seems like a good idea. A colleague raised it again this week.
> We were considering just applying it to ACK and forgetting about upstream.
> I'm glad there's other interest though.
> 
> Could you raise this with the relevant maintainer?

Hmm, get_maintainers.pl shows David Howells and David Woodhouse are the
relevant maintainers and they are already CC'ed.  Or is the
get_maintainers.pl output inaccurate?


-- 
Xi Ruoyao <xry111@xry111.site>

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

end of thread, other threads:[~2026-08-08 18:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-12 10:00 [PATCH] system certificates: specify byte alignment Giuliano Procida
2025-09-22 16:38 ` Will Deacon
2025-09-22 20:17   ` Giuliano Procida
2025-09-23  8:13 ` [PATCH v2] certs: " Giuliano Procida
2025-09-23  9:08   ` Will Deacon
2026-08-06 13:50     ` Xi Ruoyao
2026-08-06 14:32       ` Giuliano Procida
2026-08-08 18:49         ` Xi Ruoyao

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®