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

Do unprivileged CRIU dump if requested+supported #14836

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

ymanton
Copy link
Member

@ymanton ymanton commented Apr 1, 2022

If the user requests an unprivileged CRIU dump we check
if a non-NULL criu_set_unprivileged symbol can be found via
dlsym() and if so call it with true as the parameter.

If the user requests an unprivileged CRIU dump but the symbol
cannot be found we throw an exception.

If the user does not request an unprivileged CRIU dump we do
nothing as CRIU (currently) defaults to privileged.

Also link against libdl to get access to dlsym().

Signed-off-by: Younes Manton [email protected]

@ymanton ymanton added the criu Used to track CRIU snapshot related work label Apr 1, 2022
@ymanton
Copy link
Member Author

ymanton commented Apr 1, 2022

FYI @tajila @tjwatson

The corresponding Open Liberty PR is OpenLiberty/open-liberty#20683

runtime/nls/j9cl/j9jcl.nls Outdated Show resolved Hide resolved
@ymanton ymanton force-pushed the criu-unprivileged branch from 7d81d4d to e90bad6 Compare April 1, 2022 19:10
Copy link
Contributor

@tajila tajila left a comment

Choose a reason for hiding this comment

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

Looks good, just some formatting things

systemReturnCode = J9_CRIU_UNPRIVILEGED_NO_ERROR;
criu_set_unprivileged_ptr(TRUE);
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

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

format: } else {

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks.

@@ -256,6 +264,8 @@ Java_org_eclipse_openj9_criu_CRIUSupport_checkpointJVMImpl(JNIEnv *env,
const char *nlsMsgFormat = NULL;
UDATA msgCharLength = 0;
IDATA systemReturnCode = 0;
fn_criu_set_unprivileged criu_set_unprivileged_ptr = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

use camelCase for naming here

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks.

@@ -350,6 +360,30 @@ Java_org_eclipse_openj9_criu_CRIUSupport_checkpointJVMImpl(JNIEnv *env,
goto closeWorkDirFD;
}

if (TRUE == unprivileged) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should be JNI_TRUE

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks.

@@ -36,6 +37,8 @@

extern "C" {

typedef void (*fn_criu_set_unprivileged)(bool unprivileged);
Copy link
Contributor

Choose a reason for hiding this comment

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

is it defined with bool in the criu API?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I actually added the function since it is missing from checkpoint-restore/criu#1155 however other functions taking a boolean (e.g. criu_set_shell_job) also define their booleans as bool.

@ymanton ymanton force-pushed the criu-unprivileged branch from e90bad6 to 1577bd4 Compare April 1, 2022 20:38
}
if ((NULL == dlerrorReturnString) && (NULL != criuSetUnprivileged)) {
systemReturnCode = J9_CRIU_UNPRIVILEGED_NO_ERROR;
criuSetUnprivileged(TRUE);
Copy link
Contributor

Choose a reason for hiding this comment

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

please JNI_FALSE != unprivileged for consistency

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks.

If the user requests an unprivileged CRIU dump we check
if a non-NULL `criu_set_unprivileged` symbol can be found via
dlsym() and if so call it with `true` as the parameter.

If the user requests an unprivileged CRIU dump but the symbol
cannot be found we throw an exception.

If the user does not request an unprivileged CRIU dump we do
nothing as CRIU (currently) defaults to privileged.

Also link against libdl to get access to dlsym().

Signed-off-by: Younes Manton <[email protected]>
@ymanton ymanton force-pushed the criu-unprivileged branch from 1577bd4 to cbb83ab Compare April 6, 2022 04:59
@tajila
Copy link
Contributor

tajila commented Apr 6, 2022

Jenkins compile xlinuxcriu jdk11

@tajila
Copy link
Contributor

tajila commented Apr 6, 2022

Jenkins test sanity win jdk8

@tajila
Copy link
Contributor

tajila commented Apr 6, 2022

Jenkins test sanity plinux jdk11

@tajila tajila merged commit 9554590 into eclipse-openj9:master Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
criu Used to track CRIU snapshot related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants