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

8343981: Remove usage of security manager from Thread and related classes #22035

Closed
wants to merge 227 commits into from

Conversation

AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Nov 12, 2024

Removes the SecurityManager usage from Thread + friends.

In Thread, the getContextClassLoader method is no longer caller-sensitive method.

JavaLangAccess.newThreadWithAcc is removed and jdk.internal.access is no longer exported to java.naming. The usage of newThreadWithAcc is removed from com.sun.jndi.ldap.VersionHelper. There will be further work on the java.naming module to remove usage of SM, the change here is specific to the usage of ewThreadWithAcc.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8343981: Remove usage of security manager from Thread and related classes (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22035/head:pull/22035
$ git checkout pull/22035

Update a local copy of the PR:
$ git checkout pull/22035
$ git pull https://git.openjdk.org/jdk.git pull/22035/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22035

View PR using the GUI difftool:
$ git pr show -t 22035

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22035.diff

Using Webrev

Link to Webrev Comment

AlanBateman and others added 30 commits September 30, 2024 18:02
Co-authored-by: Sean Mullan <[email protected]>
Co-authored-by: Alan Bateman <[email protected]>
Co-authored-by: Weijun Wang <[email protected]>
Co-authored-by: Aleksei Efimov <[email protected]>
Co-authored-by: Brian Burkhalter <[email protected]>
Co-authored-by: Daniel Fuchs <[email protected]>
Co-authored-by: Harshitha Onkar <[email protected]>
Co-authored-by: Joe Wang <[email protected]>
Co-authored-by: Jorn Vernee <[email protected]>
Co-authored-by: Justin Lu <[email protected]>
Co-authored-by: Kevin Walls <[email protected]>>
Co-authored-by: Lance Andersen <[email protected]>
Co-authored-by: Naoto Sato <[email protected]>
Co-authored-by: Roger Riggs <[email protected]>
Co-authored-by: Brent Christian <[email protected]>
setInitialContextFactoryBuilder and setObjectFactoryBuilder methods in
javax.naming.spi.NamingManager.
permission cannot be used anymore to control access.
…sion

checks of the Class.getNestHost and getNestMembers methods, which no
longer apply.
@AlanBateman AlanBateman marked this pull request as ready for review November 12, 2024 16:42
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 12, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 12, 2024

Webrevs

@openjdk-notifier openjdk-notifier bot changed the base branch from pr/21498 to master November 12, 2024 17:20
@openjdk-notifier
Copy link

The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork:

git checkout JDK-8343981
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk
Copy link

openjdk bot commented Nov 12, 2024

@AlanBateman this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8343981
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk
Copy link

openjdk bot commented Nov 12, 2024

⚠️ @AlanBateman This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Nov 12, 2024
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Nov 12, 2024
@dfuch
Copy link
Member

dfuch commented Nov 12, 2024

The proposed changes look reasonable to me. Good simplification of the code. I had some uncertainty about the JNDI changes but I couldn't find any place in JNDI where a Subject would be extracted from the ACC associated with the created thread so I'd say that looks fine.

@AlanBateman
Copy link
Contributor Author

The proposed changes look reasonable to me. Good simplification of the code. I had some uncertainty about the JNDI changes but I couldn't find any place in JNDI where a Subject would be extracted from the ACC associated with the created thread so I'd say that looks fine.

ACC is dead and Subject is re-implemented on ScopedValue now so I think we are okay. There will be many other places where we will also drop the capture and use of the ACC.

PrivilegedAction<Thread> act =
() -> SharedSecrets.getJavaLangAccess().newThreadWithAcc(r, acc);
return AccessController.doPrivileged(act);
return new Thread(r);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the refactoring go back to the callers of createThread() to just create threads themselves.
And remove this trivial method.

Copy link
Contributor Author

@AlanBateman AlanBateman Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will happen in the PR that does the cleanup of java.naming module.

Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 13, 2024
@mur47x111
Copy link
Contributor

mur47x111 commented Nov 13, 2024

Please hold until I have the Graal changes ready
Good to go

@AlanBateman
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 13, 2024

Going to push as commit 5e01c40.
Since your change was applied there have been 22 commits pushed to the master branch:

  • dbf2346: 8341260: Add Float16 to jdk.incubator.vector
  • a5f11b5: 8343483: Remove unnecessary @SuppressWarnings annotations (serviceability)
  • 7be7772: 8344112: Remove code to support security manager execution mode from DatagramChannel implementation
  • bd3fec3: 8344086: Remove security manager dependency in FFM
  • 916694f: 8343317: Extend test generation tool to handle APX NDD/NF flavor of instructions
  • eb240a7: 8344051: Problemlist jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.java with ZGC until JDK-8343893 is fixed
  • c00e20c: 8343285: java.lang.Process is unresponsive and CPU usage spikes to 100%
  • cc2acd1: 8343286: Missing unchecked cast warning in polymorphic method call
  • b80ca49: 8344124: JDK-8341411 Broke the build
  • a08d67c: 8344080: Return type mismatch for jfr_unregister_stack_filter
  • ... and 12 more: https://git.openjdk.org/jdk/compare/63eb4853f6782f350f67b6bcf25d83bc4480be71...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 13, 2024
@openjdk openjdk bot closed this Nov 13, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 13, 2024
@openjdk
Copy link

openjdk bot commented Nov 13, 2024

@AlanBateman Pushed as commit 5e01c40.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.