-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[BOLT] BOLT Optimization Corrupts Cryptographic Functionality in nettle Library, Leading to SHA3, SHAKE, EdDSA, and Ed448 Test Failures #125490
Comments
@llvm/issue-subscribers-bolt Author: None (ms178)
**Description:**
I see several test failures during the BOLT instrumention phase of the nettle cryptographic library (version 3.10.1). I use the provided nettle test suite as training run, but it results in functional regressions, specifically causing failures in SHA3, SHAKE, EdDSA, and Ed448 tests within the test suite. This issue occurs after applying BOLT instrumentation as part of a build process that also includes Profile-Guided Optimization (PGO) where the same tests pass without any issue. The failures manifest as incorrect hash outputs, signature verification failures, and crashes (indicated by "Abgebrochen (Speicherabzug geschrieben)" and core dumps). The nature of these failures strongly suggests memory corruption or incorrect code transformation introduced by BOLT during the instrumentation process (and also possibly the optimization process), impacting the correctness of cryptographic algorithms. Steps to Reproduce: If you are on Arch or an Arch-derivative, you can reproduce the issue with my PKGBUILD: https://github.com/ms178/archpkgbuilds/blob/main/packages/nettle/PKGBUILD.bolt.llvm
Expected Behavior: The same tests pass during the PGO stage, but not in the BOLT instrumentation phase. Ideally these should pass. Actual Behavior: The
The error output for these tests includes:
Example Error Output Snippets:
|
The common issue with low-level libraries is non-ABI compliant assembly: If you're interested, you can bisect these test failures to an offending function (using bolt/utils/bughunter.sh and/or creduce). In case the culprit is a function written in assembly that lacks proper markings (symbols and/or CFI), please report the issue to nettle developers. |
Thanks for your analysis. Unfortunately that is a bit too much involved for my abilities. The nettle project also still communicates over a mailing list: https://lists.lysator.liu.se/mailman/postorius/lists/nettle-bugs.lists.lysator.liu.se. I'll leave it to other interested parties to get to the bottomn of this one. |
Description:
I see several test failures during the BOLT instrumention phase of the nettle cryptographic library (version 3.10.1). I use the provided nettle test suite as training run, but it results in functional regressions, specifically causing failures in SHA3, SHAKE, EdDSA, and Ed448 tests within the test suite. This issue occurs after applying BOLT instrumentation as part of a build process that also includes Profile-Guided Optimization (PGO) where the same tests pass without any issue.
The failures manifest as incorrect hash outputs, signature verification failures, and crashes (indicated by "Abgebrochen (Speicherabzug geschrieben)" and core dumps). The nature of these failures strongly suggests memory corruption or incorrect code transformation introduced by BOLT during the instrumentation process (and also possibly the optimization process), impacting the correctness of cryptographic algorithms.
Steps to Reproduce:
If you are on Arch or an Arch-derivative, you can reproduce the issue with my PKGBUILD: https://github.com/ms178/archpkgbuilds/blob/main/packages/nettle/PKGBUILD.bolt.llvm [I've also reproduced the issue with less BOLT options as shown below and with both Clang versions]
Prerequisites:
Obtain nettle Source Code:
Prepare Build Environment:
PGO Instrumentation Build and Training:
PGO Optimized Build:
BOLT Instrumentation:
BOLT Instrumented Training Run:
BOLT Optimization:
Run Tests (BOLT Optimized):
Expected Behavior:
The same tests pass during the PGO stage, but not in the BOLT instrumentation phase. Ideally these should pass.
Actual Behavior:
The
make check
command after BOLT optimization results in failures for the following tests:sha512-256
sha3-permute
sha3-224
sha3-256
sha3-384
sha3-512
shake128
shake256
eddsa-sign
ed448
The error output for these tests includes:
Example Error Output Snippets:
The text was updated successfully, but these errors were encountered: