Skip to content

Commit

Permalink
Merge pull request #180 from SAP/pr-jdk-11.0.1+13
Browse files Browse the repository at this point in the history
Merge to tag jdk-11.0.1+13
  • Loading branch information
simonis committed Oct 17, 2018
2 parents 0c58c71 + 1727c94 commit eb39d46
Show file tree
Hide file tree
Showing 46 changed files with 1,123 additions and 198 deletions.
14 changes: 14 additions & 0 deletions .hgtags
Expand Up @@ -501,3 +501,17 @@ ea900a7dc7d77dee30865c60eabd87fc24b1037c jdk-11+24
331888ea4a788df801b1edf8836646cd25fc758b jdk-11+25
945ba9278a272a5477ffb1b3ea1b04174fed8036 jdk-11+26
9d7d74c6f2cbe522e39fa22dc557fdd3f79b32ad jdk-11+27
76072a077ee1d815152d45d1692c4b36c53c5c49 jdk-11+28
1353ec839c82de926bfacd2c7976b6b652d4afb0 jdk-11.0.1+1
781b5d8f2f75ae4dfdafc85630e5dbd31e324ed1 jdk-11.0.1+3
fc55f0667af5ea3b21e40a59e2a88b1b82e65e62 jdk-11.0.1+2
c01cc45790f871adec30acc90742b521d57a2fff jdk-11.0.1+0
b5b1dd7e6f9d86aedf7141e9279342fae257bd67 jdk-11.0.1+4
d6efeebf554c918bfab50f89939eb11121e18432 jdk-11.0.1+5
db768cfe2141b3eb9ef53d7104002a0532c8c977 jdk-11.0.1+6
88a221c0bad0cee441767106776628550d660a82 jdk-11.0.1+7
c2b23a17d3ff92235aed8e8d04642d7a6eaecf54 jdk-11.0.1+8
adb9933aa8c68e6dec6b441133f3955fe7366206 jdk-11.0.1+9
a86e14193fc8ea98835fd3e2f867447164c7af53 jdk-11.0.1+10
0343f9aacae2d4a9e6df4e61087837166a6a477c jdk-11.0.1+11
c0431cf9c38e5c56eedc680e007a94c4279a8f13 jdk-11.0.1+12
4 changes: 2 additions & 2 deletions make/autoconf/version-numbers
Expand Up @@ -27,9 +27,9 @@

DEFAULT_VERSION_FEATURE=11
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_UPDATE=1
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_DATE=2018-09-25
DEFAULT_VERSION_DATE=2018-10-16
DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11"
Expand Down
100 changes: 50 additions & 50 deletions src/hotspot/share/interpreter/linkResolver.cpp
Expand Up @@ -987,68 +987,68 @@ void LinkResolver::resolve_field(fieldDescriptor& fd,
THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string());
}

if (!link_info.check_access())
// Access checking may be turned off when calling from within the VM.
return;

// check access
// Access checking may be turned off when calling from within the VM.
Klass* current_klass = link_info.current_klass();
check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);

// check for errors
if (is_static != fd.is_static()) {
ResourceMark rm(THREAD);
char msg[200];
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
}
if (link_info.check_access()) {

// A final field can be modified only
// (1) by methods declared in the class declaring the field and
// (2) by the <clinit> method (in case of a static field)
// or by the <init> method (in case of an instance field).
if (is_put && fd.access_flags().is_final()) {
ResourceMark rm(THREAD);
stringStream ss;
// check access
check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);

if (sel_klass != current_klass) {
ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
current_klass->external_name());
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
// check for errors
if (is_static != fd.is_static()) {
ResourceMark rm(THREAD);
char msg[200];
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
}

if (fd.constants()->pool_holder()->major_version() >= 53) {
methodHandle m = link_info.current_method();
assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
fd.is_static() &&
!m()->is_static_initializer());
bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
!fd.is_static() &&
!m->is_object_initializer());

if (is_initialized_static_final_update || is_initialized_instance_final_update) {
ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
// A final field can be modified only
// (1) by methods declared in the class declaring the field and
// (2) by the <clinit> method (in case of a static field)
// or by the <init> method (in case of an instance field).
if (is_put && fd.access_flags().is_final()) {
ResourceMark rm(THREAD);
stringStream ss;

if (sel_klass != current_klass) {
ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
m()->name()->as_C_string(),
is_static ? "<clinit>" : "<init>");
current_klass->external_name());
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
}

if (fd.constants()->pool_holder()->major_version() >= 53) {
methodHandle m = link_info.current_method();
assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
fd.is_static() &&
!m()->is_static_initializer());
bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
!fd.is_static() &&
!m->is_object_initializer());

if (is_initialized_static_final_update || is_initialized_instance_final_update) {
ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
m()->name()->as_C_string(),
is_static ? "<clinit>" : "<init>");
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
}
}
}
}

// initialize resolved_klass if necessary
// note 1: the klass which declared the field must be initialized (i.e, sel_klass)
// according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
//
// note 2: we don't want to force initialization if we are just checking
// if the field access is legal; e.g., during compilation
if (is_static && initialize_class) {
sel_klass->initialize(CHECK);
// initialize resolved_klass if necessary
// note 1: the klass which declared the field must be initialized (i.e, sel_klass)
// according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
//
// note 2: we don't want to force initialization if we are just checking
// if the field access is legal; e.g., during compilation
if (is_static && initialize_class) {
sel_klass->initialize(CHECK);
}
}

if (sel_klass != current_klass) {
if ((sel_klass != current_klass) && (current_klass != NULL)) {
check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK);
}

Expand Down
Expand Up @@ -69,10 +69,13 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
*/
int count;

private static final byte[] EMPTYVALUE = new byte[0];

/**
* This no-arg constructor is necessary for serialization of subclasses.
*/
AbstractStringBuilder() {
value = EMPTYVALUE;
}

/**
Expand Down
10 changes: 7 additions & 3 deletions src/java.base/share/classes/java/net/InetAddress.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,6 +35,7 @@
import java.io.ObjectStreamException;
import java.io.ObjectStreamField;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectInputStream.GetField;
import java.io.ObjectOutputStream;
Expand Down Expand Up @@ -1728,8 +1729,11 @@ private void readObject (ObjectInputStream s) throws
}
GetField gf = s.readFields();
String host = (String)gf.get("hostName", null);
int address= gf.get("address", 0);
int family= gf.get("family", 0);
int address = gf.get("address", 0);
int family = gf.get("family", 0);
if (family != IPv4 && family != IPv6) {
throw new InvalidObjectException("invalid address family type: " + family);
}
InetAddressHolder h = new InetAddressHolder(host, address, family);
UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
Expand Down
18 changes: 15 additions & 3 deletions src/java.base/share/classes/java/net/NetworkInterface.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -321,8 +321,20 @@ public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketE
if (addr == null) {
throw new NullPointerException();
}
if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) {
throw new IllegalArgumentException ("invalid address type");
if (addr instanceof Inet4Address) {
Inet4Address inet4Address = (Inet4Address) addr;
if (inet4Address.holder.family != InetAddress.IPv4) {
throw new IllegalArgumentException("invalid family type: "
+ inet4Address.holder.family);
}
} else if (addr instanceof Inet6Address) {
Inet6Address inet6Address = (Inet6Address) addr;
if (inet6Address.holder.family != InetAddress.IPv6) {
throw new IllegalArgumentException("invalid family type: "
+ inet6Address.holder.family);
}
} else {
throw new IllegalArgumentException("invalid address type: " + addr);
}
return getByInetAddress0(addr);
}
Expand Down
10 changes: 6 additions & 4 deletions src/java.base/share/classes/java/net/URLClassLoader.java
Expand Up @@ -570,13 +570,13 @@ private Class<?> defineClass(String name, Resource res) throws IOException {
* @spec JPMS
*/
protected Package definePackage(String name, Manifest man, URL url) {
String path = name.replace('.', '/').concat("/");
String specTitle = null, specVersion = null, specVendor = null;
String implTitle = null, implVersion = null, implVendor = null;
String sealed = null;
URL sealBase = null;

Attributes attr = man.getAttributes(path);
Attributes attr = SharedSecrets.javaUtilJarAccess()
.getTrustedAttributes(man, name.replace('.', '/').concat("/"));
if (attr != null) {
specTitle = attr.getValue(Name.SPECIFICATION_TITLE);
specVersion = attr.getValue(Name.SPECIFICATION_VERSION);
Expand Down Expand Up @@ -620,10 +620,12 @@ protected Package definePackage(String name, Manifest man, URL url) {
/*
* Returns true if the specified package name is sealed according to the
* given manifest.
*
* @throws SecurityException if the package name is untrusted in the manifest
*/
private boolean isSealed(String name, Manifest man) {
String path = name.replace('.', '/').concat("/");
Attributes attr = man.getAttributes(path);
Attributes attr = SharedSecrets.javaUtilJarAccess()
.getTrustedAttributes(man, name.replace('.', '/').concat("/"));
String sealed = null;
if (attr != null) {
sealed = attr.getValue(Name.SEALED);
Expand Down
34 changes: 9 additions & 25 deletions src/java.base/share/classes/java/util/jar/JarFile.java
Expand Up @@ -417,10 +417,10 @@ private Manifest getManifestFromReference() throws IOException {
if (manEntry != null) {
if (verify) {
byte[] b = getBytes(manEntry);
man = new Manifest(new ByteArrayInputStream(b));
if (!jvInitialized) {
jv = new JarVerifier(b);
}
man = new Manifest(jv, new ByteArrayInputStream(b));
} else {
man = new Manifest(super.getInputStream(manEntry));
}
Expand Down Expand Up @@ -1010,37 +1010,21 @@ private void checkForSpecialAttributes() throws IOException {
int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC,
MULTIRELEASE_OPTOSFT);
if (i != -1) {
i += MULTIRELEASE_CHARS.length;
if (i < b.length) {
byte c = b[i++];
// Check that the value is followed by a newline
// and does not have a continuation
if (c == '\n' &&
(i == b.length || b[i] != ' ')) {
isMultiRelease = true;
} else if (c == '\r') {
if (i == b.length) {
isMultiRelease = true;
} else {
c = b[i++];
if (c == '\n') {
if (i == b.length || b[i] != ' ') {
isMultiRelease = true;
}
} else if (c != ' ') {
isMultiRelease = true;
}
}
}
}
// Read the main attributes of the manifest
byte[] lbuf = new byte[512];
Attributes attr = new Attributes();
attr.read(new Manifest.FastInputStream(
new ByteArrayInputStream(b)), lbuf);
isMultiRelease = Boolean.parseBoolean(
attr.getValue(Attributes.Name.MULTI_RELEASE));
}
}
}
hasCheckedSpecialAttributes = true;
}
}

private synchronized void ensureInitialization() {
synchronized void ensureInitialization() {
try {
maybeInstantiateVerifier();
} catch (IOException e) {
Expand Down
22 changes: 21 additions & 1 deletion src/java.base/share/classes/java/util/jar/JarVerifier.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -858,4 +858,24 @@ public synchronized List<Object> getManifestDigests() {
static CodeSource getUnsignedCS(URL url) {
return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null);
}

/**
* Returns whether the name is trusted. Used by
* {@link Manifest#getTrustedAttributes(String)}.
*/
boolean isTrustedManifestEntry(String name) {
// How many signers? MANIFEST.MF is always verified
CodeSigner[] forMan = verifiedSigners.get(JarFile.MANIFEST_NAME);
if (forMan == null) {
return true;
}
// Check sigFileSigners first, because we are mainly dealing with
// non-file entries which will stay in sigFileSigners forever.
CodeSigner[] forName = sigFileSigners.get(name);
if (forName == null) {
forName = verifiedSigners.get(name);
}
// Returns trusted if all signers sign the entry
return forName != null && forName.length == forMan.length;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -60,4 +60,12 @@ public void setEagerValidation(JarFile jar, boolean eager) {
public List<Object> getManifestDigests(JarFile jar) {
return jar.getManifestDigests();
}

public Attributes getTrustedAttributes(Manifest man, String name) {
return man.getTrustedAttributes(name);
}

public void ensureInitialization(JarFile jar) {
jar.ensureInitialization();
}
}

0 comments on commit eb39d46

Please sign in to comment.