Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception handling errors for supervisor #261

Merged
merged 6 commits into from
Apr 2, 2024

Conversation

kuqin12
Copy link
Contributor

@kuqin12 kuqin12 commented Mar 30, 2024

Preface

Please ensure you have read the contribution docs prior
to submitting the pull request. In particular,
pull request guidelines.

Description

The current exception handling routine has 2 issues:

  1. When it comes to page fault, the miscellaneous exception handler will print the exception context and then hand off to the specific page fault handler, which will make the log appear as the system double fault.
  2. When the page fault exception occurs, the existing setup will switch the system to use a separate stack, which is hardcoded to be 4KB from the top of supervisor stack. This size is insufficient after switching to PageTableLib based page table attribute manipulations.

This change should fix both issues.

For each item, place an "x" in between [ and ] if true. Example: [x].
(you can also check items in the GitHub UI)

  • 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

This change is tested on QEMU Q35 and verified bootable into UEFI shell.

Integration Instructions

N/A

@kuqin12 kuqin12 changed the title Exception hndlr Fix exception handling errors for supervisor Mar 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 0.47%. Comparing base (1bd76ee) to head (0622859).

Files Patch % Lines
MmSupervisorPkg/Core/Misc/SmmFuncsArch.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #261      +/-   ##
========================================
- Coverage   0.47%   0.47%   -0.01%     
========================================
  Files        144     144              
  Lines      22282   22287       +5     
  Branches      60      60              
========================================
  Hits         105     105              
- Misses     22172   22177       +5     
  Partials       5       5              
Flag Coverage Δ
MmSupervisorPkg 0.47% <0.00%> (-0.01%) ⬇️

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

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

@kuqin12 kuqin12 merged commit 222506e into microsoft:main Apr 2, 2024
9 checks passed
@kuqin12 kuqin12 deleted the exception_hndlr branch April 2, 2024 00:06
kenlautner pushed a commit to kenlautner/mu_feature_mm_supv that referenced this pull request Apr 11, 2024
# Preface

Please ensure you have read the [contribution
docs](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md) prior
to submitting the pull request. In particular,
[pull request
guidelines](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md#pull-request-best-practices).

## Description

The current exception handling routine has 2 issues:

1. When it comes to page fault, the miscellaneous exception handler will
print the exception context and then hand off to the specific page fault
handler, which will make the log appear as the system double fault.
2. When the page fault exception occurs, the existing setup will switch
the system to use a separate stack, which is hardcoded to be 4KB from
the top of supervisor stack. This size is insufficient after switching
to PageTableLib based page table attribute manipulations.

This change should fix both issues.

For each item, place an "x" in between `[` and `]` if true. Example:
`[x]`.
_(you can also check items in the GitHub UI)_

- [x] 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

This change is tested on QEMU Q35 and verified bootable into UEFI shell.

## Integration Instructions

N/A
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