Skip to content

8344218: Remove calls to SecurityManager and and doPrivileged in java.net.NetworkInterface after JEP 486 integration #22177

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

Closed
wants to merge 4 commits into from

Conversation

eirbjo
Copy link
Contributor

@eirbjo eirbjo commented Nov 16, 2024

Please review this PR which cleans up SecurityManager related code from java.net.NetworkInterface after JEP-486.

The specification of three methods in NetworkInterface is updated to reflect that these methods no longer use SecurityManager to filter their results such that a subset may be returned. A CSR draft has been proposed to fix this leftover from JEP-486.

The actual SecurityManager cleanup:

  • The getCheckedInetAddresses method is removed.
  • getInetAddresses is updated to return enumerationFromArray(addrs) (with no filtering)
  • inetAddresses is update to return streamFromArray(addrs) (with no filtering)
  • getInterfaceAddresses is updated to return the list of InterfaceAddresses (with no filtering)
  • getHardwareAddress is updated to return the result with no permission checking
  • Three c-style array declarations hurt my eyes and were updated (sorry!)

GHA and tier2 results pending.


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
  • Change requires CSR request JDK-8344351 to be approved

Issues

  • JDK-8344218: Remove calls to SecurityManager and and doPrivileged in java.net.NetworkInterface after JEP 486 integration (Sub-task - P4)
  • JDK-8344351: Adjust specifications of java.net.NetworkInterface methods getInetAddresses, inetAddresses and getInterfaceAddresses post JEP-468 (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22177

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 16, 2024

👋 Welcome back eirbjo! 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 16, 2024

@eirbjo 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:

8344218: Remove calls to SecurityManager and and doPrivileged in java.net.NetworkInterface after JEP 486 integration

Reviewed-by: dfuchs

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 25 new commits pushed to the master branch:

  • d76b5b8: 8344253: Test java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java failed
  • 3e78ff1: 8320743: AEAD ciphers throw undocumented exceptions on overflow
  • 2078329: 8344134: Use static property in SystemLookup
  • 162d66a: 8318668: java/lang/management/MemoryMXBean/CollectionUsageThreshold.java fails with Xcomp
  • 9b0ab92: 8344034: Remove security manager dependency in Serialization
  • d52d136: 8344221: Remove calls to SecurityManager and and doPrivileged in java.net.IDN, java.net.URL, java.net.URLConnection, sun.net.util.URLUtil, and java.net.URLStreamHandlerProvider after JEP 486 integration
  • dfddbca: 8341916: Remove ProtectionDomain related hotspot code and tests
  • 5eb0733: 8344383: Include ZipArchive and JarArchive directly
  • b8b70c8: 8344379: [s390x] build failure due to missing change from JDK-8339466
  • 5fc4322: 8288298: Resolve multiline message parsing ambiguities in UL
  • ... and 15 more: https://git.openjdk.org/jdk/compare/d0b770c938be6b5b3a0176148265ef33184a9b8b...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
Copy link

openjdk bot commented Nov 16, 2024

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

  • net

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.

@openjdk openjdk bot added the net net-dev@openjdk.org label Nov 16, 2024
@eirbjo eirbjo changed the title 8344351: Remove calls to SecurityManager and and doPrivileged in java.net.NetworkInterface after JEP 486 integration 8344218: Remove calls to SecurityManager and and doPrivileged in java.net.NetworkInterface after JEP 486 integration Nov 16, 2024
@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Nov 16, 2024
@eirbjo
Copy link
Contributor Author

eirbjo commented Nov 16, 2024

/issue 8344218

@openjdk
Copy link

openjdk bot commented Nov 16, 2024

@eirbjo This issue is referenced in the PR title - it will now be updated.

@eirbjo
Copy link
Contributor Author

eirbjo commented Nov 16, 2024

/csr

@openjdk
Copy link

openjdk bot commented Nov 16, 2024

@eirbjo an approved CSR request is already required for this pull request.

@eirbjo eirbjo marked this pull request as ready for review November 16, 2024 21:53
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 16, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 16, 2024

Webrevs

*
* @return a byte array containing the address, or {@code null} if
* the address doesn't exist or is not accessible
* the address doesn't exist
Copy link
Contributor

Choose a reason for hiding this comment

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

"accessed given the current privileges" relates to OS privileges/capabilities so not security manager related. So I think drop the change the method description, only change to this method should be the removal of the SM permission check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, so "not only security manager related then" :-) The current implementation does return null on checkPermission failure, but yes, there are other ways null may be returned.

I'll remove the method description changes and update the CSR as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, so "not only security manager related then" :-) The current implementation does return null on checkPermission failure, but yes, there are other ways null may be returned.

JEP 486 removed the sentence "If a security manager is set .." and changed the return description. There are platforms where the process needs privileges or capabilities to read the hardware address so that the motive for the description. Thanks for dropping this change from the PR/CSR.

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Good to see this code go away.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Nov 18, 2024
@eirbjo
Copy link
Contributor Author

eirbjo commented Nov 19, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Nov 19, 2024

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

  • d85dd77: 8344365: SecurityManager cleanups in java.sql and java.sql.rowset modules
  • 9e92a9e: 8344059: Remove doPrivileged calls from windows platform sources in the java.desktop module
  • 3729884: 8344371: RISC-V: compiler/intrinsics/chacha/TestChaCha20.java fails after JDK-8343555
  • dd86369: 8344262: Win32AttachOperationRequest objects are created by using global new
  • 5cb0d43: 8293040: Argfile documentation for java launcher tool is confusing regarding usage of wildcards
  • 8d43e0d: 8344331: SM cleanup in java.scripting
  • f636674: 8344247: Move objectWaiter field to VirtualThread instance
  • de6e013: 8344310: Remove Security Manager dependencies from javax.crypto and com.sun.crypto packages
  • 92271af: 8344058: Remove doPrivileged calls from macos platform sources in the java.desktop module
  • 70eb95f: 8344187: Remove SecurityManager and related calls from java.instrument
  • ... and 30 more: https://git.openjdk.org/jdk/compare/d0b770c938be6b5b3a0176148265ef33184a9b8b...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 19, 2024

@eirbjo Pushed as commit b12c5b4.

💡 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
integrated Pull request has been integrated net net-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants