microsoft / mu_basecore

Project Mu BaseCore
https://microsoft.github.io/mu/
Other
242 stars 124 forks source link

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

Closed Javagedes closed 1 month ago

Javagedes commented 1 month ago

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 (https://github.com/erocarrera/pefile/pull/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: https://github.com/microsoft/mu_tiano_platforms/pull/1025 and https://github.com/erocarrera/pefile/issues/421

How This Was Tested

Validated pipelines build on mu_tiano_platforms

Integration Instructions

N/A

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1127/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | Coverage Δ | | |---|---|---| | [MdeModulePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1127/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `0.68% <ø> (ø)` | | | [MdePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1127/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `5.42% <ø> (ø)` | | | [NetworkPkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1127/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `0.50% <ø> (-0.05%)` | :arrow_down: | | [PolicyServicePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1127/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `28.75% <ø> (-1.66%)` | :arrow_down: | | [UefiCpuPkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1127/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `4.73% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Javagedes commented 1 month ago

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