hadoop-crypto
hadoop-crypto copied to clipboard
Throw if JDK-8292158 may cause AES-CTR encryption corruption
Before this PR
JDK bug https://bugs.openjdk.org/browse/JDK-8292158 could cause corruption of AES-CTR streams when running on CPUs with AVX-512 vectorized AES support (e.g. Intel Ice Lake, as used in AWS 6th generation EC2 instances).
This issue should be resolved in OpenJDK 11.0.18, 15.0.10, 17.0.6, 19.0.2, and 20.0.0 when released.
One can temporarily workaround this issue be adding one of the following sets of JVM arguments:
-XX:+UnlockDiagnosticVMOptions -XX:-UseAESCTRIntrinsicsto disable only AES-CTR intrinsics-XX:+UnlockDiagnosticVMOptions -XX:-UseAESIntrinsicsto disable all AES intrinsics-XX:-UseAESto disable all AES native instructions-XX:UseAVX=2to disable all AVX-512 instructions
See https://github.com/palantir/sls-packaging/pull/1411
After this PR
==COMMIT_MSG== To avoid potential stream corruption, throw if JDK-8292158 may cause AES-CTR encryption corruption.
Determine if JVM is impacted by JDK-8292158 which can corrupt AES-CTR encryption streams. This bug impacts JDKs up to 11.0.18, 15.0.10, 17.0.6, 19.0.2 and when running on CPUs with AVX-512 vectorized AES support.
See https://bugs.openjdk.org/browse/JDK-8292158 introduced by https://bugs.openjdk.org/browse/JDK-8233741 ==COMMIT_MSG==
Possible downsides?
This will fail fast and trigger runtime failures when running on un-mitigated JVMs rather than possible data corruption.
Generate changelog in changelog/@unreleased
changelog/@unreleasedType
- [ ] Feature
- [x] Improvement
- [ ] Fix
- [ ] Break
- [ ] Deprecation
- [ ] Manual task
- [ ] Migration
Description
Determine if JVM is impacted by JDK-8292158 which can corrupt AES-CTR encryption streams. This bug impacts JDKs up to 11.0.18, 15.0.10, 17.0.6, 19.0.2 and when running on CPUs with AVX-512 vectorized AES support.
See https://bugs.openjdk.org/browse/JDK-8292158 introduced by https://bugs.openjdk.org/browse/JDK-8233741
Check the box to generate changelog(s)
- [x] Generate changelog entry
Could we run the failing test case instead of attempting to determine whether or not the jvm+hardware combination is impacted?
CI tests will be difficult/impossible, but a manual verification should be sufficient.
Manually tested this on Intel Ice Lake and it identifies and catches the corruption