Skip to content

Commit c5e1595

Browse files
committed
Merge branch 'master' of https://github.com/openjdk/jdk into fix/lmf-hidden-serial-class-format
2 parents 40003cb + 63eb485 commit c5e1595

File tree

1,886 files changed

+5494
-65616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,886 files changed

+5494
-65616
lines changed

make/autoconf/flags-ldflags.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
7474
# Clang needs the lld linker to work correctly
7575
BASIC_LDFLAGS="-fuse-ld=lld -Wl,--exclude-libs,ALL"
7676
if test "x$CXX_IS_USER_SUPPLIED" = xfalse && test "x$CC_IS_USER_SUPPLIED" = xfalse; then
77-
UTIL_REQUIRE_PROGS(LLD, lld)
77+
UTIL_REQUIRE_PROGS(LLD, lld, $TOOLCHAIN_PATH:$PATH)
7878
fi
7979
fi
8080
if test "x$OPENJDK_TARGET_OS" = xaix; then

make/modules/java.base/Copy.gmk

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -123,46 +123,6 @@ TARGETS += $(JVMCFG)
123123

124124
################################################################################
125125

126-
POLICY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.policy
127-
POLICY_DST := $(CONF_DST_DIR)/security/java.policy
128-
129-
POLICY_SRC_LIST := $(POLICY_SRC)
130-
131-
$(POLICY_DST): $(POLICY_SRC_LIST)
132-
$(call MakeTargetDir)
133-
134-
$(foreach f, $(POLICY_SRC_LIST), $(CAT) $(f) >> [email protected];)
135-
136-
137-
TARGETS += $(POLICY_DST)
138-
139-
################################################################################
140-
141-
DEF_POLICY_SRC := $(TOPDIR)/src/java.base/share/lib/security/default.policy
142-
DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy
143-
144-
DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
145-
DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST)
146-
147-
ifeq ($(call isTargetOs, windows), true)
148-
DEF_POLICY_SRC_LIST += $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy
149-
endif
150-
151-
# Allow imported modules to modify the java.policy
152-
ifneq ($(IMPORT_MODULES_CONF), )
153-
DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra)
154-
endif
155-
156-
$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
157-
$(call MakeTargetDir)
158-
159-
$(foreach f, $(DEF_POLICY_SRC_LIST), $(CAT) $(f) >> [email protected];)
160-
161-
162-
TARGETS += $(DEF_POLICY_DST)
163-
164-
################################################################################
165-
166126
# CACERTS_FILE is optionally set in configure to override the default cacerts
167127
# which is otherwise generated in Gendata-java.base.gmk
168128
CACERTS_DST := $(LIB_DST_DIR)/security/cacerts

make/modules/java.rmi/Launcher.gmk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ include LauncherCommon.gmk
3131

3232
$(eval $(call SetupBuildLauncher, rmiregistry, \
3333
MAIN_CLASS := sun.rmi.registry.RegistryImpl, \
34-
JAVA_ARGS := -Djava.security.manager=allow, \
3534
))

