-
Notifications
You must be signed in to change notification settings - Fork 122
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
Adding a runtime dis/enabler of DIT Capability on AArch64. #1783
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1783 +/- ##
=======================================
Coverage 78.48% 78.48%
=======================================
Files 585 585
Lines 99524 99524
Branches 14249 14246 -3
=======================================
+ Hits 78112 78114 +2
+ Misses 20776 20775 -1
+ Partials 636 635 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see changes to cpu_aarch64_linux.c
and cpu_aarch64_apple.c
. do we need to udpate cpu_aarch64_win.c
as well?
…isable is used for the (perceived) CPU capability.
67b68c1
to
37f707e
Compare
…current when changing the runtime control but they show it changes at the process level.
Issues:
Addresses #CryptoAlg-2503
Description of changes:
Provide runtime functions that mask out (and back in) the DIT CPU capability by clearing (setting) an additional bit in
OPENSSL_armcap_P
. This mechanism was chosen for the following reasons:There were write locks added around changing
OPENSSL_armcap_P
. However, Thread Sanitizer warned about data race possibilities when trying to run a test with concurrent threads where one disables DIT at runtime and the other tries to check for the capability. Therefore, they are documented with a warning to use them only in initialization contexts.Make the DIT functions (enable/disable and set/restore) available regardless of whether the build flag
DENABLE_DATA_INDEPENDENT_TIMING=ON
was used or not.armv8_set/restore_dit
in the user's code.Call-outs:
armv8_enable_dit
is renamed toarmv8_set_dit
.armv8_enable_dit
now means enable back the capability at runtime.ENABLE_DATA_INDEPENDENT_TIMING
(removing_AARCH64
).Testing:
armv8_disable_dit()
andarm_enable_dit()
were placed inSpeed()
, the benchmarking function, and their effects were confirmed on Apple M2.OPENSSL_armcap_P
.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.