Skip to content

Commit

Permalink
Update overrides for recent Mu Basecore CodeQL fixes (microsoft#154)
Browse files Browse the repository at this point in the history
## Description

Updates overrides for:

- MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf

Relevant changes from microsoft/mu_basecore#490

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

CI build and QemuQ35Pkg unit boot.

## Integration Instructions

When updating Mu Basecore to include the changes linked in the
description, update the submodule with `MmSupervisorPkg` to
include these changes.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
(cherry picked from commit 626a63c)
  • Loading branch information
makubacki authored and kuqin12 committed Jul 21, 2023
1 parent 1dc2e5e commit 5dadf78
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MmSupervisorPkg/Core/MmSupervisorCore.inf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
##

#Override : 00000002 | StandaloneMmPkg/Core/StandaloneMmCore.inf | afc905240e20c3c2205b0699c28e78d8 | 2023-02-14T23-02-36 | 45b2886c1f0d56d32b0b048494e4e9c2b4f88671
#Override : 00000002 | UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | d8c8a510e27fa589b66a6a6d6581834e | 2023-05-20T03-12-35 | dc6c1f99c459dc4107bf51d307d3484f101a95fa
#Override : 00000002 | UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | dceb5d7aaa3a51aefdbbd0ba9ede8a47 | 2023-07-17T14-51-51 | 3f022dad7ac0035cfe3ed49a12403a7314445383
#Override : 00000002 | MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf | c6af8bbe5339bdf045cc9e36064b0ea2 | 2023-05-19T23-00-30 | dc6c1f99c459dc4107bf51d307d3484f101a95fa

[Defines]
Expand Down
2 changes: 1 addition & 1 deletion MmSupervisorPkg/Drivers/MmPeiLaunchers/MmDxeSupport.inf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
PI_SPECIFICATION_VERSION = 0x0001000A
ENTRY_POINT = MmDxeSupportEntry

#Override : 00000002 | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 03b789c79bf1608a7458425a36f6d98b | 2023-05-19T23-02-41 | dc6c1f99c459dc4107bf51d307d3484f101a95fa
#Override : 00000002 | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 7d808870b203b5ec3c408ec3e9a371e0 | 2023-07-17T14-48-31 | 3f022dad7ac0035cfe3ed49a12403a7314445383

#
# The following information is for reference only and not required by the build tools.
Expand Down
2 changes: 1 addition & 1 deletion MmSupervisorPkg/Drivers/MmPeiLaunchers/MmIplPei.inf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
PI_SPECIFICATION_VERSION = 0x0001000A
ENTRY_POINT = MmIplPeiEntry

#Override : 00000002 | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 03b789c79bf1608a7458425a36f6d98b | 2023-05-19T23-02-41 | dc6c1f99c459dc4107bf51d307d3484f101a95fa
#Override : 00000002 | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 7d808870b203b5ec3c408ec3e9a371e0 | 2023-07-17T14-48-31 | 3f022dad7ac0035cfe3ed49a12403a7314445383
#Override : 00000002 | MdeModulePkg/Universal/CapsulePei/CapsulePei.inf | 8488ee3b214d278eb0623bf0c29f72d8 | 2023-02-22T20-13-39 | df29658d7524a836d7ef8ab4653bc0272d2c3fc0

#
Expand Down
31 changes: 30 additions & 1 deletion MmSupervisorPkg/Drivers/StandaloneMmIpl/PiSmmIpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,11 @@ GetFullSmramRanges (
EFI_SMM_RESERVED_SMRAM_REGION *SmramReservedRanges = NULL;
UINTN MaxCount;
BOOLEAN Rescan;
// MU_CHANGE [BEGIN]: MM_SUPV: CodeQL change
BOOLEAN Failed;

Failed = FALSE;
// MU_CHANGE [END]: MM_SUPV: CodeQL change

//
// Get SMM Configuration Protocol if it is present.
Expand Down Expand Up @@ -1630,11 +1635,15 @@ GetFullSmramRanges (
*FullMmramRangeCount = MmramRangeCount + AdditionMmramRangeCount;
Size = (*FullMmramRangeCount) * sizeof (EFI_SMRAM_DESCRIPTOR);
FullSmramRanges = (EFI_SMRAM_DESCRIPTOR *)AllocateZeroPool (Size);
// MU_CHANGE [BEGIN]: MM_SUPV: CodeQL change
if (FullSmramRanges == NULL) {
ASSERT (FullSmramRanges != NULL);
return NULL;
Failed = TRUE;
goto Exit;
}

// MU_CHANGE [END]: MM_SUPV: CodeQL change

Status = mSmmAccess->GetCapabilities (mSmmAccess, &Size, FullSmramRanges);
ASSERT_EFI_ERROR (Status);

Expand Down Expand Up @@ -1680,30 +1689,42 @@ GetFullSmramRanges (

Size = MaxCount * sizeof (EFI_SMM_RESERVED_SMRAM_REGION);
SmramReservedRanges = (EFI_SMM_RESERVED_SMRAM_REGION *)AllocatePool (Size);
// MU_CHANGE [BEGIN]: MM_SUPV: CodeQL change
if (SmramReservedRanges == NULL) {
ASSERT (SmramReservedRanges != NULL);
Failed = TRUE;
goto Exit;
}

// MU_CHANGE [END]: MM_SUPV: CodeQL change

for (Index = 0; Index < SmramReservedCount; Index++) {
CopyMem (&SmramReservedRanges[Index], &SmmConfiguration->SmramReservedRegions[Index], sizeof (EFI_SMM_RESERVED_SMRAM_REGION));
}

Size = MaxCount * sizeof (EFI_SMRAM_DESCRIPTOR);
TempSmramRanges = (EFI_SMRAM_DESCRIPTOR *)AllocatePool (Size);
// MU_CHANGE [BEGIN]: MM_SUPV: CodeQL change
if (TempSmramRanges == NULL) {
ASSERT (TempSmramRanges != NULL);
Failed = TRUE;
goto Exit;
}

// MU_CHANGE [END]: MM_SUPV: CodeQL change

TempMmramRangeCount = 0;

SmramRanges = (EFI_SMRAM_DESCRIPTOR *)AllocatePool (Size);
// MU_CHANGE [BEGIN]: MM_SUPV: CodeQL change
if (SmramRanges == NULL) {
ASSERT (SmramRanges != NULL);
Failed = TRUE;
goto Exit;
}

// MU_CHANGE [END]: MM_SUPV: CodeQL change

Status = mSmmAccess->GetCapabilities (mSmmAccess, &Size, SmramRanges);
ASSERT_EFI_ERROR (Status);

Expand Down Expand Up @@ -1784,6 +1805,8 @@ GetFullSmramRanges (
ASSERT (*FullMmramRangeCount == TempMmramRangeCount);
*FullMmramRangeCount += AdditionMmramRangeCount;

// MU_CHANGE [BEGIN]: MM_SUPV: CodeQL change

Exit:
if (SmramRanges != NULL) {
FreePool (SmramRanges);
Expand All @@ -1797,6 +1820,12 @@ GetFullSmramRanges (
FreePool (TempSmramRanges);
}

if (Failed) {
return NULL;
}

// MU_CHANGE [END]: MM_SUPV: CodeQL change

return FullSmramRanges;
}

Expand Down
2 changes: 1 addition & 1 deletion MmSupervisorPkg/Drivers/StandaloneMmIpl/PiSmmIpl.inf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
PI_SPECIFICATION_VERSION = 0x0001000A
ENTRY_POINT = SmmIplEntry

#Override : 00000002 | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 03b789c79bf1608a7458425a36f6d98b | 2023-05-19T23-02-41 | dc6c1f99c459dc4107bf51d307d3484f101a95fa
#Override : 00000002 | MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 7d808870b203b5ec3c408ec3e9a371e0 | 2023-07-17T14-48-31 | 3f022dad7ac0035cfe3ed49a12403a7314445383

#
# The following information is for reference only and not required by the build tools.
Expand Down

0 comments on commit 5dadf78

Please sign in to comment.