Skip to content

Commit

Permalink
The list of locked variables is traversed at runtime, hence we must
Browse files Browse the repository at this point in the history
convert the list when transferring from physical to virtual mode.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14425 6f19259b-4bc3-4df7-8a09-765794883524
  • Loading branch information
lersek authored and niruiyu committed Jun 17, 2013
1 parent e4b7e2c commit 328e5d8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
23 changes: 23 additions & 0 deletions MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Implement all four UEFI Runtime Variable services for the nonvolatile
and volatile storage space and install variable architecture protocol.
Copyright (C) 2013, Red Hat, Inc.
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
Expand All @@ -21,6 +22,7 @@ extern VARIABLE_INFO_ENTRY *gVariableInfo;
EFI_HANDLE mHandle = NULL;
EFI_EVENT mVirtualAddressChangeEvent = NULL;
EFI_EVENT mFtwRegistration = NULL;
extern LIST_ENTRY mLockedVariableList;
extern BOOLEAN mEndOfDxe;
EDKII_VARIABLE_LOCK_PROTOCOL mVariableLock = { VariableLockRequestToLock };

Expand Down Expand Up @@ -220,6 +222,10 @@ VariableClassAddressChangeEvent (
IN VOID *Context
)
{
LIST_ENTRY *Link;
VARIABLE_ENTRY *Entry;
EFI_STATUS Status;

EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->FvbInstance->GetBlockSize);
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->FvbInstance->GetPhysicalAddress);
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->FvbInstance->GetAttributes);
Expand All @@ -236,6 +242,23 @@ VariableClassAddressChangeEvent (
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->VariableGlobal.HobVariableBase);
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);
EfiConvertPointer (0x0, (VOID **) &mNvVariableCache);

//
// in the list of locked variables, convert the name pointers first
//
for ( Link = GetFirstNode (&mLockedVariableList)
; !IsNull (&mLockedVariableList, Link)
; Link = GetNextNode (&mLockedVariableList, Link)
) {
Entry = BASE_CR (Link, VARIABLE_ENTRY, Link);
Status = EfiConvertPointer (0x0, (VOID **) &Entry->Name);
ASSERT_EFI_ERROR (Status);
}
//
// second, convert the list itself using UefiRuntimeLib
//
Status = EfiConvertList (0x0, &mLockedVariableList);
ASSERT_EFI_ERROR (Status);
}


Expand Down
23 changes: 23 additions & 0 deletions SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Implement all four UEFI Runtime Variable services for the nonvolatile
and volatile storage space and install variable architecture protocol.
Copyright (C) 2013, Red Hat, Inc.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
Expand All @@ -21,6 +22,7 @@ extern VARIABLE_INFO_ENTRY *gVariableInfo;
EFI_HANDLE mHandle = NULL;
EFI_EVENT mVirtualAddressChangeEvent = NULL;
EFI_EVENT mFtwRegistration = NULL;
extern LIST_ENTRY mLockedVariableList;
extern BOOLEAN mEndOfDxe;
EDKII_VARIABLE_LOCK_PROTOCOL mVariableLock = { VariableLockRequestToLock };

Expand Down Expand Up @@ -220,6 +222,10 @@ VariableClassAddressChangeEvent (
IN VOID *Context
)
{
LIST_ENTRY *Link;
VARIABLE_ENTRY *Entry;
EFI_STATUS Status;

EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->FvbInstance->GetBlockSize);
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->FvbInstance->GetPhysicalAddress);
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->FvbInstance->GetAttributes);
Expand All @@ -238,6 +244,23 @@ VariableClassAddressChangeEvent (
EfiConvertPointer (0x0, (VOID **) &mStorageArea);
EfiConvertPointer (0x0, (VOID **) &mSerializationRuntimeBuffer);
EfiConvertPointer (0x0, (VOID **) &mNvVariableCache);

//
// in the list of locked variables, convert the name pointers first
//
for ( Link = GetFirstNode (&mLockedVariableList)
; !IsNull (&mLockedVariableList, Link)
; Link = GetNextNode (&mLockedVariableList, Link)
) {
Entry = BASE_CR (Link, VARIABLE_ENTRY, Link);
Status = EfiConvertPointer (0x0, (VOID **) &Entry->Name);
ASSERT_EFI_ERROR (Status);
}
//
// second, convert the list itself using UefiRuntimeLib
//
Status = EfiConvertList (0x0, &mLockedVariableList);
ASSERT_EFI_ERROR (Status);
}


Expand Down

0 comments on commit 328e5d8

Please sign in to comment.