On Mon, Mar 10, 2025 at 11:19:14AM +0000, Stuart Henderson wrote:
> Trying to run npm on aarch64 raspberry pi 3, I'm running into a
> reliable asm-related crash with pretty much any use:

> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  _bsaes_key_convert () at crypto/aes/bsaes-armv8.S:926
> 926             ldr     q1, [x11]                   // .LM0

That's clearly an xonly issue. Could you try this, please?

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/openssl/3.3/Makefile,v
diff -u -p -r1.12 Makefile
--- Makefile    11 Feb 2025 16:29:49 -0000      1.12
+++ Makefile    10 Mar 2025 11:35:53 -0000
@@ -12,6 +12,8 @@ PKGNAME=      openssl-${V}
 PKGSPEC=       openssl->=3.3v0,<3.4v0
 EPOCH=         0
 
+REVISION=      0
+
 SHLIBVER=      27.0
 SHARED_LIBS=   crypto ${SHLIBVER} \
                ssl ${SHLIBVER}
Index: patches/patch-crypto_aes_asm_bsaes-armv8_pl
===================================================================
RCS file: patches/patch-crypto_aes_asm_bsaes-armv8_pl
diff -N patches/patch-crypto_aes_asm_bsaes-armv8_pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_aes_asm_bsaes-armv8_pl 10 Mar 2025 11:42:06 -0000
@@ -0,0 +1,63 @@
+Index: crypto/aes/asm/bsaes-armv8.pl
+--- crypto/aes/asm/bsaes-armv8.pl.orig
++++ crypto/aes/asm/bsaes-armv8.pl
+@@ -78,7 +78,8 @@ __END__
+ //   other SIMD registers corrupted
+ _bsaes_decrypt8:
+         ldr     q8, [x9], #16
+-        adr     x11, .LM0ISR
++        adrp    x11, .LM0ISR
++        add     x11, x11, :lo12:.LM0ISR
+         movi    v9.16b, #0x55
+         ldr     q10, [x11], #16
+         movi    v16.16b, #0x33
+@@ -494,6 +495,7 @@ _bsaes_decrypt8:
+         ret
+ .size   _bsaes_decrypt8,.-_bsaes_decrypt8
+ 
++.rodata
+ .type   _bsaes_const,%object
+ .align  6
+ _bsaes_const:
+@@ -533,6 +535,7 @@ _bsaes_const:
+ 
+ .align  6
+ .size   _bsaes_const,.-_bsaes_const
++.previous
+ 
+ .type   _bsaes_encrypt8,%function
+ .align  4
+@@ -548,7 +551,8 @@ _bsaes_const:
+ //   other SIMD registers corrupted
+ _bsaes_encrypt8:
+         ldr     q8, [x9], #16
+-        adr     x11, .LM0SR
++        adrp    x11, .LM0SR
++        add     x11, x11, :lo12:.LM0SR
+         ldr     q9, [x11], #16
+ _bsaes_encrypt8_alt:
+         eor     v0.16b, v0.16b, v8.16b
+@@ -952,9 +956,11 @@ _bsaes_encrypt8_alt:
+ //   other SIMD registers corrupted
+ _bsaes_key_convert:
+ #ifdef __AARCH64EL__
+-        adr     x11, .LM0_littleendian
++        adrp    x11, .LM0_littleendian
++        add     x11, x11, :lo12:.LM0_littleendian
+ #else
+-        adr     x11, .LM0_bigendian
++        adrp    x11, .LM0_bigendian
++        add     x11, x11, :lo12:.LM0_bigendian
+ #endif
+         ldr     q0, [x9], #16               // load round 0 key
+         ldr     q1, [x11]                   // .LM0
+@@ -998,7 +1004,8 @@ _bsaes_key_convert:
+         // don't save last round key
+ #ifdef __AARCH64EL__
+         rev32   v15.16b, v15.16b
+-        adr     x11, .LM0_bigendian
++        adrp    x11, .LM0_bigendian
++        add     x11, x11, :lo12:.LM0_bigendian
+ #endif
+         ret
+ .size   _bsaes_key_convert,.-_bsaes_key_convert

Reply via email to