src/hotspot/share/classfile/dictionary.cpp

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -347,68 +347,6 @@ void Dictionary::check_package_access(InstanceKlass* klass,
347347

348348
assert(class_loader() != nullptr, "Should not call this");
349349
assert(protection_domain() != nullptr, "Should not call this");
350-
351-
if (!java_lang_System::allow_security_manager()) {
352-
// No need for any further checking. Package access always allowed.
353-
return;
354-
}
355-
356-
if (is_in_package_access_cache(THREAD, klass->name(), protection_domain)) {
357-
// No need to check again.
358-
return;
359-
}
360-
361-
// We only have to call checkPackageAccess if there's a security manager installed.
362-
if (java_lang_System::has_security_manager()) {
363-
364-
// This handle and the class_loader handle passed in keeps this class from
365-
// being unloaded through several GC points.
366-
// The class_loader handle passed in is the initiating loader.
367-
Handle mirror(THREAD, klass->java_mirror());
368-
369-
// Now we have to call back to java to check if the initating class has access
370-
InstanceKlass* system_loader = vmClasses::ClassLoader_klass();
371-
JavaValue result(T_VOID);
372-
JavaCalls::call_special(&result,
373-
class_loader,
374-
system_loader,
375-
vmSymbols::checkPackageAccess_name(),
376-
vmSymbols::class_protectiondomain_signature(),
377-
mirror,
378-
protection_domain,
379-
THREAD);
380-
381-
LogTarget(Debug, protectiondomain) lt;
382-
if (lt.is_enabled()) {
383-
ResourceMark rm(THREAD);
384-
// Print out trace information
385-
LogStream ls(lt);
386-
ls.print_cr("Checking package access");
387-
ls.print("class loader: ");
388-
class_loader()->print_value_on(&ls);
389-
ls.print(" protection domain: ");
390-
protection_domain()->print_value_on(&ls);
391-
ls.print(" loading: "); klass->print_value_on(&ls);
392-
if (HAS_PENDING_EXCEPTION) {
393-
ls.print_cr(" DENIED !!!!!!!!!!!!!!!!!!!!!");
394-
} else {
395-
ls.print_cr(" granted");
396-
}
397-
}
398-
399-
if (HAS_PENDING_EXCEPTION) return;
400-
}
401-
402-
// If no exception has been thrown, we have checked that the protection_domain can access
403-
// this klass. Always add it to the cache (even if no SecurityManager is installed yet).
404-
//
405-
// This ensures that subsequent calls to Dictionary::find(THREAD, klass->name(), protection_domain)
406-
// will always succeed. I.e., a new SecurityManager installed in the future cannot retroactively
407-
// revoke the granted access.
408-
{
409-
MutexLocker mu(THREAD, SystemDictionary_lock);
410-
add_to_package_access_cache(THREAD, klass, protection_domain);
411-
}
412350
}
413351

414352
// During class loading we may have cached a protection domain that has

src/hotspot/share/classfile/javaClasses.cpp

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,6 @@ oop java_lang_Thread_Constants::get_VTHREAD_GROUP() {
15991599
int java_lang_Thread::_holder_offset;
16001600
int java_lang_Thread::_name_offset;
16011601
int java_lang_Thread::_contextClassLoader_offset;
1602-
int java_lang_Thread::_inheritedAccessControlContext_offset;
16031602
int java_lang_Thread::_eetop_offset;
16041603
int java_lang_Thread::_jvmti_thread_state_offset;
16051604
int java_lang_Thread::_jvmti_VTMS_transition_disable_count_offset;
@@ -1616,7 +1615,6 @@ JFR_ONLY(int java_lang_Thread::_jfr_epoch_offset;)
16161615
macro(_holder_offset, k, "holder", thread_fieldholder_signature, false); \
16171616
macro(_name_offset, k, vmSymbols::name_name(), string_signature, false); \
16181617
macro(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), classloader_signature, false); \
1619-
macro(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), accesscontrolcontext_signature, false); \
16201618
macro(_eetop_offset, k, "eetop", long_signature, false); \
16211619
macro(_interrupted_offset, k, "interrupted", bool_signature, false); \
16221620
macro(_interruptLock_offset, k, "interruptLock", object_signature, false); \
@@ -1794,10 +1792,6 @@ oop java_lang_Thread::context_class_loader(oop java_thread) {
17941792
return java_thread->obj_field(_contextClassLoader_offset);
17951793
}
17961794

1797-
oop java_lang_Thread::inherited_access_control_context(oop java_thread) {
1798-
return java_thread->obj_field(_inheritedAccessControlContext_offset);
1799-
}
1800-
18011795

18021796
jlong java_lang_Thread::stackSize(oop java_thread) {
18031797
GET_FIELDHOLDER_FIELD(java_thread, stackSize, 0);
@@ -4861,17 +4855,11 @@ oop java_lang_ClassLoader::unnamedModule(oop loader) {
48614855
int java_lang_System::_static_in_offset;
48624856
int java_lang_System::_static_out_offset;
48634857
int java_lang_System::_static_err_offset;
4864-
int java_lang_System::_static_security_offset;
4865-
int java_lang_System::_static_allow_security_offset;
4866-
int java_lang_System::_static_never_offset;
48674858

48684859
#define SYSTEM_FIELDS_DO(macro) \
48694860
macro(_static_in_offset, k, "in", input_stream_signature, true); \
48704861
macro(_static_out_offset, k, "out", print_stream_signature, true); \
4871-
macro(_static_err_offset, k, "err", print_stream_signature, true); \
4872-
macro(_static_security_offset, k, "security", security_manager_signature, true); \
4873-
macro(_static_allow_security_offset, k, "allowSecurityManager", int_signature, true); \
4874-
macro(_static_never_offset, k, "NEVER", int_signature, true)
4862+
macro(_static_err_offset, k, "err", print_stream_signature, true);
48754863

48764864
void java_lang_System::compute_offsets() {
48774865
InstanceKlass* k = vmClasses::System_klass();
@@ -4881,21 +4869,12 @@ void java_lang_System::compute_offsets() {
48814869
// This field tells us that a security manager can never be installed so we
48824870
// can completely skip populating the ProtectionDomainCacheTable.
48834871
bool java_lang_System::allow_security_manager() {
4884-
static int initialized = false;
4885-
static bool allowed = true; // default
4886-
if (!initialized) {
4887-
oop base = vmClasses::System_klass()->static_field_base_raw();
4888-
int never = base->int_field(_static_never_offset);
4889-
allowed = (base->int_field(_static_allow_security_offset) != never);
4890-
initialized = true;
4891-
}
4892-
return allowed;
4872+
return false;
48934873
}
48944874

48954875
// This field tells us that a security manager is installed.
48964876
bool java_lang_System::has_security_manager() {
4897-
oop base = vmClasses::System_klass()->static_field_base_raw();
4898-
return base->obj_field(_static_security_offset) != nullptr;
4877+
return false;
48994878
}
49004879

49014880
#if INCLUDE_CDS

src/hotspot/share/classfile/javaClasses.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ class java_lang_Thread : AllStatic {
358358
static int _holder_offset;
359359
static int _name_offset;
360360
static int _contextClassLoader_offset;
361-
static int _inheritedAccessControlContext_offset;
362361
static int _eetop_offset;
363362
static int _jvmti_thread_state_offset;
364363
static int _jvmti_VTMS_transition_disable_count_offset;
@@ -405,8 +404,6 @@ class java_lang_Thread : AllStatic {
405404
static void set_daemon(oop java_thread);
406405
// Context ClassLoader
407406
static oop context_class_loader(oop java_thread);
408-
// Control context
409-
static oop inherited_access_control_context(oop java_thread);
410407
// Stack size hint
411408
static jlong stackSize(oop java_thread);
412409
// Thread ID

src/hotspot/share/classfile/vmSymbols.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,8 @@ class SerializeClosure;
439439
template(getProperty_name, "getProperty") \
440440
template(context_name, "context") \
441441
template(contextClassLoader_name, "contextClassLoader") \
442-
template(inheritedAccessControlContext_name, "inheritedAccessControlContext") \
443442
template(getClassContext_name, "getClassContext") \
444443
template(wait_name, "wait0") \
445-
template(checkPackageAccess_name, "checkPackageAccess") \
446444
template(forName_name, "forName") \
447445
template(forName0_name, "forName0") \
448446
template(isJavaIdentifierStart_name, "isJavaIdentifierStart") \

src/hotspot/share/include/jvm.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -723,13 +723,6 @@ JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt
723723
JNIEXPORT jobjectArray JNICALL
724724
JVM_GetMethodParameters(JNIEnv *env, jobject method);
725725

726-
/*
727-
* java.security.*
728-
*/
729-
730-
JNIEXPORT jobject JNICALL
731-
JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
732-
733726
/*
734727
* Ensure that code doing a stackwalk and using javaVFrame::locals() to
735728
* get the value will see a materialized value and not a scalar-replaced
@@ -741,9 +734,6 @@ JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
741734
JNIEXPORT void JNICALL
742735
JVM_EnsureMaterializedForStackWalk_func(JNIEnv* env, jobject vthread, jobject value);
743736

744-
JNIEXPORT jobject JNICALL
745-
JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
746-
747737
/*
748738
* Signal support, used to implement the shutdown sequence. Every VM must
749739
* support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts

src/hotspot/share/prims/jvm.cpp

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,87 +1269,6 @@ JVM_ENTRY(jobject, JVM_GetProtectionDomain(JNIEnv *env, jclass cls))
12691269
JVM_END
12701270

12711271

1272-
// Returns the inherited_access_control_context field of the running thread.
1273-
JVM_ENTRY(jobject, JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls))
1274-
oop result = java_lang_Thread::inherited_access_control_context(thread->threadObj());
1275-
return JNIHandles::make_local(THREAD, result);
1276-
JVM_END
1277-
1278-
JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
1279-
if (!UsePrivilegedStack) return nullptr;
1280-
1281-
ResourceMark rm(THREAD);
1282-
GrowableArray<Handle>* local_array = new GrowableArray<Handle>(12);
1283-
JvmtiVMObjectAllocEventCollector oam;
1284-
1285-
// count the protection domains on the execution stack. We collapse
1286-
// duplicate consecutive protection domains into a single one, as
1287-
// well as stopping when we hit a privileged frame.
1288-
1289-
oop previous_protection_domain = nullptr;
1290-
Handle privileged_context(thread, nullptr);
1291-
bool is_privileged = false;
1292-
oop protection_domain = nullptr;
1293-
1294-
// Iterate through Java frames
1295-
vframeStream vfst(thread);
1296-
for(; !vfst.at_end(); vfst.next()) {
1297-
// get method of frame
1298-
Method* method = vfst.method();
1299-
1300-
// stop at the first privileged frame
1301-
if (method->method_holder() == vmClasses::AccessController_klass() &&
1302-
method->name() == vmSymbols::executePrivileged_name())
1303-
{
1304-
// this frame is privileged
1305-
is_privileged = true;
1306-
1307-
javaVFrame *priv = vfst.asJavaVFrame(); // executePrivileged
1308-
1309-
StackValueCollection* locals = priv->locals();
1310-
StackValue* ctx_sv = locals->at(1); // AccessControlContext context
1311-
StackValue* clr_sv = locals->at(2); // Class<?> caller
1312-
assert(!ctx_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
1313-
assert(!clr_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
1314-
privileged_context = ctx_sv->get_obj();
1315-
Handle caller = clr_sv->get_obj();
1316-
1317-
Klass *caller_klass = java_lang_Class::as_Klass(caller());
1318-
protection_domain = caller_klass->protection_domain();
1319-
} else {
1320-
protection_domain = method->method_holder()->protection_domain();
1321-
}
1322-
1323-
if ((previous_protection_domain != protection_domain) && (protection_domain != nullptr)) {
1324-
local_array->push(Handle(thread, protection_domain));
1325-
previous_protection_domain = protection_domain;
1326-
}
1327-
1328-
if (is_privileged) break;
1329-
}
1330-
1331-
1332-
// either all the domains on the stack were system domains, or
1333-
// we had a privileged system domain
1334-
if (local_array->is_empty()) {
1335-
if (is_privileged && privileged_context.is_null()) return nullptr;
1336-
1337-
oop result = java_security_AccessControlContext::create(objArrayHandle(), is_privileged, privileged_context, CHECK_NULL);
1338-
return JNIHandles::make_local(THREAD, result);
1339-
}
1340-
1341-
objArrayOop context = oopFactory::new_objArray(vmClasses::ProtectionDomain_klass(),
1342-
local_array->length(), CHECK_NULL);
1343-
objArrayHandle h_context(thread, context);
1344-
for (int index = 0; index < local_array->length(); index++) {
1345-
h_context->obj_at_put(index, local_array->at(index)());
1346-
}
1347-
1348-
oop result = java_security_AccessControlContext::create(h_context, is_privileged, privileged_context, CHECK_NULL);
1349-
1350-
return JNIHandles::make_local(THREAD, result);
1351-
JVM_END
1352-
13531272
class ScopedValueBindingsResolver {
13541273
public:
13551274
InstanceKlass* Carrier_klass;

src/hotspot/share/runtime/globals.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,6 @@ const int ObjectAlignmentInBytes = 8;
681681
develop(bool, PrintCodeCacheExtension, false, \
682682
"Print extension of code cache") \
683683
\
684-
develop(bool, UsePrivilegedStack, true, \
685-
"Enable the security JVM functions") \
686-
\
687684
product(bool, ClassUnloading, true, \
688685
"Do unloading of classes") \
689686
\

0 commit comments

Comments
 (0)