-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable valgrind tests on AArch64 by setting ARMCAP via static defines to avoid reading from MIDR_EL1. #978
Conversation
I disabled SHA512 after I tried running tests/ci/run_valgrind_tests.sh on v 1.8.0 with the following line
and getting the following response
|
(Unless we create a `OPENSSL_cpuid_setup()` function in cpucap.c and handle the environment variable OPENSSL_armcap.)
This comment was marked as duplicate.
This comment was marked as duplicate.
As expected, when the buffer overread code was re-introduced in 5e4b920, linux-arm build failed with the following messages: Line 577
Line 1005
|
This was only possible by setting OPENSSL_armcap via static defines in order to avoid reading from MIDR_EL1. Valgrind was outputting an illegal opcode error on __asm__ volatile("mrs %0, MIDR_EL1" : "=r" (val)); This commit avoids compiling cpu_aarch64_linux.c in valgrind build by passing -DOPENSSL_STATIC_ARMCAP to it and setting all capabilities via the STATIC_ARMCAP macros (except SHA512 which wasn't used before with valgrind and was also causing an "illegal opcode" error when set). Note: Setting -DOPENSSL_STATIC_ARMCAP without specifying any capabilities disables all of them as in the second set of tests. The ssl runner valgrind tests are here made to run in parallel to the valgrind tests (only with the build where all capabilities are set).
Related to this PR: PR #1006 Check HWCAP_CPUID before reading MIDR_EL1 on aarch64. It seems that Valgrind's fix to the issue, was to mask HWCAP_CPUID as was suggested in the workaround here. |
Issues:
V886376127
Description of changes:
Enable Valgrind tests on Arm as a follow-up to #970.
Valgrind was choking (illegal opcode) on
aws-lc/crypto/fipsmodule/cpucap/cpu_aarch64_linux.c
Line 39 in 300b5ee
Despite that this issue is said to be resolved, versions 3.19 and 3.20 were outputting the same error of "illegal opcode". (Note: The newer versions solved the issue we had with reading the capabilities at runtime via
getauxval()
. But then we added to that getting the CPU part as mentioned above.)Our workaround was to avoid compiling
cpu_aarch64_linux.c
by passing-DOPENSSL_STATIC_ARMCAP
to the test build and setting all capabilities via the STATIC_ARMCAP macros (except SHA512 which wasn't used before with valgrind and was also causing an "illegal opcode" error when set).Note: Setting
-DOPENSSL_STATIC_ARMCAP
without specifying any capabilities disables all of them as in the secondset of tests.
Also, the ssl runner valgrind tests are here made to run in parallel to the valgrind tests (only with the build where all capabilities are set).
Call-outs:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and
the ISC license.