Skip to content

Commit

Permalink
Merge pull request #17505 from JasonFengJ9/criugetpwuid
Browse files Browse the repository at this point in the history
CRIU skips j9sysinfo_get_username()/getpwuid() if isCheckPointAllowed
  • Loading branch information
tajila committed Jun 2, 2023
2 parents 0a07503 + 07e6e1e commit f514560
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion runtime/oti/j9port_generated.h
Expand Up @@ -395,9 +395,10 @@ typedef struct J9PortLibrary {
int64_t nanoTimeMonotonicClockDelta;
/* Invoking j9sysinfo_get_username()/getpwuid() with SSSD enabled can cause checkpoint failure.
* It is safe to call those methods if checkpoint is disallowed after a final restore.
* This is equivalent to isCheckpointAllowed(), just for portlibrary access.
* https://github.com/eclipse-openj9/openj9/issues/15800
*/
BOOLEAN finalRestore;
BOOLEAN isCheckPointAllowed;
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
} J9PortLibrary;

Expand Down
4 changes: 2 additions & 2 deletions runtime/port/sysvipc/j9sharedhelper.c
Expand Up @@ -236,10 +236,10 @@ cleanSharedMemorySegments(struct J9PortLibrary* portLibrary)

Trc_PRT_shared_cleanSharedMemorySegments_entry();
#if defined(J9VM_OPT_CRIU_SUPPORT)
/* finalRestore is equivalent to !isCheckpointAllowed().
/* isCheckPointAllowed is equivalent to isCheckpointAllowed().
* https://github.com/eclipse-openj9/openj9/issues/15800
*/
if (portLibrary->finalRestore)
if (!portLibrary->isCheckPointAllowed)
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
{
result = omrsysinfo_get_username(processOwner, OUTPUTBUFSIZE);
Expand Down
4 changes: 2 additions & 2 deletions runtime/port/sysvipc/j9shmem.c
Expand Up @@ -1293,10 +1293,10 @@ j9shmem_getDir(struct J9PortLibrary* portLibrary, const char* ctrlDirName, uint3
if (NULL == homeDir) {
struct passwd *pwent = NULL;
#if defined(J9VM_OPT_CRIU_SUPPORT)
/* finalRestore is equivalent to !isCheckpointAllowed().
/* isCheckPointAllowed is equivalent to isCheckpointAllowed().
* https://github.com/eclipse-openj9/openj9/issues/15800
*/
if (!portLibrary->finalRestore) {
if (portLibrary->isCheckPointAllowed) {
Trc_PRT_j9shmem_getDir_tryHomeDirFailed_notFinalRestore();
} else
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
Expand Down
2 changes: 1 addition & 1 deletion runtime/vm/CRIUHelpers.cpp
Expand Up @@ -89,7 +89,7 @@ jvmRestoreHooks(J9VMThread *currentThread)
if (vm->checkpointState.isNonPortableRestoreMode) {
PORT_ACCESS_FROM_JAVAVM(vm);
vm->checkpointState.isCheckPointAllowed = FALSE;
vm->portLibrary->finalRestore = TRUE;
vm->portLibrary->isCheckPointAllowed = FALSE;
j9port_control(J9PORT_CTLDATA_CRIU_SUPPORT_FLAGS, OMRPORT_CRIU_SUPPORT_ENABLED | J9OMRPORT_CRIU_SUPPORT_FINAL_RESTORE);
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/vm/jvminit.c
Expand Up @@ -3819,7 +3819,7 @@ processVMArgsFromFirstToLast(J9JavaVM * vm)
PORT_ACCESS_FROM_JAVAVM(vm);
vm->checkpointState.isCheckPointEnabled = TRUE;
vm->checkpointState.isCheckPointAllowed = TRUE;
vm->portLibrary->finalRestore = FALSE;
vm->portLibrary->isCheckPointAllowed = TRUE;
j9port_control(J9PORT_CTLDATA_CRIU_SUPPORT_FLAGS, OMRPORT_CRIU_SUPPORT_ENABLED);
}
}
Expand Down

0 comments on commit f514560

Please sign in to comment.