8277970: Test jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java fails with "tag mismatch"

Reviewed-by: jnimeh, xuelei
This commit is contained in:
Daniel Jeliński 2022-10-12 15:32:36 +00:00
parent 0475c34120
commit d1252653b0
3 changed files with 8 additions and 3 deletions

View File

@ -255,7 +255,11 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord {
// Decrypt the fragment // Decrypt the fragment
// //
ByteBuffer fragment; ByteBuffer fragment;
recordLock.lock();
try { try {
if (isClosed) {
return null;
}
Plaintext plaintext = Plaintext plaintext =
readCipher.decrypt(contentType, recordBody, null); readCipher.decrypt(contentType, recordBody, null);
fragment = plaintext.fragment; fragment = plaintext.fragment;
@ -264,6 +268,8 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord {
throw bpe; throw bpe;
} catch (GeneralSecurityException gse) { } catch (GeneralSecurityException gse) {
throw new SSLProtocolException("Unexpected exception", gse); throw new SSLProtocolException("Unexpected exception", gse);
} finally {
recordLock.unlock();
} }
if (contentType != ContentType.HANDSHAKE.id && if (contentType != ContentType.HANDSHAKE.id &&

View File

@ -616,7 +616,6 @@ com/sun/security/sasl/gsskerb/NoSecurityLayer.java 8039280 generic-
sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-all sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-all
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java 8277970 linux-all,macosx-x64
############################################################################ ############################################################################

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@
/* /*
* @test * @test
* @bug 8274736 * @bug 8274736 8277970
* @summary Concurrent read/close of SSLSockets causes SSLSessions to be * @summary Concurrent read/close of SSLSockets causes SSLSessions to be
* invalidated unnecessarily * invalidated unnecessarily
* @library /javax/net/ssl/templates * @library /javax/net/ssl/templates