VirtualBox

忽略:
時間撮記:
2015-3-13 下午05:59:58 (10 年 以前)
作者:
vboxsync
訊息:

Fixes for disk encryption when working with snapshots

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r54716 r54758  
    50005000}
    50015001
     5002void Console::i_removeSecretKeysOnSuspend()
     5003{
     5004    /* Remove keys which are supposed to be removed on a suspend. */
     5005    SecretKeyMap::iterator it = m_mapSecretKeys.begin();
     5006    while (it != m_mapSecretKeys.end())
     5007    {
     5008        SecretKey *pKey = it->second;
     5009        if (pKey->m_fRemoveOnSuspend)
     5010        {
     5011            /* Unconfigure disk encryption from all attachments associated with this key. */
     5012            i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(it->first);
     5013
     5014            AssertMsg(!pKey->m_cRefs, ("No one should access the stored key at this point anymore!\n"));
     5015            delete pKey;
     5016            m_mapSecretKeys.erase(it++);
     5017        }
     5018        else
     5019            it++;
     5020    }
     5021}
     5022
    50025023/**
    50035024 * Process a network adaptor change.
     
    63506371        case MachineState_TeleportingPausedVM:
    63516372        case MachineState_Saving:
     6373
     6374        /* Remove any keys which are supposed to be removed on a suspend. */
     6375        if (   aReason == Reason_HostSuspend
     6376            || aReason == Reason_HostBatteryLow)
     6377            i_removeSecretKeysOnSuspend();
     6378
    63526379            return setError(VBOX_E_INVALID_VM_STATE, tr("Already paused"));
    63536380
     
    63796406    if (RT_FAILURE(vrc))
    63806407        hrc = setError(VBOX_E_VM_ERROR, tr("Could not suspend the machine execution (%Rrc)"), vrc);
    6381     else
    6382     {
    6383         /* Remove keys which are supposed to be removed on a VM suspend. */
    6384         SecretKeyMap::iterator it = m_mapSecretKeys.begin();
    6385         while (it != m_mapSecretKeys.end())
    6386         {
    6387             SecretKey *pKey = it->second;
    6388             if (pKey->m_fRemoveOnSuspend)
    6389             {
    6390                 /* Unconfigure disk encryption from all attachments associated with this key. */
    6391                 i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(it->first);
    6392 
    6393                 AssertMsg(!pKey->m_cRefs, ("No one should access the stored key at this point anymore!\n"));
    6394                 delete pKey;
    6395                 m_mapSecretKeys.erase(it++);
    6396             }
    6397             else
    6398                 it++;
    6399         }
    6400     }
     6408    else if (   aReason == Reason_HostSuspend
     6409             || aReason == Reason_HostBatteryLow)
     6410        i_removeSecretKeysOnSuspend();
    64016411
    64026412    LogFlowThisFunc(("hrc=%Rhrc\n", hrc));
     
    1018010190                    throw rc;
    1018110191
    10182                 /*
    10183                  * don't release the lock since reconfigureMediumAttachment
    10184                  * isn't going to need the Console lock.
    10185                  */
    10186 
    10187                 /* TODO: do alock.release here as EMT might wait on it! See other places
    10188                  * where we do VMR3ReqCall requests. See @bugref{7648}. */
     10192                alock.release();
    1018910193                vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
    1019010194                                       (PFNRT)i_reconfigureMediumAttachment, 13,
     
    1019210196                                       fBuiltinIOCache, false /* fSetupMerge */, 0 /* uMergeSource */,
    1019310197                                       0 /* uMergeTarget */, atts[i], that->mMachineState, &rc);
     10198                alock.acquire();
    1019410199                if (RT_FAILURE(vrc))
    1019510200                    throw i_setErrorStatic(E_FAIL, Console::tr("%Rrc"), vrc);
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette