diff mbox

x86: correct PT_NOTE file position

Message ID 57BDD8560200007800108B7C@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Aug. 24, 2016, 3:24 p.m. UTC
Program and section headers disagreed about the file offset at which
the build ID note lives.

Reported-by: Sylvain Munaut <s.munaut@whatever-company.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86: correct PT_NOTE file position

Program and section headers disagreed about the file offset at which
the build ID note lives.

Reported-by: Sylvain Munaut <s.munaut@whatever-company.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -394,7 +394,7 @@ int main(int argc, char **argv)
         note_phdr.p_paddr   = note_base;
         note_phdr.p_filesz  = note_sz;
         note_phdr.p_memsz   = note_sz;
-        note_phdr.p_offset  = offset;
+        note_phdr.p_offset  = RAW_OFFSET + offset;
 
         /* Tack on the .note\0 */
         out_shdr[2].sh_size += sizeof(out_shstrtab_extra);

Comments

Konrad Rzeszutek Wilk Aug. 24, 2016, 8:45 p.m. UTC | #1
On Wed, Aug 24, 2016 at 09:24:38AM -0600, Jan Beulich wrote:
> Program and section headers disagreed about the file offset at which
> the build ID note lives.

Gosh. That was an oversight.
> 
> Reported-by: Sylvain Munaut <s.munaut@whatever-company.com>

'whatever-company'? Really?

Huh. Imagine that.

> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> --- a/xen/arch/x86/boot/mkelf32.c
> +++ b/xen/arch/x86/boot/mkelf32.c
> @@ -394,7 +394,7 @@ int main(int argc, char **argv)
>          note_phdr.p_paddr   = note_base;
>          note_phdr.p_filesz  = note_sz;
>          note_phdr.p_memsz   = note_sz;
> -        note_phdr.p_offset  = offset;
> +        note_phdr.p_offset  = RAW_OFFSET + offset;
>  
>          /* Tack on the .note\0 */
>          out_shdr[2].sh_size += sizeof(out_shstrtab_extra);
> 
> 
>
Andrew Cooper Sept. 2, 2016, 10:48 a.m. UTC | #2
On 24/08/16 21:45, Konrad Rzeszutek Wilk wrote:
> On Wed, Aug 24, 2016 at 09:24:38AM -0600, Jan Beulich wrote:
>> Program and section headers disagreed about the file offset at which
>> the build ID note lives.
> Gosh. That was an oversight.
>> Reported-by: Sylvain Munaut <s.munaut@whatever-company.com>
> 'whatever-company'? Really?
>
> Huh. Imagine that.
>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -394,7 +394,7 @@  int main(int argc, char **argv)
         note_phdr.p_paddr   = note_base;
         note_phdr.p_filesz  = note_sz;
         note_phdr.p_memsz   = note_sz;
-        note_phdr.p_offset  = offset;
+        note_phdr.p_offset  = RAW_OFFSET + offset;
 
         /* Tack on the .note\0 */
         out_shdr[2].sh_size += sizeof(out_shstrtab_extra);