8370318: AES-GCM vector intrinsic may read out of bounds (x86_64, AVX-512)#27951
8370318: AES-GCM vector intrinsic may read out of bounds (x86_64, AVX-512)#27951shipilev wants to merge 3 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
|
@shipilev This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 79 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
Thanks! I think I need another Review before I can integrate. |
|
Friendly reminder. Thanks! |
|
Thank you! Here goes. /integrate |
|
Going to push as commit 7bb490c.
Your commit was automatically rebased without conflicts. |
See the bug for symptoms and discussion.
In short, in newly added intrinsic in JDK 24, there is a potential read out of Java heap if key array is at the edge of it, which will crash JVM. And that read is redundant for the code path in question, we only use it in the subsequent blocks that we never actually enter in the problematic case. So we never see any failures in testing: the only observable effect is SEGV on uncommitted heap access. It is somewhat similar to JDK-8330611 we have fixed in other place. But this one can be caught with the explicit range check in debug code.
I opted to keep this patch very simple, because I would backport it to 25u shortly after we integrate to mainline. It just moves the read down to the block where it is actually needed. Note that
aes_192andaes_256labels are red herring in this code, they are unbound; you can even remove them without any bulid errors. The actual thing that drives path selection isNROUNDS-- that one is derived from the key array length -- and we are just doing the read too early.Additional testing:
com/sun/crypto/provider/Cipher compiler/codegen/aes(fails with range check only, passes with entire patch)allon AVX-512 machineProgress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27951/head:pull/27951$ git checkout pull/27951Update a local copy of the PR:
$ git checkout pull/27951$ git pull https://git.openjdk.org/jdk.git pull/27951/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27951View PR using the GUI difftool:
$ git pr show -t 27951Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27951.diff
Using Webrev
Link to Webrev Comment