x86/mkelf32: correct off-by-1 in empty PHDR checking loop
PATCH 1/1 x86/mkelf32: correct off-by-1 in empty PHDR checking loop
To read the trailing PHDR, we need to seek to its start position within the file, not its ending one.
Fixes 54279f87ecbc ("x86/build: make linking work again with ld incapable of generating build ID")
Reported-by Roger Pau Monné <[email protected]>
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/boot/mkelf32.c +2 -1
@@ -320,7 +320,8 @@ int main(int argc, char **argv)while ( in64_ehdr.e_phnum > num_phdrs ) { (void )lseek (infd, - in64_ehdr.e_phoff + in64_ehdr.e_phnum *sizeof (in64_phdr), + in64_ehdr.e_phoff + (in64_ehdr.e_phnum -1 ) * +sizeof (in64_phdr),SEEK_SET );do_read (infd, &in64_phdr,sizeof (in64_phdr));endianadjust_phdr64 (&in64_phdr);
Quoted 6 lines · Jan Beulich
To read the trailing PHDR, we need to seek to its start position within the file, not its ending one.
Fixes 54279f87ecbc ("x86/build: make linking work again with ld incapable of generating build ID")Reported-by Roger Pau Monné <[email protected]>Signed-off-by Jan Beulich <[email protected]>
Acked-by Andrew Cooper <[email protected]>