Merge
This commit is contained in:
commit
5fc22fbb9a
hotspot
src/share/vm
test/runtime/logging
@ -135,8 +135,10 @@ void DictionaryEntry::add_protection_domain(Dictionary* dict, oop protection_dom
|
||||
// via a store to _pd_set.
|
||||
OrderAccess::release_store_ptr(&_pd_set, new_head);
|
||||
}
|
||||
if (TraceProtectionDomainVerification && WizardMode) {
|
||||
print();
|
||||
if (log_is_enabled(Trace, protectiondomain)) {
|
||||
ResourceMark rm;
|
||||
outputStream* log = LogHandle(protectiondomain)::trace_stream();
|
||||
print_count(log);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/oop.hpp"
|
||||
#include "utilities/hashtable.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
||||
class DictionaryEntry;
|
||||
class PSPromotionManager;
|
||||
@ -323,14 +324,14 @@ class DictionaryEntry : public HashtableEntry<Klass*, mtClass> {
|
||||
return (klass->name() == class_name && _loader_data == loader_data);
|
||||
}
|
||||
|
||||
void print() {
|
||||
void print_count(outputStream *st) {
|
||||
int count = 0;
|
||||
for (ProtectionDomainEntry* current = _pd_set;
|
||||
current != NULL;
|
||||
current = current->_next) {
|
||||
count++;
|
||||
}
|
||||
tty->print_cr("pd set = #%d", count);
|
||||
st->print_cr("pd set count = #%d", count);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -430,12 +430,15 @@ void SystemDictionary::validate_protection_domain(instanceKlassHandle klass,
|
||||
|
||||
// Now we have to call back to java to check if the initating class has access
|
||||
JavaValue result(T_VOID);
|
||||
if (TraceProtectionDomainVerification) {
|
||||
if (log_is_enabled(Debug, protectiondomain)) {
|
||||
ResourceMark rm;
|
||||
// Print out trace information
|
||||
tty->print_cr("Checking package access");
|
||||
tty->print(" - class loader: "); class_loader()->print_value_on(tty); tty->cr();
|
||||
tty->print(" - protection domain: "); protection_domain()->print_value_on(tty); tty->cr();
|
||||
tty->print(" - loading: "); klass()->print_value_on(tty); tty->cr();
|
||||
outputStream* log = LogHandle(protectiondomain)::debug_stream();
|
||||
log->print_cr("Checking package access");
|
||||
log->print("class loader: "); class_loader()->print_value_on(log);
|
||||
log->print(" protection domain: "); protection_domain()->print_value_on(log);
|
||||
log->print(" loading: "); klass()->print_value_on(log);
|
||||
log->cr();
|
||||
}
|
||||
|
||||
KlassHandle system_loader(THREAD, SystemDictionary::ClassLoader_klass());
|
||||
@ -448,13 +451,10 @@ void SystemDictionary::validate_protection_domain(instanceKlassHandle klass,
|
||||
protection_domain,
|
||||
THREAD);
|
||||
|
||||
if (TraceProtectionDomainVerification) {
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
tty->print_cr(" -> DENIED !!!!!!!!!!!!!!!!!!!!!");
|
||||
} else {
|
||||
tty->print_cr(" -> granted");
|
||||
}
|
||||
tty->cr();
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
log_debug(protectiondomain)("DENIED !!!!!!!!!!!!!!!!!!!!!");
|
||||
} else {
|
||||
log_debug(protectiondomain)("granted");
|
||||
}
|
||||
|
||||
if (HAS_PENDING_EXCEPTION) return;
|
||||
|
@ -67,6 +67,7 @@
|
||||
LOG_TAG(phases) \
|
||||
LOG_TAG(plab) \
|
||||
LOG_TAG(promotion) \
|
||||
LOG_TAG(protectiondomain) /* "Trace protection domain verification" */ \
|
||||
LOG_TAG(ref) \
|
||||
LOG_TAG(refine) \
|
||||
LOG_TAG(region) \
|
||||
|
@ -1478,9 +1478,6 @@ public:
|
||||
develop(bool, TraceCompiledIC, false, \
|
||||
"Trace changes of compiled IC") \
|
||||
\
|
||||
develop(bool, TraceProtectionDomainVerification, false, \
|
||||
"Trace protection domain verification") \
|
||||
\
|
||||
develop(bool, TraceClearedExceptions, false, \
|
||||
"Print when an exception is forcibly cleared") \
|
||||
\
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test ProtectionDomainVerificationTest
|
||||
* @bug 8149064
|
||||
* @library /testlibrary
|
||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools
|
||||
* @run driver ProtectionDomainVerificationTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
|
||||
public class ProtectionDomainVerificationTest {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
|
||||
// -Xlog:protectiondomain=trace
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace",
|
||||
"-Xmx64m",
|
||||
Hello.class.getName());
|
||||
OutputAnalyzer out = new OutputAnalyzer(pb.start());
|
||||
out.shouldContain("[protectiondomain] Checking package access");
|
||||
out.shouldContain("[protectiondomain] pd set count = #");
|
||||
|
||||
// -Xlog:protectiondomain=debug
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug",
|
||||
"-Xmx64m",
|
||||
Hello.class.getName());
|
||||
out = new OutputAnalyzer(pb.start());
|
||||
out.shouldContain("[protectiondomain] Checking package access");
|
||||
out.shouldNotContain("pd set count = #");
|
||||
}
|
||||
|
||||
public static class Hello {
|
||||
public static void main(String[] args) {
|
||||
System.out.print("Hello!");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user