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

8344235: Revisit SecurityManager usage in java.logging after JEP 486 and JEP 491 integration #22281

Closed
wants to merge 3 commits into from

Conversation

dfuch
Copy link
Member

@dfuch dfuch commented Nov 20, 2024

This PR remove usage of SecurityManager, doPrivileges, etc... from java.logging and java.base/jdk.internal.logger

Only notable hack - Logger.checkPermission() no longer checks permissions, but has been renamed into ensureLogManagerInitialized() in order to avoid disturbing the initialization sequence of Logger/LogManager.

I am not 100% sure this is still needed - but I remember we had some entanglement issues in the past that had been hard to solve, so it seemed prudent to keep the call:

    if (manager == null) {
        manager = LogManager.getLogManager();
    }

where manager is a private volatile field in Logger.

I also took the opportunity to remove the locking workaround that had been introduced to support Virtual Threads and revert to using synchronized in the Handler classes now that JEP 491 has been integrated.


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-8344235: Revisit SecurityManager usage in java.logging after JEP 486 and JEP 491 integration (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22281

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 20, 2024

👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 20, 2024

@dfuch This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8344235: Revisit SecurityManager usage in java.logging after JEP 486 and JEP 491 integration

Reviewed-by: jpai

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 15 new commits pushed to the master branch:

  • f2b10c6: 8340422: ZGC: TestAllocateHeapAt.java should not run with transparent hugepages
  • 5ccd510: 8326369: Add test to verify bimorphic inlining happens after morphism changes
  • 93aa7e2: 8328085: C2: Use after free in PhaseChaitin::Register_Allocate()
  • 10def48: 8344236: Revisit SecurityManager usage in jdk.net after JEP 486 integration
  • 7105bb9: 8344664: Remove some un-used java/sun.security imports in the java.desktop module
  • a01aa22: 8342281: Deprecate for removal javax.sound.sampled.AudioPermission
  • 4fbf272: 8344526: RISC-V: implement -XX:+VerifyActivationFrameSize
  • 1343911: 8340334: Update jcmd VM.events max parameter to be INT
  • 400eb9b: 8344524: Remove SecurityManager related code from jdk.jlink module
  • a599c30: 8344471: Remove SecurityManager related code from java.compiler module
  • ... and 5 more: https://git.openjdk.org/jdk/compare/c4c6b1fe0629d313e7b7bd6b7dc92f8c7d18ec8f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 20, 2024
@openjdk
Copy link

openjdk bot commented Nov 20, 2024

@dfuch The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Nov 20, 2024

Webrevs

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.

Looks good

final Iterator<System.LoggerFinder> iterator;
if (System.getSecurityManager() == null) {
iterator = ServiceLoader.load(System.LoggerFinder.class,
final Iterator<System.LoggerFinder> iterator =
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be simply be return ... no need for a local var.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

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

Hello Daniel, the changes look good to me. However, these changes appear to include both JEP 486 related updates as well as the JEP 491 (the reverting of ReentrantLock usage in favour of synchronized). Doing this clean up together I think is fine. However, I think we should update the issue title to also include JEP 491 in addition to JEP 486.

@dfuch dfuch changed the title 8344235: Revisit SecurityManager usage in java.logging after JEP 486 integration 8344235: Revisit SecurityManager usage in java.logging after JEP 486 and JEP 491 integration Nov 21, 2024
@dfuch
Copy link
Member Author

dfuch commented Nov 21, 2024

Hello Daniel, the changes look good to me. However, these changes appear to include both JEP 486 related updates as well as the JEP 491 (the reverting of ReentrantLock usage in favour of synchronized). Doing this clean up together I think is fine. However, I think we should update the issue title to also include JEP 491 in addition to JEP 486.

Oh right. I should have mentioned that in the summary. This is now done, I modified the JBS and PR titles as suggested too.

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 21, 2024
@dfuch
Copy link
Member Author

dfuch commented Nov 21, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Nov 21, 2024

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

  • 18df6fd: 8336707: Contention of ForkJoinPool grows when stealing works
  • f2b10c6: 8340422: ZGC: TestAllocateHeapAt.java should not run with transparent hugepages
  • 5ccd510: 8326369: Add test to verify bimorphic inlining happens after morphism changes
  • 93aa7e2: 8328085: C2: Use after free in PhaseChaitin::Register_Allocate()
  • 10def48: 8344236: Revisit SecurityManager usage in jdk.net after JEP 486 integration
  • 7105bb9: 8344664: Remove some un-used java/sun.security imports in the java.desktop module
  • a01aa22: 8342281: Deprecate for removal javax.sound.sampled.AudioPermission
  • 4fbf272: 8344526: RISC-V: implement -XX:+VerifyActivationFrameSize
  • 1343911: 8340334: Update jcmd VM.events max parameter to be INT
  • 400eb9b: 8344524: Remove SecurityManager related code from jdk.jlink module
  • ... and 6 more: https://git.openjdk.org/jdk/compare/c4c6b1fe0629d313e7b7bd6b7dc92f8c7d18ec8f...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 21, 2024

@dfuch Pushed as commit a62279c.

💡 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
Labels
core-libs [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants