8227587: Add internal privileged System.loadLibrary

Reviewed-by: rriggs, mchung, chegar
This commit is contained in:
Claes Redestad 2019-07-17 12:35:46 +02:00
parent ec7f1c13d9
commit 78a1c8ea0a
26 changed files with 97 additions and 218 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -160,13 +160,7 @@ public class ResolverConfigurationImpl
static native int notifyAddrChange0();
static {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("net");
return null;
}
});
jdk.internal.loader.BootLoader.loadLibrary("net");
init0();
// start the address listener thread

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,6 @@ package sun.nio.fs;
import java.nio.file.*;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* File type detector that does lookup of file extension using Windows Registry.
@ -70,13 +68,8 @@ public class RegistryFileTypeDetector
private static native String queryStringValue(long subKey, long name);
static {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
// nio.dll has dependency on net.dll
System.loadLibrary("net");
System.loadLibrary("nio");
return null;
}});
// nio.dll has dependency on net.dll
jdk.internal.loader.BootLoader.loadLibrary("net");
jdk.internal.loader.BootLoader.loadLibrary("nio");
}
}

View file

@ -25,8 +25,6 @@
package sun.nio.fs;
import java.security.AccessController;
import java.security.PrivilegedAction;
import jdk.internal.misc.Unsafe;
import static sun.nio.fs.WindowsConstants.*;
@ -1153,13 +1151,9 @@ class WindowsNativeDispatcher {
private static native void initIDs();
static {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
// nio.dll has dependency on net.dll
System.loadLibrary("net");
System.loadLibrary("nio");
return null;
}});
// nio.dll has dependency on net.dll
jdk.internal.loader.BootLoader.loadLibrary("net");
jdk.internal.loader.BootLoader.loadLibrary("nio");
initIDs();
}