[syslinux] [PATCH 1/4] efi: Fix PE header field rva_and_sizes_nr

Celelibi celelibi at gmail.com
Fri Nov 29 05:07:57 PST 2013


2013/11/29, Matt Fleming <matt at console-pimps.org>:
> On Wed, 27 Nov, at 02:38:28PM, Celelibi wrote:
>> The value of the field rva_and_sizes_nr is used by OVMF to check the
>> consistency of the PE file with respect to the field optional_hdr_sz. It
>> now have the right value.
>>
>> Signed-off-by: Celelibi <celelibi at gmail.com>
>> ---
>>  efi/wrapper.c |  6 +++---
>>  efi/wrapper.h | 28 ++++++++++++++++------------
>>  2 files changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/efi/wrapper.c b/efi/wrapper.c
>> index 04c895f..ec77271 100644
>> --- a/efi/wrapper.c
>> +++ b/efi/wrapper.c
>> @@ -102,7 +102,7 @@ static void write_header(FILE *f, __uint32_t entry,
>> size_t data_size,
>>  		e_hdr.image_sz = total_sz;
>>  		e_hdr.headers_sz = 512;
>>  		e_hdr.subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
>> -		e_hdr.rva_and_sizes_nr = 1;
>> +		e_hdr.rva_and_sizes_nr = sizeof(e_hdr.data_directory) /
>> sizeof(__uint64_t);
>
>
> Since the data directories aren't ever used, can't we just delete them
> and set rva_and_sizes_nr to 0?
>
> --
> Matt Fleming, Intel Open Source Technology Center
>

The tool sbsign require the presence of the data directory
certification_table so that it can fill it. And it won't create it if
it doesn't exists, certainly because that would mean increasing the
header size, which can offset the whole content of the file.


More information about the Syslinux mailing list