Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8338411: Implement JEP 486: Permanently Disable the Security Manager #21498

Closed
wants to merge 230 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
230 commits
Select commit Hold shift + click to select a range
ef70021
Initial load of JEP 486 implementation
AlanBateman Sep 30, 2024
591d3d6
ServerSocket bind/accept no longer throw SecurityException
AlanBateman Oct 1, 2024
781eecd
Merge
AlanBateman Oct 1, 2024
4035376
hack out Security Manager from LoaderHandler
stuart-marks Aug 24, 2024
6d2006d
Update spec for RMIClassLoader
stuart-marks Aug 30, 2024
6c325c2
Fix whitespace.
stuart-marks Sep 26, 2024
463d46b
Restore URL parsing to LoaderHandler::getClassLoader.
stuart-marks Oct 1, 2024
439ed26
Merge
AlanBateman Oct 2, 2024
53e06d0
Remove vmTestbase/nsk/jvmti/AttachOnDemand/attach004/TestDescription.…
AlanBateman Oct 2, 2024
9e1cec8
Remove leftover SecurityException text from RMIConnection.getObjectIn…
seanjmullan Oct 2, 2024
7cf5824
Remove leftover "@see java.lang.SecurityManager#checkSetFactory" from
seanjmullan Oct 2, 2024
77b58bf
Remove unnecessary comma.
seanjmullan Oct 2, 2024
b5f2ca3
Merge
AlanBateman Oct 3, 2024
938737a
Fix typo.
seanjmullan Oct 3, 2024
2612400
Remove text about granting permission and add api note indicating
seanjmullan Oct 3, 2024
4688f78
Remove text about implementers using Security Manager checks from class
seanjmullan Oct 3, 2024
34da8c7
Remove Security Manager text from EXIT_ON_CLOSE.
seanjmullan Oct 3, 2024
c62c4ad
Removed TestSecurityManagerChecks.java - this test was testing permis…
seanjmullan Oct 3, 2024
d8e15dd
Drop reference to permissions from Font.getFont
AlanBateman Oct 4, 2024
29c0bb2
Merge
AlanBateman Oct 4, 2024
23e0f09
Update record tests to not require SM
AlanBateman Oct 4, 2024
bd27286
Remove tests for repeating annotations with SM set, no SM case well t…
AlanBateman Oct 4, 2024
7f451ea
Change reflect/Nestmates/TestReflectionAPI to not test with a SM set
AlanBateman Oct 4, 2024
c9ab253
Remove test/langtools/tools/javac/api/ToolProvider/ToolProviderTest.j…
AlanBateman Oct 4, 2024
36522ed
Remove text about granting permissions to module from
seanjmullan Oct 4, 2024
c769f2d
Remove text about Proxy objects being granted AllPermission.
seanjmullan Oct 4, 2024
79b4b21
Remove text about needing ReflectPermission to access AccessibleObject.
seanjmullan Oct 4, 2024
e46d99c
JDK-8003881: Prevent lambda implementing inner classes from allowing …
igraves Oct 4, 2024
422c489
JDK-8007035: deprecate public void SecurityManager.checkMemberAccess(…
igraves Oct 4, 2024
1f4be6f
Update copyright header
AlanBateman Oct 5, 2024
87f5a53
Merge
AlanBateman Oct 5, 2024
edcafbb
Remove text about using group from SM if null from constructor.
seanjmullan Oct 5, 2024
dc6e158
Remove text from class description about common pools when SM is enab…
seanjmullan Oct 5, 2024
09f5ffd
Merge
AlanBateman Oct 5, 2024
97c28c4
Fix typo.
seanjmullan Oct 5, 2024
0fab6e0
Remove leftover checkListen text from @throws SecurityException in bi…
seanjmullan Oct 5, 2024
901decf
Some wording changes to deprecated text.
seanjmullan Oct 5, 2024
1702b47
Remove @see SM.checkConnect
AlanBateman Oct 7, 2024
a5629a2
Remove uses of "security check" from docs
AlanBateman Oct 7, 2024
cc4d56d
Remove left over refs to security checks
AlanBateman Oct 7, 2024
2b4a91d
Remove Security section from SL spec
AlanBateman Oct 7, 2024
cf4adb9
Tweak deprecated text.
seanjmullan Oct 7, 2024
1f3df69
More tweaks to deprecated text.
seanjmullan Oct 7, 2024
23bd997
Fix typo.
seanjmullan Oct 7, 2024
ca96a40
SecurityManager::getClassContext includes additional frame
AlanBateman Oct 7, 2024
425e72f
Remove SM dependency from tools/doclint/tool/RunTest.java. Change test
seanjmullan Oct 7, 2024
d43e0a9
Remove java/lang/constant/methodTypeDesc/ResolveConstantDesc.java, no…
AlanBateman Oct 7, 2024
281ceba
Tweak deprecation text.
seanjmullan Oct 7, 2024
9f17137
In defineClass, remove text about granted permissions to default domain.
seanjmullan Oct 7, 2024
a598567
Make specification more clear about default domain containing no perms.
seanjmullan Oct 7, 2024
25d8f26
Remove SM test case from tools/javac/launcher/SourceLauncherTest.java…
seanjmullan Oct 7, 2024
b4a05bb
Remove text about needing RuntimePermission "getClassLoader" from
seanjmullan Oct 7, 2024
453b6c1
Merge
AlanBateman Oct 8, 2024
4c668e7
Replace "granted" wording in getPermissions() with "returned". Remove
seanjmullan Oct 8, 2024
57788cf
Remove jdk/dynalink/UntrustedDynamicLinkerFactoryTest.java test as it is
seanjmullan Oct 8, 2024
c863402
Restore policy file accidentally deleted.
seanjmullan Oct 8, 2024
2f354c4
8229785: MethodType::fromMethodDescriptorString should require securi…
igraves Oct 8, 2024
1d0edb6
8013527: calling MethodHandles.lookup on itself leads to errors
igraves Oct 8, 2024
a398888
8008688: Make MethodHandleInfo public
igraves Oct 8, 2024
e585a5e
8008688: Make MethodHandleInfo public
igraves Oct 8, 2024
a2ef07a
Removing errant swp file and updating SM problem list
igraves Oct 9, 2024
3aa4935
8076596: BytecodeDescriptor.parseMethod doesn't work during bootstrap…
igraves Oct 9, 2024
d6233e8
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 9, 2024
f0a776f
Remove java/lang/reflect/sealed_classes/TestSecurityManagerChecks.jav…
seanjmullan Oct 9, 2024
8d72878
7196190: Improve method of handling MethodHandles
igraves Oct 9, 2024
c8e800a
Merge
AlanBateman Oct 11, 2024
ac815f1
Move SM problem tests from ProblemList-sm.txt to ProblemList.txt.
seanjmullan Oct 11, 2024
958bb50
Remove runtime/Nestmates/protectionDomain/TestDifferentProtectionDoma…
seanjmullan Oct 11, 2024
2843729
Remove text about executing in caller's AccessControlContext from
seanjmullan Oct 11, 2024
1d0f8dd
Remove text from class description about invoking CallbackHandler's h…
seanjmullan Oct 11, 2024
b370c9b
Remove text about executing in caller's AccessControlContext from
seanjmullan Oct 11, 2024
a1973fa
Drop text on enforcement of security policies
AlanBateman Oct 12, 2024
875c480
Update copyright headers
AlanBateman Oct 12, 2024
f14f7fc
Merge
AlanBateman Oct 12, 2024
d3a4d2d
clientlibs: Updated Problemlist JBS ID for javax/swing/JPopupMenu/669…
honkar-jdk Oct 13, 2024
5d45bb1
Remove windows-specific policy file as it is no longer needed.
seanjmullan Oct 14, 2024
bc9697c
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 14, 2024
13601a1
Merge
AlanBateman Oct 14, 2024
a655f48
Fix whitespace
AlanBateman Oct 14, 2024
fd5824e
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 14, 2024
413cb48
fix setOpenURIHandler docs
prrace Oct 14, 2024
f7d0331
Merge
AlanBateman Oct 15, 2024
d05122f
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 15, 2024
c80c01f
Remove text and links to fine grained permissions docs.
seanjmullan Oct 15, 2024
0115b0f
Merge
AlanBateman Oct 16, 2024
2da3699
Merge
AlanBateman Oct 16, 2024
23a43e0
Revert changes to JMXAuthenticator and JMXConnectorFactory as these m…
seanjmullan Oct 16, 2024
d034341
Merge
AlanBateman Oct 17, 2024
2a4663c
Merge
AlanBateman Oct 18, 2024
2ebb6de
Change checkAccess() methods to be no-ops, rather than throwing
seanjmullan Oct 17, 2024
7ea65a6
Add api note to getClassContext to use StackWalker instead and
seanjmullan Oct 17, 2024
adf5ed7
Restore text about needing permissions from the desktop environment i…
seanjmullan Oct 17, 2024
44432e5
Add text to class description of MBeanServer stating that implementat…
seanjmullan Oct 17, 2024
86ff714
Restored methods in RMIConnection to throw SecurityExceptions again but
seanjmullan Oct 17, 2024
9dd59a1
Sanitize the class descriptions of DelegationPermission and ServicePe…
seanjmullan Oct 17, 2024
16e17b8
Change apiNote to deprecated annotation on checkAccess methods. Chang…
seanjmullan Oct 18, 2024
f89d9d0
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 18, 2024
14475d1
clientlibs: java/awt/Robot/InfiniteLoopException.java problemlisted
honkar-jdk Oct 18, 2024
fc10303
Merge
AlanBateman Oct 19, 2024
4f14027
Remove left over references to SecurityManager in tests
AlanBateman Oct 19, 2024
2f8242b
WhiteBox.getWhiteBox cleanup
AlanBateman Oct 19, 2024
8e8d388
Update test summary for tests that no longer run with SM set
AlanBateman Oct 19, 2024
e66d14a
Remove left over policy files
AlanBateman Oct 19, 2024
46970f8
Remove left over policy files
AlanBateman Oct 20, 2024
365acc1
test/langtools/tools/doclint/tool/RunTest.java failing with JTREG_TES…
AlanBateman Oct 20, 2024
6e5891f
Merge
AlanBateman Oct 21, 2024
02b4bf1
remove references to sm in pkcs11 tests
wangweij Oct 21, 2024
b4f68e3
two useless policy files
wangweij Oct 21, 2024
807eb6e
cleanup TestEC.java
wangweij Oct 21, 2024
f88f5d6
Remove redundant @see StackWalker from getClassContext.
seanjmullan Oct 21, 2024
9e831e2
Revert last copyright date as there are now no changes to this file.
seanjmullan Oct 21, 2024
848ed63
update copyright year for the recently updated tests
wangweij Oct 21, 2024
84ad071
this special rule no long applies since we have no PolicyFile class now
wangweij Oct 21, 2024
efd1b0f
in Subject, current() is only mostly equivalent to the original getSu…
wangweij Oct 21, 2024
4603119
Remove/modify microbenchmark tests that set an SM.
seanjmullan Oct 21, 2024
be38c74
Drop sentence about trusted system code from Proxy spec
AlanBateman Oct 21, 2024
d384416
Modify tools/javac/processing/6348193/T6348193.java test to not test
seanjmullan Oct 21, 2024
e8656ac
Remove 3 test cases from jdk/dynalink/BeanLinkerTest.java that depend…
seanjmullan Oct 21, 2024
1bf77a3
imageio cache
prrace Oct 21, 2024
ebd8a9e
Merge branch 'jep486' of github.com:openjdk/jdk-sandbox into jep486
prrace Oct 21, 2024
313fb8b
TestClassPathPlugin.sh
prrace Oct 21, 2024
7e53cfc
createfont
prrace Oct 21, 2024
75ddc00
policy
prrace Oct 21, 2024
3e509d7
Policy no longer links to standard-names.html
wangweij Oct 21, 2024
352b51e
warningwindow
prrace Oct 21, 2024
db88b58
Merge branch 'jep486' of github.com:openjdk/jdk-sandbox into jep486
prrace Oct 21, 2024
2a5d99c
dump.policy
prrace Oct 21, 2024
7c0e8e4
securitydialog
prrace Oct 21, 2024
72a1651
policy
prrace Oct 21, 2024
8383d78
policy
prrace Oct 21, 2024
8c32dc3
clientlibs: deleted policy files
honkar-jdk Oct 21, 2024
7205009
Merge
AlanBateman Oct 22, 2024
fa7f48a
Fix @run tag with the correct test name
AlanBateman Oct 22, 2024
0a26398
Modified jdk/dynalink/TrustedDynamicLinkerFactoryTest.java to run w/o…
seanjmullan Oct 22, 2024
c9f4db1
reword Subject spec
wangweij Oct 22, 2024
3a5f1fc
Remove compiler/exceptions/ExceptionInInit.java test - exception is no
seanjmullan Oct 22, 2024
d9ee496
clientlibs swing test review changes
honkar-jdk Oct 22, 2024
2c9b11d
Merge
AlanBateman Oct 23, 2024
7fbe121
Restore test/langtools/ProblemList.txt as not changed
AlanBateman Oct 23, 2024
82bb0d8
java/net/httpclient/websocket/security/WSURLPermissionTest.java renam…
dfuch Oct 23, 2024
3443975
java/net/httpclient/websocket/security/WSURLPermissionTest.java: inte…
dfuch Oct 23, 2024
300d3f9
warning-string
prrace Oct 23, 2024
d32e384
clientlibs: import order
honkar-jdk Oct 23, 2024
5599346
Remove hasSM() method and code that calls it, and remove comment about
seanjmullan Oct 23, 2024
d991534
Remove static variable `DEFAULT_POLICY` and unused imports.
seanjmullan Oct 23, 2024
3dbf684
Remove unused static variable NEW_PROXY_IN_PKG.
seanjmullan Oct 23, 2024
0022764
Remove println about Security Manager.
seanjmullan Oct 23, 2024
d8564fa
Update @summary to replace "if the right permission is granted" can b…
seanjmullan Oct 23, 2024
29e7e87
Merge
AlanBateman Oct 24, 2024
cb50dfd
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 24, 2024
2bc142e
SM related cleanup of Runtime exec ExecCommand test.
RogerRiggs Oct 24, 2024
de0a0f6
clientlibs: Deleted awt/Focus/CloseDialogActivateOwnerTest.java
honkar-jdk Oct 24, 2024
b78a7b6
clientlibs: Javadoc updates to src/java.desktop/
honkar-jdk Oct 24, 2024
3aa0054
Merge branch 'master' into jep486
AlanBateman Oct 25, 2024
e50cf64
Remove enum from test as it is no longer needed.
seanjmullan Oct 25, 2024
44b552a
Remove unnecessary "anymore" word from @apiNote in Permission subclas…
seanjmullan Oct 25, 2024
0f448e5
Fix typo.
seanjmullan Oct 25, 2024
a7a4944
clientlibs: copyright year updates
honkar-jdk Oct 25, 2024
1a2e1a8
no more support for permissions in Proc.java
wangweij Oct 25, 2024
bc59b55
Merge
AlanBateman Oct 25, 2024
17b5cc7
Merge
AlanBateman Oct 26, 2024
ed0f5c0
Fix type in addProvider.
seanjmullan Oct 25, 2024
7f86027
Remove apiNote. SM changes in smartcardio APIs should be done via JSR…
seanjmullan Oct 26, 2024
b6fe405
Change checkPermission exception msg to "checking permissions is not …
seanjmullan Oct 26, 2024
09b6cd6
Add missing class description.
seanjmullan Oct 26, 2024
8b527c9
Add api note to class description that permission checking is not sup…
seanjmullan Oct 26, 2024
275dabd
Change "SecurityManager" to "Security Manager". Add some missing code…
seanjmullan Oct 26, 2024
6614517
Restore note for implementers in src/java.prefs/share/classes/java/ut…
AlanBateman Oct 27, 2024
cd794a1
clientlibs: GetSoundBankSecurityException.java renamed to EmptySoundB…
honkar-jdk Oct 28, 2024
934e1c2
clientlibs: GetSoundBankSecurityException.java renamed to EmptySoundB…
honkar-jdk Oct 28, 2024
aca9555
clientlibs: Deleted JPopupMenu tests
honkar-jdk Oct 28, 2024
80514d9
clientlibs: Updated Problemlist
honkar-jdk Oct 28, 2024
6064562
Change deprecated annotations to api notes on getPolicy and setPolicy.
seanjmullan Oct 28, 2024
4981da0
Specify that params passed to getPermissions and implies are ignored and
seanjmullan Oct 28, 2024
e490f69
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 28, 2024
047e144
No need to override methods for private static NO_PERMISSIONS_POLICY.
seanjmullan Oct 28, 2024
9eb275c
clientlibs: Updated javax/swing/UIDefaults/6622002/bug6622002.java
honkar-jdk Oct 28, 2024
2a9b98e
remove non enforced/redundant comment in TestLogConfigurationDeadLock…
justin-curtis-lu Oct 28, 2024
8054d10
delete PermissionTest.java as it simply constructs provider impls
justin-curtis-lu Oct 28, 2024
bc5b3d7
remove privileged calls in logging/File* tests
justin-curtis-lu Oct 28, 2024
cb5f6e4
ResourceBundle/modules/security/* no longer needed. TestPermission te…
justin-curtis-lu Oct 28, 2024
fe73fd0
Merge branch 'master' into jep486
AlanBateman Oct 29, 2024
0feceaa
Adjust Executors.privilegedThreadFactory to make clear that thread us…
AlanBateman Oct 29, 2024
b654355
Update copyright headers
AlanBateman Oct 29, 2024
548eb9e
Update copyrights. Remove @compile line form Marshal.java test.
seanjmullan Oct 29, 2024
2f90c83
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 29, 2024
61dd3ba
Update definition of networkaddress.cache.ttl security property.
seanjmullan Oct 29, 2024
ee570c4
Update copyrights.
seanjmullan Oct 29, 2024
b2d59a4
Remove test - only checked that doPrivileged calls were in place.
seanjmullan Oct 29, 2024
7e72d14
Renamed test as it is not about permission checking anymore but still…
seanjmullan Oct 29, 2024
90469c2
clientlibs: Javadoc cleanup
honkar-jdk Oct 29, 2024
444fabe
rename TestAppletLoggerContext.java as suggested in util test review
justin-curtis-lu Oct 29, 2024
06c4c3c
Improve description of Executors.privilegedThreadFactory
AlanBateman Oct 29, 2024
5577e48
JAXP tests: organize imports of a few tests
JoeWang-Java Oct 29, 2024
1dbfe91
Merge branch 'master' into jep486
AlanBateman Oct 30, 2024
376d1b5
Added API Notes to ProtectionDomain clarifying that the current polic…
seanjmullan Oct 30, 2024
8772ee2
In staticPermissionsOnly(), change "current policy binding" to "curre…
seanjmullan Oct 30, 2024
1670907
Remove two obsolete RMI tests:
stuart-marks Oct 30, 2024
3fe3f59
Modify three RMI tests to work without the security manager:
stuart-marks Oct 30, 2024
7958ee2
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Oct 30, 2024
11f374a
Merge branch 'master' into jep486
AlanBateman Oct 31, 2024
aabb648
Update copyright headers
AlanBateman Oct 31, 2024
6033f47
clientlibs: Problemlisted manual tests
honkar-jdk Oct 31, 2024
440c4a3
Merge branch 'master' into jep486
AlanBateman Nov 1, 2024
c69dc5e
Merge branch 'master' into jep486
AlanBateman Nov 2, 2024
ab586f6
Remove left-over paragraph about SM use from LoggerFinder
AlanBateman Nov 3, 2024
9aad719
remove LauncherErrors test from problemlisting
jaikiran Nov 3, 2024
a2e151c
remove MainClassCantBeLoadedTest from problemlisting
jaikiran Nov 3, 2024
74352c3
Merge branch 'master' into jep486
AlanBateman Nov 3, 2024
f6e4b82
Merge branch 'jep486' of https://github.com/openjdk/jdk-sandbox into …
AlanBateman Nov 4, 2024
002f3f6
Merge branch 'master' into jep486
AlanBateman Nov 4, 2024
5866fa4
Remove "access" and "policy" options from debug help.
seanjmullan Nov 4, 2024
789c615
Merge branch 'master' into jep486
AlanBateman Nov 5, 2024
51d2a2a
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Nov 5, 2024
10164a3
Merge branch 'master' into jep486
AlanBateman Nov 5, 2024
5d5528a
Merge branch 'master' into jep486
AlanBateman Nov 5, 2024
e9e7f0c
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Nov 5, 2024
f4518b2
Merge branch 'master' into jep486
AlanBateman Nov 6, 2024
fe4ff47
Merge branch 'master' into jep486
AlanBateman Nov 7, 2024
b668e0d
test/jdk/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java failing
AlanBateman Nov 7, 2024
353cb94
Move JEP 486 failing tests into hotspot_runtime group.
seanjmullan Nov 7, 2024
dfd44d6
Move remaining JEP 486 failing tests into correct groups.
seanjmullan Nov 7, 2024
ca8a528
Merge branch 'master' into jep486
AlanBateman Nov 8, 2024
6ad9192
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Nov 8, 2024
2f825a5
Merge branch 'master' into jep486
AlanBateman Nov 8, 2024
2b4826d
Merge branch 'master' into jep486
AlanBateman Nov 9, 2024
d1efa9d
Merge branch 'master' into jep486
AlanBateman Nov 10, 2024
6b8f378
Merge branch 'master' into jep486
AlanBateman Nov 11, 2024
b7b95a4
Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411
seanjmullan Nov 11, 2024
7c996a5
Merge
seanjmullan Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 0 additions & 40 deletions make/modules/java.base/Copy.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -123,46 +123,6 @@ TARGETS += $(JVMCFG)

################################################################################

POLICY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.policy
POLICY_DST := $(CONF_DST_DIR)/security/java.policy

POLICY_SRC_LIST := $(POLICY_SRC)

$(POLICY_DST): $(POLICY_SRC_LIST)
$(call MakeTargetDir)
$(RM) $@ [email protected]
$(foreach f, $(POLICY_SRC_LIST), $(CAT) $(f) >> [email protected];)
$(MV) [email protected] $@

TARGETS += $(POLICY_DST)

################################################################################

DEF_POLICY_SRC := $(TOPDIR)/src/java.base/share/lib/security/default.policy
DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy

DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST)

ifeq ($(call isTargetOs, windows), true)
DEF_POLICY_SRC_LIST += $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy
endif

# Allow imported modules to modify the java.policy
ifneq ($(IMPORT_MODULES_CONF), )
DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra)
endif

$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
$(call MakeTargetDir)
$(RM) $@ [email protected]
$(foreach f, $(DEF_POLICY_SRC_LIST), $(CAT) $(f) >> [email protected];)
$(MV) [email protected] $@

TARGETS += $(DEF_POLICY_DST)

################################################################################

# CACERTS_FILE is optionally set in configure to override the default cacerts
# which is otherwise generated in Gendata-java.base.gmk
CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
Expand Down
1 change: 0 additions & 1 deletion make/modules/java.rmi/Launcher.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ include LauncherCommon.gmk

$(eval $(call SetupBuildLauncher, rmiregistry, \
MAIN_CLASS := sun.rmi.registry.RegistryImpl, \
JAVA_ARGS := -Djava.security.manager=allow, \
))
62 changes: 0 additions & 62 deletions src/hotspot/share/classfile/dictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,68 +347,6 @@ void Dictionary::check_package_access(InstanceKlass* klass,

assert(class_loader() != nullptr, "Should not call this");
assert(protection_domain() != nullptr, "Should not call this");

if (!java_lang_System::allow_security_manager()) {
// No need for any further checking. Package access always allowed.
return;
}

if (is_in_package_access_cache(THREAD, klass->name(), protection_domain)) {
// No need to check again.
return;
}

// We only have to call checkPackageAccess if there's a security manager installed.
if (java_lang_System::has_security_manager()) {

// This handle and the class_loader handle passed in keeps this class from
// being unloaded through several GC points.
// The class_loader handle passed in is the initiating loader.
Handle mirror(THREAD, klass->java_mirror());

// Now we have to call back to java to check if the initating class has access
InstanceKlass* system_loader = vmClasses::ClassLoader_klass();
JavaValue result(T_VOID);
JavaCalls::call_special(&result,
class_loader,
system_loader,
vmSymbols::checkPackageAccess_name(),
vmSymbols::class_protectiondomain_signature(),
mirror,
protection_domain,
THREAD);

LogTarget(Debug, protectiondomain) lt;
if (lt.is_enabled()) {
ResourceMark rm(THREAD);
// Print out trace information
LogStream ls(lt);
ls.print_cr("Checking package access");
ls.print("class loader: ");
class_loader()->print_value_on(&ls);
ls.print(" protection domain: ");
protection_domain()->print_value_on(&ls);
ls.print(" loading: "); klass->print_value_on(&ls);
if (HAS_PENDING_EXCEPTION) {
ls.print_cr(" DENIED !!!!!!!!!!!!!!!!!!!!!");
} else {
ls.print_cr(" granted");
}
}

if (HAS_PENDING_EXCEPTION) return;
}

// If no exception has been thrown, we have checked that the protection_domain can access
// this klass. Always add it to the cache (even if no SecurityManager is installed yet).
//
// This ensures that subsequent calls to Dictionary::find(THREAD, klass->name(), protection_domain)
// will always succeed. I.e., a new SecurityManager installed in the future cannot retroactively
// revoke the granted access.
{
MutexLocker mu(THREAD, SystemDictionary_lock);
add_to_package_access_cache(THREAD, klass, protection_domain);
}
}

// During class loading we may have cached a protection domain that has
Expand Down
27 changes: 3 additions & 24 deletions src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,6 @@ oop java_lang_Thread_Constants::get_VTHREAD_GROUP() {
int java_lang_Thread::_holder_offset;
int java_lang_Thread::_name_offset;
int java_lang_Thread::_contextClassLoader_offset;
int java_lang_Thread::_inheritedAccessControlContext_offset;
int java_lang_Thread::_eetop_offset;
int java_lang_Thread::_jvmti_thread_state_offset;
int java_lang_Thread::_jvmti_VTMS_transition_disable_count_offset;
Expand All @@ -1616,7 +1615,6 @@ JFR_ONLY(int java_lang_Thread::_jfr_epoch_offset;)
macro(_holder_offset, k, "holder", thread_fieldholder_signature, false); \
macro(_name_offset, k, vmSymbols::name_name(), string_signature, false); \
macro(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), classloader_signature, false); \
macro(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), accesscontrolcontext_signature, false); \
macro(_eetop_offset, k, "eetop", long_signature, false); \
macro(_interrupted_offset, k, "interrupted", bool_signature, false); \
macro(_interruptLock_offset, k, "interruptLock", object_signature, false); \
Expand Down Expand Up @@ -1793,10 +1791,6 @@ oop java_lang_Thread::context_class_loader(oop java_thread) {
return java_thread->obj_field(_contextClassLoader_offset);
}

oop java_lang_Thread::inherited_access_control_context(oop java_thread) {
return java_thread->obj_field(_inheritedAccessControlContext_offset);
}


jlong java_lang_Thread::stackSize(oop java_thread) {
GET_FIELDHOLDER_FIELD(java_thread, stackSize, 0);
Expand Down Expand Up @@ -4782,17 +4776,11 @@ oop java_lang_ClassLoader::unnamedModule(oop loader) {
int java_lang_System::_static_in_offset;
int java_lang_System::_static_out_offset;
int java_lang_System::_static_err_offset;
int java_lang_System::_static_security_offset;
int java_lang_System::_static_allow_security_offset;
int java_lang_System::_static_never_offset;

#define SYSTEM_FIELDS_DO(macro) \
macro(_static_in_offset, k, "in", input_stream_signature, true); \
macro(_static_out_offset, k, "out", print_stream_signature, true); \
macro(_static_err_offset, k, "err", print_stream_signature, true); \
macro(_static_security_offset, k, "security", security_manager_signature, true); \
macro(_static_allow_security_offset, k, "allowSecurityManager", int_signature, true); \
macro(_static_never_offset, k, "NEVER", int_signature, true)
macro(_static_err_offset, k, "err", print_stream_signature, true);

void java_lang_System::compute_offsets() {
InstanceKlass* k = vmClasses::System_klass();
Expand All @@ -4802,21 +4790,12 @@ void java_lang_System::compute_offsets() {
// This field tells us that a security manager can never be installed so we
// can completely skip populating the ProtectionDomainCacheTable.
bool java_lang_System::allow_security_manager() {
static int initialized = false;
static bool allowed = true; // default
if (!initialized) {
oop base = vmClasses::System_klass()->static_field_base_raw();
int never = base->int_field(_static_never_offset);
allowed = (base->int_field(_static_allow_security_offset) != never);
initialized = true;
}
return allowed;
return false;
}

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

#if INCLUDE_CDS
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/classfile/javaClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ class java_lang_Thread : AllStatic {
static int _holder_offset;
static int _name_offset;
static int _contextClassLoader_offset;
static int _inheritedAccessControlContext_offset;
static int _eetop_offset;
static int _jvmti_thread_state_offset;
static int _jvmti_VTMS_transition_disable_count_offset;
Expand Down Expand Up @@ -405,8 +404,6 @@ class java_lang_Thread : AllStatic {
static void set_daemon(oop java_thread);
// Context ClassLoader
static oop context_class_loader(oop java_thread);
// Control context
static oop inherited_access_control_context(oop java_thread);
// Stack size hint
static jlong stackSize(oop java_thread);
// Thread ID
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/classfile/vmSymbols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,8 @@ class SerializeClosure;
template(getProperty_name, "getProperty") \
template(context_name, "context") \
template(contextClassLoader_name, "contextClassLoader") \
template(inheritedAccessControlContext_name, "inheritedAccessControlContext") \
template(getClassContext_name, "getClassContext") \
template(wait_name, "wait0") \
template(checkPackageAccess_name, "checkPackageAccess") \
template(forName_name, "forName") \
template(forName0_name, "forName0") \
template(isJavaIdentifierStart_name, "isJavaIdentifierStart") \
Expand Down
10 changes: 0 additions & 10 deletions src/hotspot/share/include/jvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -723,13 +723,6 @@ JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt
JNIEXPORT jobjectArray JNICALL
JVM_GetMethodParameters(JNIEnv *env, jobject method);

/*
* java.security.*
*/

JNIEXPORT jobject JNICALL
JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);

/*
* Ensure that code doing a stackwalk and using javaVFrame::locals() to
* get the value will see a materialized value and not a scalar-replaced
Expand All @@ -741,9 +734,6 @@ JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
JNIEXPORT void JNICALL
JVM_EnsureMaterializedForStackWalk_func(JNIEnv* env, jobject vthread, jobject value);

JNIEXPORT jobject JNICALL
JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);

/*
* Signal support, used to implement the shutdown sequence. Every VM must
* support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
Expand Down
81 changes: 0 additions & 81 deletions src/hotspot/share/prims/jvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,87 +1269,6 @@ JVM_ENTRY(jobject, JVM_GetProtectionDomain(JNIEnv *env, jclass cls))
JVM_END


// Returns the inherited_access_control_context field of the running thread.
seanjmullan marked this conversation as resolved.
Show resolved Hide resolved
JVM_ENTRY(jobject, JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls))
oop result = java_lang_Thread::inherited_access_control_context(thread->threadObj());
return JNIHandles::make_local(THREAD, result);
JVM_END

JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
if (!UsePrivilegedStack) return nullptr;

ResourceMark rm(THREAD);
GrowableArray<Handle>* local_array = new GrowableArray<Handle>(12);
JvmtiVMObjectAllocEventCollector oam;

// count the protection domains on the execution stack. We collapse
// duplicate consecutive protection domains into a single one, as
// well as stopping when we hit a privileged frame.

oop previous_protection_domain = nullptr;
Handle privileged_context(thread, nullptr);
bool is_privileged = false;
oop protection_domain = nullptr;

// Iterate through Java frames
vframeStream vfst(thread);
for(; !vfst.at_end(); vfst.next()) {
// get method of frame
Method* method = vfst.method();

// stop at the first privileged frame
if (method->method_holder() == vmClasses::AccessController_klass() &&
method->name() == vmSymbols::executePrivileged_name())
{
// this frame is privileged
is_privileged = true;

javaVFrame *priv = vfst.asJavaVFrame(); // executePrivileged

StackValueCollection* locals = priv->locals();
StackValue* ctx_sv = locals->at(1); // AccessControlContext context
StackValue* clr_sv = locals->at(2); // Class<?> caller
assert(!ctx_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
assert(!clr_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
privileged_context = ctx_sv->get_obj();
Handle caller = clr_sv->get_obj();

Klass *caller_klass = java_lang_Class::as_Klass(caller());
protection_domain = caller_klass->protection_domain();
} else {
protection_domain = method->method_holder()->protection_domain();
}

if ((previous_protection_domain != protection_domain) && (protection_domain != nullptr)) {
local_array->push(Handle(thread, protection_domain));
previous_protection_domain = protection_domain;
}

if (is_privileged) break;
}


// either all the domains on the stack were system domains, or
// we had a privileged system domain
if (local_array->is_empty()) {
if (is_privileged && privileged_context.is_null()) return nullptr;

oop result = java_security_AccessControlContext::create(objArrayHandle(), is_privileged, privileged_context, CHECK_NULL);
return JNIHandles::make_local(THREAD, result);
}

objArrayOop context = oopFactory::new_objArray(vmClasses::ProtectionDomain_klass(),
local_array->length(), CHECK_NULL);
objArrayHandle h_context(thread, context);
for (int index = 0; index < local_array->length(); index++) {
h_context->obj_at_put(index, local_array->at(index)());
}

oop result = java_security_AccessControlContext::create(h_context, is_privileged, privileged_context, CHECK_NULL);

return JNIHandles::make_local(THREAD, result);
JVM_END

class ScopedValueBindingsResolver {
public:
InstanceKlass* Carrier_klass;
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,6 @@ const int ObjectAlignmentInBytes = 8;
develop(bool, PrintCodeCacheExtension, false, \
"Print extension of code cache") \
\
develop(bool, UsePrivilegedStack, true, \
"Enable the security JVM functions") \
\
product(bool, ClassUnloading, true, \
"Do unloading of classes") \
\
Expand Down
Loading