On Thu, 24 Oct 2024 13:19:55 GMT, Sean Mullan <mul...@openjdk.org> wrote:
>> This is the implementation of JEP 486: Permanently Disable the Security >> Manager. See [JEP 486](https://openjdk.org/jeps/486) for more details. The >> [CSR](https://bugs.openjdk.org/browse/JDK-8338412) describes in detail the >> main changes in the JEP and also includes an apidiff of the specification >> changes. >> >> NOTE: the majority (~95%) of the changes in this PR are test updates >> (removal/modifications) and API specification changes, the latter mostly to >> remove `@throws SecurityException`. The remaining changes are primarily the >> removal of the `SecurityManager`, `Policy`, `AccessController` and other >> Security Manager API implementations. There is very little new code. >> >> The code changes can be broken down into roughly the following categories: >> >> 1. Degrading the behavior of Security Manager APIs to either throw >> Exceptions by default or provide an execution environment that disallows >> access to all resources by default. >> 2. Changing hundreds of methods and constructors to no longer throw a >> `SecurityException` if a Security Manager was enabled. They will operate as >> they did in JDK 23 with no Security Manager enabled. >> 3. Changing the `java` command to exit with a fatal error if a Security >> Manager is enabled. >> 4. Removing the hotspot native code for the privileged stack walk and the >> inherited access control context. The remaining hotspot code and tests >> related to the Security Manager will be removed immediately after >> integration - see [JDK-8341916](https://bugs.openjdk.org/browse/JDK-8341916). >> 5. Removing or modifying hundreds of tests. Many tests that tested Security >> Manager behavior are no longer relevant and thus have been removed or >> modified. >> >> There are a handful of Security Manager related tests that are failing and >> are at the end of the `test/jdk/ProblemList.txt`, >> `test/langtools/ProblemList.txt` and `test/hotspot/jtreg/ProblemList.txt` >> files - these will be removed or separate bugs will be filed before >> integrating this PR. >> >> Inside the JDK, we have retained calls to >> `SecurityManager::getSecurityManager` and `AccessController::doPrivileged` >> for now, as these methods have been degraded to behave the same as they did >> in JDK 23 with no Security Manager enabled. After we integrate this JEP, >> those calls will be removed in each area (client-libs, core-libs, security, >> etc). >> >> I don't expect each reviewer to review all the code changes in this JEP. >> Rather, I advise that you only focus on the changes for the area >> (client-libs, core-libs, net, ... > > Sean Mullan has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 150 commits: > > - Merge remote-tracking branch 'jdk-sandbox/jep486' into JDK-8338411 > - Merge > - Update @summary to replace "if the right permission is granted" can be > replaced with "package java.lang is open to unnamed module". > - Remove println about Security Manager. > - Remove unused static variable NEW_PROXY_IN_PKG. > - Remove static variable `DEFAULT_POLICY` and unused imports. > - Remove hasSM() method and code that calls it, and remove comment about > running test manually with SM. > - clientlibs: import order > - warning-string > - java/net/httpclient/websocket/security/WSURLPermissionTest.java: > integrated review feedback in renamed WSSanityTest.java > - ... and 140 more: https://git.openjdk.org/jdk/compare/f7a61fce...cb50dfde Changes requested by aivanov (Reviewer). test/jdk/javax/sound/midi/Soundbanks/GetSoundBankSecurityException/GetSoundBankSecurityException.java line 1: > 1: /* I believe this test becomes irrelevant without `SecurityManager`. The summary of the test states, “`MidiSystem.getSoundbank()` throws unexpected `SecurityException`” which couldn't happen if there's no security manager. Also see [JDK-8312535](https://bugs.openjdk.org/browse/JDK-8312535). test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java line 1: > 1: /* I think we can delete this test. It verifies that popup menus are displayed in a windows `isAlwaysOnTop() == true` in stand-alone apps whereas for applets `isAlwaysOnTop() == false`. If there's no such distinction, the test tests nothing but the fact that popup menus are displayed in always-on-top windows. The updated test does not test anything for [JDK-6691503](https://bugs.openjdk.org/browse/JDK-6691503) and its changeset https://github.com/openjdk/jdk/commit/8dff6c648be296799e4a7e0e1964d339acc0d724. test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java line 44: > 42: private static JFrame frame; > 43: private static JPopupMenu popupMenu; > 44: private static volatile boolean isAlwaysOnTop1 = false; Suggestion: private static volatile boolean isAlwaysOnTop = false; There's only one flag now, it needs no modifier. test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java line 54: > 52: > 53: SwingUtilities.invokeAndWait(bug6691503::testApplication); > 54: robot.delay(200); The additional delay is redundant. test/jdk/javax/swing/JPopupMenu/6694823/bug6694823.java line 41: > 39: * @bug 6694823 > 40: * @summary Checks that popup menu cannot be partially hidden > 41: * by the task bar. I believe this test is irrelevant without the security manager. The test above, `test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java` asserts that popup menus in applets don't have their always-on-top flag set to true, therefore such popups will be displayed below the taskbar. Popup menus in stand-alone apps have their always-on-top flag set to true, therefore they can be displayed on top of the taskbar. We have a specific test which verifies [`TaskbarPositionTest.java`](https://github.com/openjdk/jdk/blob/master/test/jdk/javax/swing/Popup/TaskbarPositionTest.java) that a popup menu could overlap the taskbar. test/jdk/javax/swing/UIDefaults/6622002/bug6622002.java line 1: > 1: /* Again, I'm unsure this test has a value after the security manager is removed. All it verifies is that whatever reflection is used in `UIDefaults.ProxyLazyValue` works. Anyway, the updated test doesn't verify the issue reported in the bug, which is to prevent instantiation of values using non-public classes. ------------- PR Review: https://git.openjdk.org/jdk/pull/21498#pullrequestreview-2395179909 PR Review Comment: https://git.openjdk.org/jdk/pull/21498#discussion_r1816616064 PR Review Comment: https://git.openjdk.org/jdk/pull/21498#discussion_r1816806950 PR Review Comment: https://git.openjdk.org/jdk/pull/21498#discussion_r1816827134 PR Review Comment: https://git.openjdk.org/jdk/pull/21498#discussion_r1816826424 PR Review Comment: https://git.openjdk.org/jdk/pull/21498#discussion_r1816840082 PR Review Comment: https://git.openjdk.org/jdk/pull/21498#discussion_r1816896526