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

8314260: Unable to load system libraries on Windows when using a SecurityManager #865

Closed
wants to merge 1 commit into from

Conversation

minborg
Copy link
Collaborator

@minborg minborg commented Aug 15, 2023

This PR proposes to read the system environment variable "SystemRoot" using a privileged operation so it will work in the event a default SecurityManager is in place.


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8314260: Unable to load system libraries on Windows when using a SecurityManager (Bug - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/panama-foreign.git pull/865/head:pull/865
$ git checkout pull/865

Update a local copy of the PR:
$ git checkout pull/865
$ git pull https://git.openjdk.org/panama-foreign.git pull/865/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 865

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/panama-foreign/pull/865.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 15, 2023

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

@openjdk openjdk bot added the rfr Ready for review label Aug 15, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 15, 2023

Webrevs

Copy link
Member

@JornVernee JornVernee left a comment

Choose a reason for hiding this comment

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

Nice find!

Comment on lines +77 to +83
@SuppressWarnings("removal")
String systemRoot = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return System.getenv("SystemRoot");
}
});
Copy link
Member

Choose a reason for hiding this comment

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

We can use sun.security.action.GetPropertyAction.privilegedGetProperty here for simplicity. See e.g. https://github.com/openjdk/panama-foreign/blob/foreign-memaccess%2Babi/src/java.base/share/classes/jdk/internal/foreign/CABI.java#L50 where it's used as well.

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, that is for System properties. Here we're reading an environment variable.

Choose a reason for hiding this comment

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

Maybe sun.security.action.GetEnvironmentPropertyAction::privilegedGetenv(String) could be added for calling java.lang.System::getenv(String).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe sun.security.action.GetEnvironmentPropertyAction::privilegedGetenv(String) could be added for calling java.lang.System::getenv(String).

I am unable to find such a class/method:

image

Choose a reason for hiding this comment

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

I mean create such a class by copying what the other sun.security.action.Get*Action classes do.

@minborg minborg marked this pull request as draft August 15, 2023 12:58
@openjdk openjdk bot removed the rfr Ready for review label Aug 15, 2023
@minborg
Copy link
Collaborator Author

minborg commented Aug 15, 2023

We will convert this PR into a PR on the mainline after the JEP PR is merged.

@mcimadamore
Copy link
Collaborator

We will convert this PR into a PR on the mainline after the JEP PR is merged.

Please close this PR if this is not meant to be integrated.

@minborg
Copy link
Collaborator Author

minborg commented Sep 5, 2023

These proposals will be targeted to the mainline and thus, I am closing this PR.

@minborg minborg closed this Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants