[foreign-memaccess+abi] RFR: 8314260: Unable to load system libraries on Windows when using a SecurityManager
Jorn Vernee
jvernee at openjdk.org
Tue Aug 15 12:41:26 UTC 2023
On Tue, 15 Aug 2023 11:42:19 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> 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.
Nice find!
src/java.base/share/classes/jdk/internal/foreign/SystemLookup.java line 83:
> 81: return System.getenv("SystemRoot");
> 82: }
> 83: });
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.
-------------
PR Review: https://git.openjdk.org/panama-foreign/pull/865#pullrequestreview-1578474553
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/865#discussion_r1294539291
More information about the panama-dev
mailing list