Repository navigation
Harden SBAT handling against truncation and impossible to revoke levels - #829
Open
julian-klode wants to merge 2 commits into
Open
julian-klode wants to merge 2 commits into
julian-klode wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #829 +/- ##
==========================================
- Coverage 59.48% 59.42% -0.07%
==========================================
Files 24 24
Lines 4226 4283 +57
Branches 655 663 +8
==========================================
+ Hits 2514 2545 +31
+ Misses 1471 1470 -1
- Partials 241 268 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
julian-klode
force-pushed
the
sbat-overflow
branch
from
September 3, 2026 18:35
7085613 to
a5260bb
Compare
Collaborator
Author
|
Not sure the "invalid" sbat variable handling makes sense, should we detect that earlier and re-write the sbat variable if it is corrupted? |
Collaborator
Author
|
Cleaning up the missing partial line aand some weird typing |
verify_single_entry() stored atoi() results in UINT16, truncating 65537 to 1 and wrapping -1 to 65535. Parse with a shim-local helper instead that rejects negatives, huge values, and trailing garbage; strtol() is unimplemented in EFI and atoi() differs between EFI (AsciiStrDecimalToUintn()) and test (libc) builds. Failed parses are still treated as zero. Assisted-By: LLM Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
An image using the maximum 16-bit generation could never be revoked, as revocation requires a higher policy generation. Reject generations above SBAT_GENERATION_MAX (UINT16_MAX - 1) so one generation of headroom always remains. The policy may still use UINT16_MAX itself to disallow a component entirely. Assisted-By: LLM Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
julian-klode
force-pushed
the
sbat-overflow
branch
from
September 3, 2026 19:27
a5260bb to
36dcd88
Compare
Collaborator
Author
|
All lines are fully covered now. If we want we could also allow 32-bit integers, but this keeps the 16-bit limit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 1 removes the truncation to UINTN to UINT16, and uses a custom parser to avoid the discrepancy between atoi() in the test environment and atoi() in EFI.
Commit 2 hard rejects images with SBAT level UINT16_MAX or greater such that UINT16_MAX can be used to revoke the last binary for that component.