Skip to content

Commit

Permalink
Merge pull request #10787 from JasonFengJ9/v0.23-smcheck
Browse files Browse the repository at this point in the history
(v0.23.0-release) Add security check at System.loadLibrary(libName)
  • Loading branch information
pshipton committed Oct 9, 2020
2 parents 2490f2f + 2dc151c commit 3bf8762
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions jcl/src/java.base/share/classes/java/lang/ClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1913,9 +1913,6 @@ static ClassLoader callerClassLoader() {
* if the library was not allowed to be loaded
*/
static void loadLibraryWithClassLoader(String libName, ClassLoader loader) {
SecurityManager smngr = System.getSecurityManager();
if (smngr != null)
smngr.checkLink(libName);
if (loader != null) {
String realLibName = loader.findLibrary(libName);

Expand Down
4 changes: 4 additions & 0 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,10 @@ public static void load(String pathName) {
*/
@CallerSensitive
public static void loadLibrary(String libName) {
SecurityManager smngr = System.getSecurityManager();
if (smngr != null) {
smngr.checkLink(libName);
}
/*[IF Java15]*/
ClassLoader.loadLibrary(getCallerClass(), libName);
/*[ELSE]*/
Expand Down

0 comments on commit 3bf8762

Please sign in to comment.