x86: have .note.Xen segment contents before other .note.* ones
PATCH 1/1 x86: have .note.Xen segment contents before other .note.* ones
Today the linker script of Mini-OS specifies to merge all .note* sections into a single section .note:
.note : {
*(.note)
*(.note.*)}
It seems as if ld will use the attributes of the first .note* segment found during the linking process for the final .note segment.
Somewhere between binutils 2.43 and 2.45 something changed resulting in .note.GNU-stack being the first .note* segment found. Unfortunately this segment has unusual attributes: it has PROGBITS instead of NOTE as type, resulting in the Xen ELF parsing to no longer look into it for finding the Xen ELF-notes. This in turn will result in failure while trying to parse the binary, which will let domain creation fail.
In order to avoid this issue, enhance the linker script to merge .note.Xen before other .note.* segments, resulting in the final .note segment to still have the NOTE type.
--- arch/x86/minios-x86.lds.S | 1 + 1 file changed, 1 insertion(+)
arch/x86/minios-x86.lds.S +1 -0
@@ -33,6 +33,7 @@ SECTIONS .note : { *(.note) + *(.note.Xen) *(.note.*) }
Signature · 1 line
2.51.0
Quoted 18 lines · Juergen Gross
Today the linker script of Mini-OS specifies to merge all .note* sections into a single section .note:
.note : { *(.note) *(.note.*)}
It seems as if ld will use the attributes of the first .note* segment found during the linking process for the final .note segment.
Somewhere between binutils 2.43 and 2.45 something changed resulting in .note.GNU-stack being the first .note* segment found. Unfortunately this segment has unusual attributes: it has PROGBITS instead of NOTE as type, resulting in the Xen ELF parsing to no longer look into it for finding the Xen ELF-notes. This in turn will result in failure while trying to parse the binary, which will let domain creation fail.
Quoted 6 lines
In order to avoid this issue, enhance the linker script to merge .note.Xen before other .note.* segments, resulting in the final .note segment to still have the NOTE type.
Fixes 6d1cc81d049f ("x86: switch to use elfnote")Signed-off-by Juergen Gross <[email protected]>
I wonder though ...
arch/x86/minios-x86.lds.S SECTIONS · line 38
Quoted 9 lines
arch/x86/minios-x86.lds.S +1
-0@@ -33,6 +33,7 @@ SECTIONS .note : { *(.note) + *(.note.Xen) *(.note.*) }
... what use .note here is. Can't it be dropped in exchange?
Jan
Quoted 34 lines · Jan Beulich
Quoted 18 lines · Juergen Gross
Today the linker script of Mini-OS specifies to merge all .note* sections into a single section .note:
.note : { *(.note) *(.note.*) }It seems as if ld will use the attributes of the first .note* segment found during the linking process for the final .note segment.
Somewhere between binutils 2.43 and 2.45 something changed resulting in .note.GNU-stack being the first .note* segment found. Unfortunately this segment has unusual attributes: it has PROGBITS instead of NOTE as type, resulting in the Xen ELF parsing to no longer look into it for finding the Xen ELF-notes. This in turn will result in failure while trying to parse the binary, which will let domain creation fail.
Quoted 6 lines
In order to avoid this issue, enhance the linker script to merge .note.Xen before other .note.* segments, resulting in the final .note segment to still have the NOTE type.
Fixes 6d1cc81d049f ("x86: switch to use elfnote")Signed-off-by Juergen Gross <[email protected]>Reviewed-by Jan Beulich <[email protected]>I wonder though ...
Quoted 4 lines
arch/x86/minios-x86.lds.S +0
-0@@ -33,6 +33,7 @@ SECTIONS
Quoted 7 lines
arch/x86/minios-x86.lds.S SECTIONS · line 38
Quoted 5 lines
arch/x86/minios-x86.lds.S +1
-0.note : { *(.note) + *(.note.Xen) *(.note.*) }... what use .note here is. Can't it be dropped in exchange?
Dropping it seems not to have any negative impact.
In theory this should not be in that patch, though, as its presence was questionable even without my patch.
Juergen