All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/x86: prevent addition of .note.gnu.property if livepatch is enabled
@ 2024-11-07 14:59 Roger Pau Monne
  2024-11-07 15:14 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Pau Monne @ 2024-11-07 14:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monne, Jan Beulich, Andrew Cooper

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é <roger.pau@citrix.com>
---
 xen/arch/x86/arch.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 1460ecf30b9a..1ded012d9f5b 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -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)
-- 
2.46.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xen/x86: prevent addition of .note.gnu.property if livepatch is enabled
  2024-11-07 14:59 [PATCH] xen/x86: prevent addition of .note.gnu.property if livepatch is enabled Roger Pau Monne
@ 2024-11-07 15:14 ` Jan Beulich
  2024-11-07 15:56   ` Roger Pau Monné
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2024-11-07 15:14 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: Andrew Cooper, xen-devel

On 07.11.2024 15:59, Roger Pau Monne wrote:
> 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é <roger.pau@citrix.com>

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

Just one thing though:

> --- a/xen/arch/x86/arch.mk
> +++ b/xen/arch/x86/arch.mk
> @@ -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)

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xen/x86: prevent addition of .note.gnu.property if livepatch is enabled
  2024-11-07 15:14 ` Jan Beulich
@ 2024-11-07 15:56   ` Roger Pau Monné
  0 siblings, 0 replies; 3+ messages in thread
From: Roger Pau Monné @ 2024-11-07 15:56 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, xen-devel

On Thu, Nov 07, 2024 at 04:14:20PM +0100, Jan Beulich wrote:
> On 07.11.2024 15:59, Roger Pau Monne wrote:
> > 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é <roger.pau@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks.

> Just one thing though:
> 
> > --- a/xen/arch/x86/arch.mk
> > +++ b/xen/arch/x86/arch.mk
> > @@ -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)
> 
> 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 ...

Feel free to move it.

Roger.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-07 15:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 14:59 [PATCH] xen/x86: prevent addition of .note.gnu.property if livepatch is enabled Roger Pau Monne
2024-11-07 15:14 ` Jan Beulich
2024-11-07 15:56   ` Roger Pau Monné

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.