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

[202405] ImageValidation.py: Don't parse entire image #1127

Merged

Conversation

Javagedes
Copy link
Contributor

Description

This commit modifies the PE parsing functionality to only parse the headers of the image, rather than the entire image. This change is made to improve performance and also the probability of failing to parse the entire image. This comes after this commit (erocarrera/pefile#365) in pefile resulted in efi image parsing failures, breaking the build.

This commit also wraps the parsing of the image in a try-except block to catch any exceptions that may be raised during parsing, to cleanly exit.

See: microsoft/mu_tiano_platforms#1025 and erocarrera/pefile#421

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

How This Was Tested

Validated pipelines build on mu_tiano_platforms

Integration Instructions

N/A

This commit modifies the PE parsing functionality to only parse the
headers of the image, rather than the entire image. This change is made
to improve performance and also the probability of failing to parse the
entire image. This comes after this commit (erocarrera/pefile#365)
in pefile resulted in efi image parsing failures, breaking the build.

This commit also wraps the parsing of the image in a try-except block to
catch any exceptions that may be raised during parsing, to cleanly exit.
@Javagedes Javagedes requested review from makubacki, os-d and apop5 August 29, 2024 19:32
@github-actions github-actions bot added the impact:non-functional Does not have a functional impact label Aug 29, 2024
Copy link
Contributor

@os-d os-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straight to edk2? I'm good to take this here too, so we aren't broken, of course. Or has this plugin not gone upstream?

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 1.57%. Comparing base (0a17aa9) to head (a97b03a).

Additional details and impacted files
@@                Coverage Diff                 @@
##           release/202405    #1127      +/-   ##
==================================================
- Coverage            1.59%    1.57%   -0.02%     
==================================================
  Files                1448     1448              
  Lines              362487   361897     -590     
  Branches             5632     3693    -1939     
==================================================
- Hits                 5776     5713      -63     
+ Misses             356604   356094     -510     
+ Partials              107       90      -17     
Flag Coverage Δ
MdeModulePkg 0.68% <ø> (ø)
MdePkg 5.42% <ø> (ø)
NetworkPkg 0.50% <ø> (-0.05%) ⬇️
PolicyServicePkg 28.75% <ø> (-1.66%) ⬇️
UefiCpuPkg 4.73% <ø> (ø)

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.

@Javagedes
Copy link
Contributor Author

Straight to edk2? I'm good to take this here too, so we aren't broken, of course. Or has this plugin not gone upstream?

Not upstreamed yet

@Javagedes Javagedes merged commit f2a5ec9 into microsoft:release/202405 Aug 29, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:non-functional Does not have a functional impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants