Skip to content
Permalink
Browse files

Merge

  • Loading branch information
JesperIRL committed Jan 16, 2020
2 parents 76e420d + b4ba743 commit 51d5164ca2b4801c14466e8d1420ecf27cb7615f
Showing with 2,041 additions and 951 deletions.
  1. +1 −0 .hgtags
  2. +7 −4 src/hotspot/share/oops/klassVtable.cpp
  3. +19 −42 src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java
  4. +11 −8 src/java.base/share/classes/java/io/ObjectInputFilter.java
  5. +66 −10 src/java.base/share/classes/java/io/ObjectInputStream.java
  6. +126 −34 src/java.base/share/classes/java/math/BigDecimal.java
  7. +1 −1 src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
  8. +10 −7 src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java
  9. +18 −5 src/java.base/share/classes/java/net/SocketCleanable.java
  10. +5 −2 src/java.base/share/classes/java/net/URL.java
  11. +2 −0 src/java.base/share/classes/java/nio/file/Files.java
  12. +1 −1 src/java.base/share/classes/java/security/CodeSource.java
  13. +1 −1 src/java.base/share/classes/java/security/UnresolvedPermission.java
  14. +1 −1 src/java.base/share/classes/java/security/cert/CertificateRevokedException.java
  15. +38 −0 src/java.base/share/classes/jdk/internal/access/JavaObjectInputStreamReadString.java
  16. +12 −0 src/java.base/share/classes/jdk/internal/access/SharedSecrets.java
  17. +15 −1 src/java.base/share/classes/jdk/internal/util/StaticProperty.java
  18. +8 −11 src/java.base/share/classes/sun/security/provider/JavaKeyStore.java
  19. +8 −2 src/java.base/share/classes/sun/security/ssl/Alert.java
  20. +8 −0 src/java.base/share/classes/sun/security/ssl/CertificateMessage.java
  21. +37 −0 src/java.base/share/classes/sun/security/ssl/CertificateVerify.java
  22. +9 −0 src/java.base/share/classes/sun/security/ssl/ClientHello.java
  23. +30 −0 src/java.base/share/classes/sun/security/ssl/Finished.java
  24. +1 −1 src/java.base/share/classes/sun/security/util/DerValue.java
  25. +18 −52 src/java.base/share/classes/sun/security/util/IOUtils.java
  26. +77 −23 src/java.base/share/classes/sun/security/validator/PKIXValidator.java
  27. +1 −1 src/java.base/share/classes/sun/security/x509/AVA.java
  28. +77 −99 src/java.base/share/classes/sun/security/x509/X500Name.java
  29. +7 −3 src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
  30. +13 −29 src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
  31. +3 −13 src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java
  32. +38 −10 src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c
  33. +1 −1 src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h
  34. +9 −1 src/java.rmi/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java
  35. +16 −10 src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl_Skel.java
  36. +5 −0 src/java.rmi/share/classes/sun/rmi/server/UnicastRef.java
  37. +5 −1 src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java
  38. +63 −86 src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java
  39. +1 −21 src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java
  40. +2 −2 src/java.security.jgss/share/classes/sun/security/krb5/internal/NetClient.java
  41. +1 −0 src/java.security.jgss/share/classes/sun/security/krb5/internal/PAForUserEnc.java
  42. +4 −4 src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
  43. +19 −36 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/CksumType.java
  44. +7 −11 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Crc32CksumType.java
  45. +1 −1 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesCbcCrcEType.java
  46. +3 −7 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java
  47. +4 −8 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacKCksumType.java
  48. +4 −10 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java
  49. +4 −10 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java
  50. +4 −10 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java
  51. +4 −10 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java
  52. +4 −8 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha2Aes128CksumType.java
  53. +4 −8 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha2Aes256CksumType.java
  54. +5 −15 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5CksumType.java
  55. +6 −11 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java
  56. +79 −21 src/java.security.jgss/windows/native/libsspi_bridge/sspi.cpp
  57. +32 −2 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
  58. +2 −0 src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
  59. +5 −0 src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/AbstractLayout.java
  60. +4 −4 src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java
  61. +113 −27 src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java
  62. +1 −1 src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayouts.java
  63. +3 −3 src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java
  64. +12 −0 src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/SequenceLayout.java
  65. +84 −14 src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/LayoutPath.java
  66. +1 −1 src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/MemoryAddressImpl.java
  67. +2 −2 src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/MemorySegmentImpl.java
  68. +22 −2 src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java
  69. +3 −1 src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
  70. +3 −1 src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
  71. +2 −0 test/hotspot/jtreg/ProblemList-aot.txt
  72. +145 −0 test/jdk/java/foreign/TestLayoutPaths.java
  73. +19 −2 test/jdk/java/foreign/TestLayouts.java
  74. +1 −1 test/jdk/java/foreign/TestMemoryAccess.java
  75. +1 −1 test/jdk/java/foreign/TestMemoryAlignment.java
  76. +3 −7 test/jdk/java/foreign/TestMemoryCopy.java
  77. +27 −2 test/jdk/java/foreign/TestSegments.java
  78. +1 −1 test/jdk/java/foreign/TestVarHandleCombinators.java
  79. +3 −3 test/jdk/java/io/Reader/TransferTo.java
  80. +22 −8 test/jdk/java/io/Serializable/serialFilter/GlobalFilterTest.java
  81. +1 −1 test/jdk/java/io/Serializable/serialFilter/security.policy
  82. +534 −19 test/jdk/java/math/BigDecimal/SquareRootTests.java
  83. +2 −2 test/jdk/java/nio/Buffer/Basic.java
  84. +3 −14 test/jdk/sun/security/krb5/auto/KDC.java
  85. +0 −138 test/jdk/sun/security/krb5/auto/SaslGSS.java
  86. +5 −11 test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java
  87. +1 −1 test/jdk/sun/security/tools/jarsigner/DefaultOptions.java
  88. +1 −1 test/jdk/sun/security/tools/jarsigner/EC.java
  89. +1 −1 test/jdk/sun/security/tools/jarsigner/JavaKeyStoreAliasCaseInsensitive.java
  90. +1 −1 test/jdk/sun/security/tools/jarsigner/OnlyManifest.java
  91. +2 −1 test/jdk/sun/security/tools/jarsigner/TsacertOptionTest.java
  92. +2 −2 test/jdk/sun/security/tools/jarsigner/Warning.java
  93. +2 −2 test/jdk/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java
  94. +2 −2 test/jdk/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java
  95. +2 −2 test/jdk/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java
  96. +2 −2 test/jdk/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java
  97. +2 −2 test/jdk/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java
  98. +1 −1 test/jdk/sun/security/tools/jarsigner/warnings/NoTimestampTest.java
  99. +2 −2 test/jdk/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java
  100. +8 −8 test/jdk/sun/security/util/DerValue/BadValue.java
  101. +2 −1 test/jdk/sun/security/validator/EndEntityExtensionCheck.java
  102. +30 −1 test/langtools/tools/javac/T8177068/NoCompletionFailureSkipOnSpeculativeAttribution.java
@@ -610,4 +610,5 @@ d54ce919da90dab361995bb4d87be9851f00537a jdk-14+30
bb0a7975b31ded63d594ee8dbfc4d4ead587f79b jdk-15+4
decd3d2953b640f1043ee76953ff89238bff92e8 jdk-14+31
b97c1773ccafae4a8c16cc6aedb10b2a4f9a07ed jdk-15+5
2776da28515e087cc8849acf1e131a65ea7e77b6 jdk-14+32
ef7d53b4fccd4a0501b17d974e84f37aa99fa813 jdk-15+6
@@ -291,23 +291,26 @@ InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper
int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
InstanceKlass* superk = initialsuper;
while (superk != NULL && superk->super() != NULL) {
InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super());
klassVtable ssVtable = supersuperklass->vtable();
klassVtable ssVtable = (superk->super())->vtable();
if (vtable_index < ssVtable.length()) {
Method* super_method = ssVtable.method_at(vtable_index);
// get the class holding the matching method
// make sure you use that class for is_override
InstanceKlass* supermethodholder = super_method->method_holder();
#ifndef PRODUCT
Symbol* name= target_method()->name();
Symbol* signature = target_method()->signature();
assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch");
#endif
if (supersuperklass->is_override(methodHandle(THREAD, super_method), target_loader, target_classname, THREAD)) {

if (supermethodholder->is_override(methodHandle(THREAD, super_method), target_loader, target_classname, THREAD)) {
if (log_develop_is_enabled(Trace, vtables)) {
ResourceMark rm(THREAD);
LogTarget(Trace, vtables) lt;
LogStream ls(lt);
char* sig = target_method()->name_and_sig_as_C_string();
ls.print("transitive overriding superclass %s with %s index %d, original flags: ",
supersuperklass->internal_name(),
supermethodholder->internal_name(),
sig, vtable_index);
super_method->print_linkage_flags(&ls);
ls.print("overriders flags: ");
@@ -26,6 +26,7 @@
package com.sun.crypto.provider;

import sun.security.util.Debug;
import sun.security.util.IOUtils;

import java.io.*;
import java.util.*;
@@ -73,7 +74,7 @@
private static final class PrivateKeyEntry {
Date date; // the creation date of this entry
byte[] protectedKey;
Certificate chain[];
Certificate[] chain;
};

// Secret key
@@ -742,51 +743,36 @@ public void engineLoad(InputStream stream, char[] password)
entry.date = new Date(dis.readLong());

// read the private key
try {
entry.protectedKey = new byte[dis.readInt()];
} catch (OutOfMemoryError e) {
throw new IOException("Keysize too big");
}
dis.readFully(entry.protectedKey);
entry.protectedKey = IOUtils.readExactlyNBytes(dis, dis.readInt());

// read the certificate chain
int numOfCerts = dis.readInt();
try {
if (numOfCerts > 0) {
entry.chain = new Certificate[numOfCerts];
}
} catch (OutOfMemoryError e) {
throw new IOException("Too many certificates in "
+ "chain");
}
List<Certificate> tmpCerts = new ArrayList<>();
for (int j = 0; j < numOfCerts; j++) {
if (xVersion == 2) {
// read the certificate type, and instantiate a
// certificate factory of that type (reuse
// existing factory if possible)
String certType = dis.readUTF();
if (cfs.containsKey(certType)) {
// reuse certificate factory
// reuse certificate factory
cf = cfs.get(certType);
} else {
// create new certificate factory
// create new certificate factory
cf = CertificateFactory.getInstance(
certType);
// store the certificate factory so we can
// reuse it later
// store the certificate factory so we can
// reuse it later
cfs.put(certType, cf);
}
}
// instantiate the certificate
try {
encoded = new byte[dis.readInt()];
} catch (OutOfMemoryError e) {
throw new IOException("Certificate too big");
}
dis.readFully(encoded);
encoded = IOUtils.readExactlyNBytes(dis, dis.readInt());
bais = new ByteArrayInputStream(encoded);
entry.chain[j] = cf.generateCertificate(bais);
tmpCerts.add(cf.generateCertificate(bais));
}
entry.chain = tmpCerts.toArray(
new Certificate[numOfCerts]);

// Add the entry to the list
entries.put(alias, entry);
@@ -818,12 +804,7 @@ public void engineLoad(InputStream stream, char[] password)
cfs.put(certType, cf);
}
}
try {
encoded = new byte[dis.readInt()];
} catch (OutOfMemoryError e) {
throw new IOException("Certificate too big");
}
dis.readFully(encoded);
encoded = IOUtils.readExactlyNBytes(dis, dis.readInt());
bais = new ByteArrayInputStream(encoded);
entry.cert = cf.generateCertificate(bais);

@@ -882,18 +863,14 @@ public void engineLoad(InputStream stream, char[] password)
* with
*/
if (password != null) {
byte computed[], actual[];
computed = md.digest();
actual = new byte[computed.length];
dis.readFully(actual);
for (int i = 0; i < computed.length; i++) {
if (computed[i] != actual[i]) {
throw new IOException(
byte[] computed = md.digest();
byte[] actual = IOUtils.readExactlyNBytes(dis, computed.length);
if (!MessageDigest.isEqual(computed, actual)) {
throw new IOException(
"Keystore was tampered with, or "
+ "password was incorrect",
new UnrecoverableKeyException(
"Password verification failed"));
}
new UnrecoverableKeyException(
"Password verification failed"));
}
}
} finally {
@@ -35,6 +35,7 @@
import java.util.function.Function;

import jdk.internal.access.SharedSecrets;
import jdk.internal.util.StaticProperty;

/**
* Filter classes, array lengths, and graph metrics during deserialization.
@@ -205,15 +206,17 @@
* <p>
* The filter is configured during the initialization of the {@code ObjectInputFilter.Config}
* class. For example, by calling {@link #getSerialFilter() Config.getSerialFilter}.
* If the system property {@systemProperty jdk.serialFilter} is defined, it is used
* to configure the filter.
* If the system property is not defined, and the {@link java.security.Security}
* property {@code jdk.serialFilter} is defined then it is used to configure the filter.
* Otherwise, the filter is not configured during initialization.
* If the system property {@systemProperty jdk.serialFilter} is defined on the command line,
* it is used to configure the filter.
* If the system property is not defined on the command line, and the
* {@link java.security.Security} property {@code jdk.serialFilter} is defined
* then it is used to configure the filter.
* Otherwise, the filter is not configured during initialization and
* can be set with {@link #setSerialFilter(ObjectInputFilter) Config.setSerialFilter}.
* Setting the {@code jdk.serialFilter} with {@link System#setProperty(String, String)
* System.setProperty} <em>does not set the filter</em>.
* The syntax for each property is the same as for the
* {@link #createFilter(String) createFilter} method.
* If a filter is not configured, it can be set with
* {@link #setSerialFilter(ObjectInputFilter) Config.setSerialFilter}.
*
* @since 9
*/
@@ -256,7 +259,7 @@ static void filterLog(System.Logger.Level level, String msg, Object... args) {
static {
configuredFilter = AccessController
.doPrivileged((PrivilegedAction<ObjectInputFilter>) () -> {
String props = System.getProperty(SERIAL_FILTER_PROPNAME);
String props = StaticProperty.jdkSerialFilter();
if (props == null) {
props = Security.getProperty(SERIAL_FILTER_PROPNAME);
}
@@ -453,16 +453,50 @@ protected ObjectInputStream() throws IOException, SecurityException {
* @throws IOException Any of the usual Input/Output related exceptions.
*/
public final Object readObject()
throws IOException, ClassNotFoundException {
return readObject(Object.class);
}

/**
* Reads a String and only a string.
*
* @return the String read
* @throws EOFException If end of file is reached.
* @throws IOException If other I/O error has occurred.
*/
private String readString() throws IOException {
try {
return (String) readObject(String.class);
} catch (ClassNotFoundException cnf) {
throw new IllegalStateException(cnf);
}
}

/**
* Internal method to read an object from the ObjectInputStream of the expected type.
* Called only from {@code readObject()} and {@code readString()}.
* Only {@code Object.class} and {@code String.class} are supported.
*
* @param type the type expected; either Object.class or String.class
* @return an object of the type
* @throws IOException Any of the usual Input/Output related exceptions.
* @throws ClassNotFoundException Class of a serialized object cannot be
* found.
*/
private final Object readObject(Class<?> type)
throws IOException, ClassNotFoundException
{
if (enableOverride) {
return readObjectOverride();
}

if (! (type == Object.class || type == String.class))
throw new AssertionError("internal error");

// if nested read, passHandle contains handle of enclosing object
int outerHandle = passHandle;
try {
Object obj = readObject0(false);
Object obj = readObject0(type, false);
handles.markDependency(outerHandle, passHandle);
ClassNotFoundException ex = handles.lookupException(passHandle);
if (ex != null) {
@@ -557,7 +591,7 @@ public Object readUnshared() throws IOException, ClassNotFoundException {
// if nested read, passHandle contains handle of enclosing object
int outerHandle = passHandle;
try {
Object obj = readObject0(true);
Object obj = readObject0(Object.class, true);
handles.markDependency(outerHandle, passHandle);
ClassNotFoundException ex = handles.lookupException(passHandle);
if (ex != null) {
@@ -1577,8 +1611,10 @@ private void clear() {

/**
* Underlying readObject implementation.
* @param type a type expected to be deserialized; non-null
* @param unshared true if the object can not be a reference to a shared object, otherwise false
*/
private Object readObject0(boolean unshared) throws IOException {
private Object readObject0(Class<?> type, boolean unshared) throws IOException {
boolean oldMode = bin.getBlockDataMode();
if (oldMode) {
int remain = bin.currentBlockRemaining();
@@ -1610,29 +1646,48 @@ private Object readObject0(boolean unshared) throws IOException {
return readNull();

case TC_REFERENCE:
return readHandle(unshared);
// check the type of the existing object
return type.cast(readHandle(unshared));

case TC_CLASS:
if (type == String.class) {
throw new ClassCastException("Cannot cast a class to java.lang.String");
}
return readClass(unshared);

case TC_CLASSDESC:
case TC_PROXYCLASSDESC:
if (type == String.class) {
throw new ClassCastException("Cannot cast a class to java.lang.String");
}
return readClassDesc(unshared);

case TC_STRING:
case TC_LONGSTRING:
return checkResolve(readString(unshared));

case TC_ARRAY:
if (type == String.class) {
throw new ClassCastException("Cannot cast an array to java.lang.String");
}
return checkResolve(readArray(unshared));

case TC_ENUM:
if (type == String.class) {
throw new ClassCastException("Cannot cast an enum to java.lang.String");
}
return checkResolve(readEnum(unshared));

case TC_OBJECT:
if (type == String.class) {
throw new ClassCastException("Cannot cast an object to java.lang.String");
}
return checkResolve(readOrdinaryObject(unshared));

case TC_EXCEPTION:
if (type == String.class) {
throw new ClassCastException("Cannot cast an exception to java.lang.String");
}
IOException ex = readFatalException();
throw new WriteAbortedException("writing aborted", ex);

@@ -2004,7 +2059,7 @@ private Object readArray(boolean unshared) throws IOException {

if (ccl == null) {
for (int i = 0; i < len; i++) {
readObject0(false);
readObject0(Object.class, false);
}
} else if (ccl.isPrimitive()) {
if (ccl == Integer.TYPE) {
@@ -2029,7 +2084,7 @@ private Object readArray(boolean unshared) throws IOException {
} else {
Object[] oa = (Object[]) array;
for (int i = 0; i < len; i++) {
oa[i] = readObject0(false);
oa[i] = readObject0(Object.class, false);
handles.markDependency(arrayHandle, passHandle);
}
}
@@ -2393,7 +2448,7 @@ private void skipCustomData() throws IOException {
return;

default:
readObject0(false);
readObject0(Object.class, false);
break;
}
}
@@ -2438,7 +2493,7 @@ private FieldValues defaultReadFields(Object obj, ObjectStreamClass desc)
int numPrimFields = fields.length - objVals.length;
for (int i = 0; i < objVals.length; i++) {
ObjectStreamField f = fields[numPrimFields + i];
objVals[i] = readObject0(f.isUnshared());
objVals[i] = readObject0(Object.class, f.isUnshared());
if (f.getField() != null) {
handles.markDependency(objHandle, passHandle);
}
@@ -2479,7 +2534,7 @@ private IOException readFatalException() throws IOException {
throw new InternalError();
}
clear();
return (IOException) readObject0(false);
return (IOException) readObject0(Object.class, false);
}

/**
@@ -2601,7 +2656,7 @@ void readFields() throws IOException {
int numPrimFields = fields.length - objVals.length;
for (int i = 0; i < objVals.length; i++) {
objVals[i] =
readObject0(fields[numPrimFields + i].isUnshared());
readObject0(Object.class, fields[numPrimFields + i].isUnshared());
objHandles[i] = passHandle;
}
passHandle = oldHandle;
@@ -4090,6 +4145,7 @@ private static Object cloneArray(Object array) {

static {
SharedSecrets.setJavaObjectInputStreamAccess(ObjectInputStream::checkArray);
SharedSecrets.setJavaObjectInputStreamReadString(ObjectInputStream::readString);
}

}

0 comments on commit 51d5164

Please sign in to comment.