Skip to content

Commit

Permalink
Add a null undo function to the vmbackup null provider.
Browse files Browse the repository at this point in the history
If a snapshot operation times out, vmbackup can attempt
to undo quiescing.  Since no quiescing is done for the null
backup provider, no undo function was provided.  If vmbackup
attempts to call the undo function, it dereferences a garbage
pointer resulting in a segfault.

Rather than add null backup provider specific checks to vmbackup,
this change adds a null undo function to provide vmbackup with a
valid function pointer it can call.  The new undo function updates
the vmbackup state machine state with a new currentOpName, but
has no other effect.  currentOpName is set to the calling
function name, e.g. __FUNCTION__.
  • Loading branch information
johnwvmw committed Nov 10, 2022
1 parent db9cb27 commit f7009c5
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion open-vm-tools/services/plugins/vmbackup/nullProvider.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*********************************************************
* Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
* Copyright (C) 2010-2016, 2022 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
Expand Down Expand Up @@ -243,6 +243,32 @@ VmBackupNullSnapshotDone(VmBackupState *state,
return TRUE;
}


/*
******************************************************************************
* VmBackupNullUndo -- */ /**
*
* Update the state machine state with the currentOpName.
*
* Can be called when snapshot times out. See PR2993571 and PR3003917.
*
* @param[in] state the backup state
* @param[in] clientData client data
*
* @return TRUE
*
******************************************************************************
*/

static Bool
VmBackupNullUndo(VmBackupState *state,
void *clientData)
{
g_debug("*** %s\n", __FUNCTION__);
VmBackup_SetCurrentOp(state, NULL, NULL, __FUNCTION__);
return TRUE;
}

#endif

/*
Expand Down Expand Up @@ -281,6 +307,9 @@ VmBackup_NewNullProvider(void)

provider = g_new(VmBackupSyncProvider, 1);
provider->start = VmBackupNullStart;
#if !defined(_WIN32)
provider->undo = VmBackupNullUndo;
#endif
provider->snapshotDone = VmBackupNullSnapshotDone;
provider->release = VmBackupNullRelease;
provider->clientData = NULL;
Expand Down

0 comments on commit f7009c5

Please sign in to comment.