-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
As discussed in #14838, the SIGILL-based feature detection that OpenSSL uses on Arm is incorrect and causes problems. On Apple platforms, the API to use is sysctlbyname
:
https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics
OpenSSL broadly uses sysctlbyname
, but still runs the probing mechanism on Apple platforms. It just happens to filter out the not-always-available features on this line:
Line 345 in aa2d7e0
# if defined(__aarch64__) && !defined(__APPLE__) |
But then later PRs regressed this by not similarly guarding such features: #17916 and #15361. I ran into this because OpenSSL's regression here seems to interfere with debugging things on macOS with lldb
, but the SIGILL mechanism is also not thread-safe.
But that limited __APPLE__
guard is also the wrong way to do this. Instead one should completely disable the SIGILL mechanism on platforms where a real API is available. Indeed, as it's not thread-safe, best not to have it at all and just use the correct APIs on all platforms, combined with the preprocessor defines from ACLE to handle always-available features since older Apple platforms didn't provide runtime detection for such features. (BoringSSL handles all its detection without SIGILL.)