tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

OpenSSL vs. getauxval()



Hey folks,

openssl on arm uses a weak symbol reference to "getauxval", and if the
symbol is available, calls it to get hardware information about the
current cpu.

We never make this kind of hardware information availble via flags in the
exec auxval vector, but use sysctl instead. We also do not provide a getauxval
function.

So far all fine.

However, openssl is a library and should not assume special meaning for 
unprotected symbols. Some third party apss come with a local getauxval
implementation and confuse things.

I wonder if we should just disable the getauxval code path on NetBSD (and
maybe as a future extension even provide the proper sysctl code to get the
hw capabilities via sysctl)?

Martin

Index: armcap.c
===================================================================
RCS file: /cvsroot/src/crypto/external/bsd/openssl/dist/crypto/armcap.c,v
retrieving revision 1.7
diff -u -r1.7 armcap.c
--- armcap.c	23 Sep 2018 13:32:55 -0000	1.7
+++ armcap.c	29 Sep 2018 22:06:52 -0000
@@ -155,6 +155,7 @@
     sigaction(SIGILL, &ill_act, &ill_oact);
 
 #if __ARM_MAX_ARCH__>=7
+# ifndef __NetBSD__
     if (getauxval != NULL) {
         if (getauxval(HWCAP) & HWCAP_NEON) {
             unsigned long hwcap = getauxval(HWCAP_CE);
@@ -178,7 +179,9 @@
                 OPENSSL_armcap_P |= ARMV8_SHA512;
 # endif
         }
-    } else if (sigsetjmp(ill_jmp, 1) == 0) {
+    } else 
+#endif
+      if (sigsetjmp(ill_jmp, 1) == 0) {
         _armv7_neon_probe();
         OPENSSL_armcap_P |= ARMV7_NEON;
         if (sigsetjmp(ill_jmp, 1) == 0) {



Home | Main Index | Thread Index | Old Index