Skip to content

[CHERRY-PICK] Bug fix standalonemm core and PiSmmCore - #1920

Open
Khalid Ali (khaliid2040) wants to merge 3 commits into
microsoft:release/202511from
khaliid2040:bug-fix-standalonemmpkg
Open

Khalid Ali (khaliid2040) wants to merge 3 commits into
microsoft:release/202511from
khaliid2040:bug-fix-standalonemmpkg

Conversation

@khaliid2040

@khaliid2040 Khalid Ali (khaliid2040) commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Description

This patches fix bugs in StandaloneMm core and PiSmmCore:

  • Fix a logical flaw in SmiManage/MmiManage functions SMM cores where mSmiManageCallingDepth variable is incremented too early this later prevents SMI handlers from being removed.
  • Fix, CreateMmFoundationHobList() get called twice in CreateMmHobList() one to calculate required size and one to get the actual hobs. Between those calls the platform hobs copied into (HobList + PhitHobSize) however the second call got the beginning of the Hob in the place it was expecting the platform hob (the third parameter of the call).

Each patch is described in detail in the respective commit.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

All these are merged in EDK2 master and have been tested on OVMF.

Integration Instructions

N/A

… hob

The second call to CreateMmFoundationHobList () expects the address of
the beginning of the platform hob list in the third parameter. However it
has being given the beginning of the HobList which is PHIT. This causes
later wrong address calculations which in turns puts MM core in infinite
loop, because the IPL passed hob without EFI_HOB_TYPE_END_OF_HOB_LIST.

Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
(cherry picked from commit 962c1f2)
…check

Fixes: #11764

Currently, mMmiManageCallingDepth is incremented always whether MMI
handler is present or not. However get decremented only when MMI handler
is found. This causes mMmiManageCallingDepth to grow infinitely as long
as MMI handler isn't present.

Increment mMmiManageCallingDepth only when MMI handler presence is
confirmed.

Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
(cherry picked from commit 05cec0b)
…sence check

Fixes: #11764

Currently, mSmiManageCallingDepth is incremented always whether SMI
handler is present or not. However get decremented only when SMI handler
is found. This causes mSmiManageCallingDepth to grow infinitely as long
as SMI handler isn't present.

Increment mSmiManageCallingDepth only when SMI handler presence is
confirmed.

Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
(cherry picked from commit bd8667a)
@mu-automation

mu-automation Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

❌ QEMU Validation Failed

Source Dependencies

Repository Commit
mu_basecore 54db3a0
mu_tiano_platforms d966ff0

Results

Platform Target Build Boot Overall Boot Time Build Logs Boot Logs
Q35 DEBUG ❌ failure ⏩ skipped N/A Build Logs N/A
ArmVirt DEBUG ❌ failure ⏩ skipped N/A Build Logs N/A

Workflow run: https://github.com/microsoft/mu_basecore/actions/runs/35104428873

This comment was automatically generated by the Mu QEMU PR Validation workflow.

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/202511@3d43ac3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
MdeModulePkg/Core/PiSmmCore/Smi.c 0.00% 1 Missing ⚠️
...kg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/202511    #1920   +/-   ##
=================================================
  Coverage                  ?    1.63%           
=================================================
  Files                     ?      667           
  Lines                     ?   238547           
  Branches                  ?      550           
=================================================
  Hits                      ?     3893           
  Misses                    ?   234630           
  Partials                  ?       24           
Flag Coverage Δ
MdeModulePkg 1.65% <0.00%> (?)
StandaloneMmPkg 0.50% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants