Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
tboot.18210
tboot-support-sinit-padding.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File tboot-support-sinit-padding.patch of Package tboot.18210
changeset: 551:2f03b57ffdba user: Lukasz Hawrylko <lukasz.hawrylko@intel.com> date: Mon Nov 25 15:46:09 2019 +0100 summary: SINIT ACM can have padding, handle that when checking size diff -r fe2dddd742dc -r 2f03b57ffdba tboot/include/txt/acmod.h --- a/tboot/include/txt/acmod.h Mon Oct 21 12:09:04 2019 +0200 +++ b/tboot/include/txt/acmod.h Mon Nov 25 15:46:09 2019 +0100 @@ -88,6 +88,10 @@ /* value of module_vendor field */ #define ACM_VENDOR_INTEL 0x8086 +/* ranges of padding present in TXTCR_SINIT_SIZE reg */ +#define ACM_SIZE_MIN_PADDING 0x10000 +#define ACM_SIZE_MAX_PADDING 0x40000 + typedef union { uint32_t _raw; struct { diff -r fe2dddd742dc -r 2f03b57ffdba tboot/txt/acmod.c --- a/tboot/txt/acmod.c Mon Oct 21 12:09:04 2019 +0200 +++ b/tboot/txt/acmod.c Mon Nov 25 15:46:09 2019 +0100 @@ -438,7 +438,31 @@ return info_table->capabilities; } -static bool is_acmod(const void *acmod_base, uint32_t acmod_size, uint8_t *type, bool quiet) +static bool are_sizes_equal_pad_adjusted(uint32_t acmod_size, acm_hdr_t *acm_hdr) +{ + /* Sizes are equal, so no padding */ + if ( acmod_size == (acm_hdr->size * 4) ) { + return true; + } + + /* Padding can't be negative */ + if ( acmod_size < (acm_hdr->size * 4) ) { + return false; + } + + /* Check if padding is in allowed range */ + if ( (acmod_size - (acm_hdr->size * 4) >= ACM_SIZE_MIN_PADDING) && + (acmod_size - (acm_hdr->size * 4) <= ACM_SIZE_MAX_PADDING) ) { + printk(TBOOT_WARN"\t acmod_size=%x, != acm_hdr->size*4=%x" + ", padding present (assuming 0x%x padding)\n", + acmod_size, acm_hdr->size * 4, acmod_size - (acm_hdr->size * 4)); + return true; + } + + return false; +} + +static bool is_acmod(const void *acmod_base, uint32_t acmod_size, uint8_t *type, bool quiet) { acm_hdr_t *acm_hdr = (acm_hdr_t *)acmod_base; @@ -459,9 +483,9 @@ } /* then check size equivalency */ - if ( acmod_size != acm_hdr->size * 4 ) { + if ( !are_sizes_equal_pad_adjusted(acmod_size, acm_hdr) ) { if ( !quiet ) - printk(TBOOT_ERR"\t ACM size is too small: acmod_size=%x," + printk(TBOOT_ERR"\t ACM size mismatch: acmod_size=%x," " acm_hdr->size*4=%x\n", acmod_size, acm_hdr->size*4); return false; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor