Skip to content
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

SslHandler GCM cipher JVM workaround #3256

Closed
Scottmitch opened this issue Dec 17, 2014 · 25 comments
Closed

SslHandler GCM cipher JVM workaround #3256

Scottmitch opened this issue Dec 17, 2014 · 25 comments
Assignees
Milestone

Comments

@Scottmitch
Copy link
Member

108dc23 introduced some code to workaround a suspected JVM bug when using GCM type ciphers. I am wondering if this is still necessary or if we should file a bug upstream to OpenJDK (or which ever JDK was in use).

@Scottmitch Scottmitch added this to the 4.0.25.Final milestone Dec 17, 2014
Scottmitch referenced this issue Dec 17, 2014
Motivation:

For an unknown reason, JVM of JDK8 crashes intermittently when
SslHandler feeds a direct buffer to SSLEngine.unwrap() *and* the current
cipher suite has GCM (Galois/Counter Mode) enabled.

Modifications:

Convert the inbound network buffer to a heap buffer when the current
cipher suite is using GCM.

Result:

JVM does not crash anymore.
@Scottmitch
Copy link
Member Author

@trustin @normanmaurer - Do we have any additional insight into this (what JDK was used, what version, did we file a bug, etc...)? I have just commented out the wantsInboundHeapBuffer = true; line and no crash. I have verified that packet.isDirect() is true here.

Cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

Allocator: PooledByteBufAllocator.DEFAULT

Environment:

$ java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

Using JDK ssl provider (client mode).

@Scottmitch Scottmitch changed the title SslHandler JVM workaround SslHandler GCM cipher JVM workaround Dec 17, 2014
@normanmaurer
Copy link
Member

Maybe it only happened on earlier versions?

Am 17.12.2014 um 15:24 schrieb Scott Mitchell notifications@github.com:

@trustin @normanmaurer - Do we have any additional insight into this? I have just commented out the wantsInboundHeapBuffer = true; line and no crash. I have verified that packet.isDirect() is true here.

Cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

Allocator: PooledByteBufAllocator.DEFAULT

Environment:

$ java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Using JDK ssl provider (client mode).


Reply to this email directly or view it on GitHub.

@trustin
Copy link
Member

trustin commented Dec 31, 2014

It still crashes on Oracle JDK 8u25. Try to run SocketSslEchoTest. I can reliably (!) crash it. :-)

@trustin trustin modified the milestones: 4.0.26.Final, 4.0.25.Final Dec 31, 2014
@trustin
Copy link
Member

trustin commented Dec 31, 2014

Rescheduled to 4.0.26 so we can revisit later with the newer JVM.

@normanmaurer
Copy link
Member

Maybe time to open a bug there?

Am 31.12.2014 um 09:45 schrieb Trustin Lee notifications@github.com:

It still crashes on Oracle JDK 8u25. Try to run SocketSslEchoTest. I can reliably (!) crash it. :-)


Reply to this email directly or view it on GitHub.

@Scottmitch
Copy link
Member Author

@trustin +1. I can also reproduce the crash with the SocketSslEchoTest test when a direct buffer is being used (even on 1.8.0_20). I'll start filing a bug report with Oracle. Lets leave this issue open, and the work-around in until we verify with upstream JDK that is in fact an upstream issue and a fix is identified.

@normanmaurer
Copy link
Member

@Scottmitch thanks man! Please also add the link to the issue here for easier reference

@Scottmitch
Copy link
Member Author

Oracle bug report filed with Review ID: JI-9018014. I have not yet attempted to get a minimal set of code (without netty framework) which reproduces the issue because we have a reliable reproducer with SocketSslEchoTest. If I get more cycles, and if the upstream JDK folks need more support I will re-visit. I will post updates from oracle when they are discovered in this issue.

@Scottmitch
Copy link
Member Author

@normanmaurer - Will do. Oracle's process includes a pre-screening of "reports" (identified by the Review ID) which then will be assigned another ID if they decide to turn it into a bug report. I'll post the new ID (with a link) when it is assigned.

@Scottmitch
Copy link
Member Author

I just built and ran with OpenJDK 1.8.0u20 (25.20-b23) and the JVM still crashes with what looks like a very similar stacktrace.

@trustin
Copy link
Member

trustin commented Jan 9, 2015

Problem is still there with 1.8.0u25.

@Scottmitch
Copy link
Member Author

I was not clear in my previous response but I also can reliably reproduce with Oracle JDK 1.8.0u25 (this is the version the bug report was filed against). Just giving some additional perspective that it is not specific to Oracle JDK. Still waiting for a response from Oracle (no support contract and so I just filed a general report).

@WhiteTrashLord
Copy link

JDK 7 is also affected?

@normanmaurer
Copy link
Member

Nope GCM is only supported with java 8+

Am 11.01.2015 um 09:45 schrieb WhiteTrashLord notifications@github.com:

JDK 7 is also affected?


Reply to this email directly or view it on GitHub.

@trustin
Copy link
Member

trustin commented Jan 19, 2015

It's up now: https://bugs.openjdk.java.net/browse/JDK-8068574
Thanks, @Scottmitch :-)

@Scottmitch
Copy link
Member Author

@trustin @normanmaurer - I can't remember my login credentials to the open JDK site (or if I even have one). It looks like a few engineers are having trouble building netty, but I can't reach out to them to help. Would you mind posting a link to this issue in the openjdk bug? I may have filed the bug under my old work email which I no longer have access to...password reset isn't very helpful.

@trustin
Copy link
Member

trustin commented Mar 23, 2015

@Scottmitch Do you know where I can sign up for an account? I'm not sure I have an account, but I don't seem to get any password reset messages.

@Scottmitch
Copy link
Member Author

@trustin - Yah I'm in the same boat...no I don't know how to create an account. From https://wiki.openjdk.java.net/display/general/JBS+Overview At the time of launch, self-service account creation is not supported so account support seems limited.

@netty/contributors - Anyone have an openjdk account which they can login with? I'm going to reach out to discuss@openjdk.java.net in the mean time to see if we can get someone's attention.

@johnou
Copy link
Contributor

johnou commented Jan 20, 2016

@Scottmitch you could try reaching out to Nils directly? nils.eliasson[at]oracle.com

@Scottmitch
Copy link
Member Author

@johnou - Thanks for brining my attention back to this. I generated an email directly to Nils.

@johnou
Copy link
Contributor

johnou commented Feb 2, 2016

@Scottmitch if you don't hear back from Nils you could also try Rory at rory.odonnell[at]oracle.com (he is active).

@Scottmitch
Copy link
Member Author

@johnou - Thanks, I emailed Rory as well.

Scottmitch added a commit to Scottmitch/netty that referenced this issue Feb 16, 2016
Motivation:
Commit 108dc23 introduced a workaround due to a JDK crash when GCM cipher was used during an unwrap operation. Attempting to reproduce this issue with the latest JDK (1.8.0_72-b15) demonstrate that this issue no longer exists while it can be reliably reproduced on earlier JDKs (1.8.0_25-b17 and earlier)

Modifications:
- Remove the copy-to-heap-buffer workaround for JDK engine

Result:
Fixes netty#3256
normanmaurer pushed a commit that referenced this issue Feb 18, 2016
Motivation:
Commit 108dc23 introduced a workaround due to a JDK crash when GCM cipher was used during an unwrap operation. Attempting to reproduce this issue with the latest JDK (1.8.0_72-b15) demonstrate that this issue no longer exists while it can be reliably reproduced on earlier JDKs (1.8.0_25-b17 and earlier)

Modifications:
- Remove the copy-to-heap-buffer workaround for JDK engine

Result:
Fixes #3256
@normanmaurer
Copy link
Member

Fixed #4875

@normanmaurer normanmaurer assigned Scottmitch and unassigned trustin Feb 18, 2016
pulllock pushed a commit to pulllock/netty that referenced this issue Oct 19, 2023
Motivation:
Commit 108dc23 introduced a workaround due to a JDK crash when GCM cipher was used during an unwrap operation. Attempting to reproduce this issue with the latest JDK (1.8.0_72-b15) demonstrate that this issue no longer exists while it can be reliably reproduced on earlier JDKs (1.8.0_25-b17 and earlier)

Modifications:
- Remove the copy-to-heap-buffer workaround for JDK engine

Result:
Fixes netty#3256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants