This commit is contained in:
Jesper Wilhelmsson 2021-07-13 10:50:18 +00:00
commit 6b123b0591
7 changed files with 37 additions and 6 deletions
src
hotspot/share/prims
java.base/share/classes/sun/security/provider
java.desktop/macosx/native/libosxapp
test
hotspot/jtreg/serviceability/sa
jdk/java/nio/file/spi

@ -15036,6 +15036,11 @@ typedef void (JNICALL *jvmtiEventVMInit)
- Specify that RedefineClasses and RetransformClasses are not allowed
to change the class file PermittedSubclasses attribute.
</change>
<change date="15 January 2021" version="17.0.0">
Minor clarification in the section "Agent Shutdown" that says the
implementation may choose to not call the Agent_OnUnload function
if the Agent_OnAttach/Agent_OnAttach_L function reported an error.
</change>
<change date="8 June 2021" version="17.0.0">
Minor update to deprecate Heap functions 1.0.
</change>

@ -44,6 +44,7 @@ import java.util.concurrent.ConcurrentHashMap;
import jdk.internal.access.JavaSecurityAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.util.StaticProperty;
import sun.nio.fs.DefaultFileSystemProvider;
import sun.security.util.*;
import sun.net.www.ParseUtil;
@ -276,6 +277,13 @@ public class PolicyFile extends java.security.Policy {
private static Set<URL> badPolicyURLs =
Collections.newSetFromMap(new ConcurrentHashMap<URL,Boolean>());
/**
* Use the platform's default file system to avoid recursive initialization
* issues when the VM is configured to use a custom file system provider.
*/
private static final java.nio.file.FileSystem builtInFS =
DefaultFileSystemProvider.theFileSystem();
/**
* Initializes the Policy object and reads the default policy
* configuration file(s) into the Policy object.
@ -475,7 +483,7 @@ public class PolicyFile extends java.security.Policy {
}
private void initDefaultPolicy(PolicyInfo newInfo) {
Path defaultPolicy = Path.of(StaticProperty.javaHome(),
Path defaultPolicy = builtInFS.getPath(StaticProperty.javaHome(),
"lib",
"security",
"default.policy");

@ -33,7 +33,7 @@
JavaVM *jvm = NULL;
static JNIEnv *appKitEnv = NULL;
static jobject appkitThreadGroup = NULL;
static NSString* JavaRunLoopMode = @"javaRunLoopMode";
static NSString* JavaRunLoopMode = @"AWTRunLoopMode";
static NSArray<NSString*> *javaModes = nil;
static inline void attachCurrentThread(void** env) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
@ -56,7 +56,6 @@ public class ClhsdbField {
"field InstanceKlass _constants ConstantPool*",
"field Klass _name Symbol*",
"field JavaThread _osthread OSThread*",
"field JVMState _bci",
"field TenuredGeneration _the_space ContiguousSpace*",
"field VirtualSpace _low_boundary char*",
"field MethodCounters _backedge_counter InvocationCounter",

@ -58,7 +58,6 @@ public class ClhsdbVmStructsDump {
"type ClassLoaderData* null",
"field JavaThread _osthread OSThread*",
"type TenuredGeneration CardGeneration",
"field JVMState _bci",
"type Universe null",
"type ConstantPoolCache MetaspaceObj"));
test.run(theApp.getPid(), cmds, expStrMap, null);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -23,6 +23,7 @@
/**
* @test
* @bug 8266345
* @modules jdk.jartool
* @library /test/lib
* @build SetDefaultProvider TestProvider m/* jdk.test.lib.process.ProcessTools
@ -72,6 +73,22 @@ public class SetDefaultProvider {
assertTrue(exitValue == 0);
}
/**
* Test override of default FileSystemProvider with the main application
* on the class path and a SecurityManager enabled.
*/
public void testClassPathWithSecurityManager() throws Exception {
String moduleClasses = moduleClasses();
String testClasses = System.getProperty("test.classes");
String classpath = moduleClasses + File.pathSeparator + testClasses;
String policyFile = System.getProperty("test.src", ".")
+ File.separator + "fs.policy";
int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath,
"-Dtest.classes=" + testClasses, "-Djava.security.manager",
"-Djava.security.policy==" + policyFile, "p.Main");
assertTrue(exitValue == 0);
}
/**
* Test override of default FileSystemProvider with the main application
* on the module path as an exploded module.

@ -0,0 +1,3 @@
grant codeBase "file:${test.classes}${/}-" {
permission java.io.FilePermission "${java.io.tmpdir}${/}-", "write";
};