xen/x86: prevent addition of .note.gnu.property if livepatch is enabled
PATCH 1/1 xen/x86: prevent addition of .note.gnu.property if livepatch is enabled
GNU assembly that supports such feature will unconditionally add a .note.gnu.property section to object files. The content of that section can change depending on the generated instructions. The current logic in livepatch-build-tools doesn't know how to deal with such section changing as a result of applying a patch and rebuilding.
Since .note.gnu.property is not consumed by the Xen build, suppress its addition when livepatch support is enabled.
--- xen/arch/x86/arch.mk | 6 ++++++ 1 file changed, 6 insertions(+)
xen/arch/x86/arch.mk +6 -0
@@ -26,6 +26,12 @@ $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID) $(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR) $(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD) +# Disable the addition of a .note.gnu.property section to object files when +# livepatch support is enabled. The contents of that section can change +# depending on the instructions used, and livepatch-build-tools doesn't know +# how to deal with such changes. +$(call cc-option-add,CFLAGS-$(CONFIG_LIVEPATCH),CC,-Wa$$(comma)-mx86-used-note=no) + # Check to see whether the assmbler supports the .nop directive. $(call as-option-add,CFLAGS,CC,\ ".L1: .L2: .nops (.L2 - .L1)$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
Signature · 1 line
2.46.0
Quoted 10 lines · Roger Pau Monne
GNU assembly that supports such feature will unconditionally add a .note.gnu.property section to object files. The content of that section can change depending on the generated instructions. The current logic in livepatch-build-tools doesn't know how to deal with such section changing as a result of applying a patch and rebuilding.
Since .note.gnu.property is not consumed by the Xen build, suppress its addition when livepatch support is enabled.
Signed-off-by Roger Pau Monné <[email protected]>
Just one thing though:
Quoted 5 lines
xen/arch/x86/arch.mk +0
-0@@ -26,6 +26,12 @@ $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID) $(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR) $(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD)
xen/arch/x86/arch.mk $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID) · line 37
Quoted 10 lines
xen/arch/x86/arch.mk +6
-0+# Disable the addition of a .note.gnu.property section to object files when +# livepatch support is enabled. The contents of that section can change +# depending on the instructions used, and livepatch-build-tools doesn't know +# how to deal with such changes. +$(call cc-option-add,CFLAGS-$(CONFIG_LIVEPATCH),CC,-Wa$$(comma)-mx86-used-note=no) + # Check to see whether the assmbler supports the .nop directive. $(call as-option-add,CFLAGS,CC,\ ".L1: .L2: .nops (.L2 - .L1)$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
I don't really like this being squashed between two as-option-add invocations. Can this be moved down, e.g. before or after the XEN_IBT chunk? Happy to move while committing ...
Jan
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne
GNU assembly that supports such feature will unconditionally add a .note.gnu.property section to object files. The content of that section can change depending on the generated instructions. The current logic in livepatch-build-tools doesn't know how to deal with such section changing as a result of applying a patch and rebuilding.
Quoted 6 lines
Quoted 4 lines
Since .note.gnu.property is not consumed by the Xen build, suppress its addition when livepatch support is enabled.
Signed-off-by Roger Pau Monné <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Thanks.
Quoted 8 lines
Just one thing though:
Quoted 6 lines
xen/arch/x86/arch.mk +0
-0@@ -26,6 +26,12 @@ $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID) $(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR) $(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD)
Quoted 13 lines
xen/arch/x86/arch.mk $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID) · line 37
Quoted 9 lines
xen/arch/x86/arch.mk +6
-0+# Disable the addition of a .note.gnu.property section to object files when +# livepatch support is enabled. The contents of that section can change +# depending on the instructions used, and livepatch-build-tools doesn't know +# how to deal with such changes. +$(call cc-option-add,CFLAGS-$(CONFIG_LIVEPATCH),CC,-Wa$$(comma)-mx86-used-note=no) + # Check to see whether the assmbler supports the .nop directive. $(call as-option-add,CFLAGS,CC,\ ".L1: .L2: .nops (.L2 - .L1)$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)I don't really like this being squashed between two as-option-add invocations. Can this be moved down, e.g. before or after the
XEN_IBTchunk? Happy to move while committing ...
Feel free to move it.
Roger.