-
Notifications
You must be signed in to change notification settings - Fork 732
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
Remove System.getSecurityManager calls from java.base and criu #20939
Open
theresa-m
wants to merge
2
commits into
eclipse-openj9:master
Choose a base branch
from
theresa-m:securitymanager
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−5
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.base/share/classes/openj9/internal/criu/CRIUDumpPermission.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -210,7 +210,9 @@ public static void runRunnableInNotCheckpointSafeMode(Runnable run) { | |||||||
|
||||||||
@SuppressWarnings("restriction") | ||||||||
private static Unsafe unsafe; | ||||||||
/*[IF JAVA_SPEC_VERSION < 24]*/ | ||||||||
private static final CRIUDumpPermission CRIU_DUMP_PERMISSION = new CRIUDumpPermission(); | ||||||||
/*[ENDIF] JAVA_SPEC_VERSION < 24 */ | ||||||||
private static boolean nativeLoaded; | ||||||||
private static boolean initComplete; | ||||||||
private static String errorMsg; | ||||||||
|
@@ -307,16 +309,19 @@ private static void init() { | |||||||
* @param imageDir the directory that will hold the dump files as a | ||||||||
* java.nio.file.Path | ||||||||
* @throws NullPointerException if imageDir is null | ||||||||
/*[IF JAVA_SPEC_VERSION < 24] | ||||||||
* @throws SecurityException if no permission to access imageDir or no | ||||||||
* CRIU_DUMP_PERMISSION | ||||||||
/*[ENDIF] JAVA_SPEC_VERSION < 24 | ||||||||
* @throws IllegalArgumentException if imageDir is not a valid directory | ||||||||
*/ | ||||||||
public InternalCRIUSupport(Path imageDir) { | ||||||||
/*[IF JAVA_SPEC_VERSION < 24]*/ | ||||||||
SecurityManager manager = System.getSecurityManager(); | ||||||||
if (manager != null) { | ||||||||
manager.checkPermission(CRIU_DUMP_PERMISSION); | ||||||||
} | ||||||||
|
||||||||
/*[ENDIF] JAVA_SPEC_VERSION < 24 */ | ||||||||
setImageDir(imageDir); | ||||||||
} | ||||||||
|
||||||||
|
@@ -431,7 +436,9 @@ public InternalCRIUSupport setGhostFileLimit(long limit) { | |||||||
* @param imageDir the directory as a java.nio.file.Path | ||||||||
* @return this | ||||||||
* @throws NullPointerException if imageDir is null | ||||||||
/*[IF JAVA_SPEC_VERSION < 24] | ||||||||
* @throws SecurityException if no permission to access imageDir | ||||||||
/*[ENDIF] JAVA_SPEC_VERSION < 24 | ||||||||
* @throws IllegalArgumentException if imageDir is not a valid directory | ||||||||
*/ | ||||||||
public InternalCRIUSupport setImageDir(Path imageDir) { | ||||||||
|
@@ -441,10 +448,12 @@ public InternalCRIUSupport setImageDir(Path imageDir) { | |||||||
} | ||||||||
String dir = imageDir.toAbsolutePath().toString(); | ||||||||
|
||||||||
/*[IF JAVA_SPEC_VERSION < 24]*/ | ||||||||
SecurityManager manager = System.getSecurityManager(); | ||||||||
if (manager != null) { | ||||||||
manager.checkWrite(dir); | ||||||||
} | ||||||||
/*[ENDIF] JAVA_SPEC_VERSION < 24 */ | ||||||||
|
||||||||
this.imageDir = dir; | ||||||||
return this; | ||||||||
|
@@ -592,7 +601,9 @@ public InternalCRIUSupport setTrackMemory(boolean trackMemory) { | |||||||
* @param workDir the directory as a java.nio.file.Path | ||||||||
* @return this | ||||||||
* @throws NullPointerException if workDir is null | ||||||||
/*[IF JAVA_SPEC_VERSION < 24] | ||||||||
* @throws SecurityException if no permission to access workDir | ||||||||
/*[ENDIF] JAVA_SPEC_VERSION < 24 | ||||||||
* @throws IllegalArgumentException if workDir is not a valid directory | ||||||||
*/ | ||||||||
public InternalCRIUSupport setWorkDir(Path workDir) { | ||||||||
|
@@ -602,10 +613,12 @@ public InternalCRIUSupport setWorkDir(Path workDir) { | |||||||
} | ||||||||
String dir = workDir.toAbsolutePath().toString(); | ||||||||
|
||||||||
/*[IF JAVA_SPEC_VERSION < 24]*/ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems openj9/jcl/src/openj9.criu/share/classes/org/eclipse/openj9/criu/CRIUSupport.java Lines 38 to 40 in 48e4702
should be moved to this file and changed to
because the deprecated |
||||||||
SecurityManager manager = System.getSecurityManager(); | ||||||||
if (manager != null) { | ||||||||
manager.checkWrite(dir); | ||||||||
} | ||||||||
/*[ENDIF] JAVA_SPEC_VERSION < 24 */ | ||||||||
|
||||||||
this.workDir = dir; | ||||||||
return this; | ||||||||
|
2 changes: 1 addition & 1 deletion
2
jcl/src/openj9.criu/share/classes/org/eclipse/openj9/criu/CRIUDumpPermission.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains other security manager-related API usages, such as
AccessController.doPrivileged()
. Are they to be addressed in another PR?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I am planning to do those separately since there are also many uses.