xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections
@ 2017-06-09 16:03 Ross Lagerwall
  2017-06-09 16:03 ` [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement Ross Lagerwall
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ross Lagerwall @ 2017-06-09 16:03 UTC (permalink / raw)
  To: xen-devel; +Cc: Ross Lagerwall

Ignore differences in discard sections. They are not included in the final xen
binary so there is no need to include them in the live patch.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 create-diff-object.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/create-diff-object.c b/create-diff-object.c
index 217e58f..ba19daf 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -888,6 +888,14 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf)
 	struct rela *rela;
 	char *name;
 
+	/* Always ignore .discard sections */
+	sec = find_section_by_name(&kelf->sections, ".discard");
+	if (sec) {
+		sec->ignore = 1;
+		if (sec->twin)
+			sec->twin->ignore = 1;
+	}
+
 	sec = find_section_by_name(&kelf->sections, ".livepatch.ignore.sections");
 	if (!sec)
 		return;
-- 
2.9.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
  2017-06-09 16:03 [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections Ross Lagerwall
@ 2017-06-09 16:03 ` Ross Lagerwall
  2017-06-09 16:25   ` Andrew Cooper
  2017-06-09 16:38   ` Konrad Rzeszutek Wilk
  2017-06-09 16:25 ` [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections Andrew Cooper
  2017-06-09 16:35 ` Konrad Rzeszutek Wilk
  2 siblings, 2 replies; 9+ messages in thread
From: Ross Lagerwall @ 2017-06-09 16:03 UTC (permalink / raw)
  To: xen-devel; +Cc: Ross Lagerwall

Remove the requirement that section twins have the same alignment. The
section alignment of the patched section is respected by the loader in
Xen so it shouldn't matter if the original section alignment was
different.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 create-diff-object.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/create-diff-object.c b/create-diff-object.c
index ba19daf..82f777e 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -754,7 +754,6 @@ static void kpatch_compare_correlated_section(struct section *sec)
 	if (sec1->sh.sh_type != sec2->sh.sh_type ||
 	    sec1->sh.sh_flags != sec2->sh.sh_flags ||
 	    sec1->sh.sh_addr != sec2->sh.sh_addr ||
-	    sec1->sh.sh_addralign != sec2->sh.sh_addralign ||
 	    sec1->sh.sh_entsize != sec2->sh.sh_entsize)
 		DIFF_FATAL("%s section header details differ", sec1->name);
 
-- 
2.9.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections
  2017-06-09 16:03 [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections Ross Lagerwall
  2017-06-09 16:03 ` [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement Ross Lagerwall
@ 2017-06-09 16:25 ` Andrew Cooper
  2017-06-09 16:35 ` Konrad Rzeszutek Wilk
  2 siblings, 0 replies; 9+ messages in thread
From: Andrew Cooper @ 2017-06-09 16:25 UTC (permalink / raw)
  To: Ross Lagerwall, xen-devel

On 09/06/17 17:03, Ross Lagerwall wrote:
> Ignore differences in discard sections. They are not included in the final xen
> binary so there is no need to include them in the live patch.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
  2017-06-09 16:03 ` [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement Ross Lagerwall
@ 2017-06-09 16:25   ` Andrew Cooper
  2017-06-09 16:38   ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 9+ messages in thread
From: Andrew Cooper @ 2017-06-09 16:25 UTC (permalink / raw)
  To: Ross Lagerwall, xen-devel

On 09/06/17 17:03, Ross Lagerwall wrote:
> Remove the requirement that section twins have the same alignment. The
> section alignment of the patched section is respected by the loader in
> Xen so it shouldn't matter if the original section alignment was
> different.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections
  2017-06-09 16:03 [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections Ross Lagerwall
  2017-06-09 16:03 ` [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement Ross Lagerwall
  2017-06-09 16:25 ` [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections Andrew Cooper
@ 2017-06-09 16:35 ` Konrad Rzeszutek Wilk
  2 siblings, 0 replies; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-06-09 16:35 UTC (permalink / raw)
  To: Ross Lagerwall; +Cc: Sarah Newman, xen-devel

On Fri, Jun 09, 2017 at 05:03:35PM +0100, Ross Lagerwall wrote:
> Ignore differences in discard sections. They are not included in the final xen
> binary so there is no need to include them in the live patch.
> 
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

(And CC-ing Sarah)
> ---
>  create-diff-object.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/create-diff-object.c b/create-diff-object.c
> index 217e58f..ba19daf 100644
> --- a/create-diff-object.c
> +++ b/create-diff-object.c
> @@ -888,6 +888,14 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf)
>  	struct rela *rela;
>  	char *name;
>  
> +	/* Always ignore .discard sections */
> +	sec = find_section_by_name(&kelf->sections, ".discard");
> +	if (sec) {
> +		sec->ignore = 1;
> +		if (sec->twin)
> +			sec->twin->ignore = 1;
> +	}
> +
>  	sec = find_section_by_name(&kelf->sections, ".livepatch.ignore.sections");
>  	if (!sec)
>  		return;
> -- 
> 2.9.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
  2017-06-09 16:03 ` [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement Ross Lagerwall
  2017-06-09 16:25   ` Andrew Cooper
@ 2017-06-09 16:38   ` Konrad Rzeszutek Wilk
  2017-06-09 17:00     ` Andrew Cooper
  1 sibling, 1 reply; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-06-09 16:38 UTC (permalink / raw)
  To: Ross Lagerwall, Sarah Newman; +Cc: xen-devel

On Fri, Jun 09, 2017 at 05:03:36PM +0100, Ross Lagerwall wrote:
> Remove the requirement that section twins have the same alignment. The
> section alignment of the patched section is respected by the loader in
> Xen so it shouldn't matter if the original section alignment was
> different.

Why would we have different section aligment for the same twins?

I understand the change here - if for example the original code
had:

 .rodata.str.1

[I think I got the section name right - that should be a string
generated with 1 byte alignment, say 'a'].

But the new patch has a new one:

 .rodata.str.2

['a' -> 'ab']

Is that what we are fixing here?

Also CC-ing Sarah
> 
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
>  create-diff-object.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/create-diff-object.c b/create-diff-object.c
> index ba19daf..82f777e 100644
> --- a/create-diff-object.c
> +++ b/create-diff-object.c
> @@ -754,7 +754,6 @@ static void kpatch_compare_correlated_section(struct section *sec)
>  	if (sec1->sh.sh_type != sec2->sh.sh_type ||
>  	    sec1->sh.sh_flags != sec2->sh.sh_flags ||
>  	    sec1->sh.sh_addr != sec2->sh.sh_addr ||
> -	    sec1->sh.sh_addralign != sec2->sh.sh_addralign ||
>  	    sec1->sh.sh_entsize != sec2->sh.sh_entsize)
>  		DIFF_FATAL("%s section header details differ", sec1->name);
>  
> -- 
> 2.9.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
  2017-06-09 16:38   ` Konrad Rzeszutek Wilk
@ 2017-06-09 17:00     ` Andrew Cooper
  2017-06-09 17:08       ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Cooper @ 2017-06-09 17:00 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Ross Lagerwall, Sarah Newman; +Cc: xen-devel

On 09/06/17 17:38, Konrad Rzeszutek Wilk wrote:
> On Fri, Jun 09, 2017 at 05:03:36PM +0100, Ross Lagerwall wrote:
>> Remove the requirement that section twins have the same alignment. The
>> section alignment of the patched section is respected by the loader in
>> Xen so it shouldn't matter if the original section alignment was
>> different.
> Why would we have different section aligment for the same twins?
>
> I understand the change here - if for example the original code
> had:
>
>  .rodata.str.1
>
> [I think I got the section name right - that should be a string
> generated with 1 byte alignment, say 'a'].
>
> But the new patch has a new one:
>
>  .rodata.str.2
>
> ['a' -> 'ab']
>
> Is that what we are fixing here?

Functions also have alignment.  For reasons best known to the compiler,
the fix for XSA-213 caused the alignment of arch_do_multicall_call() to
change from 1 to 16.

The build tools choked on this, but the result is legitimate, and did
work fine.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
  2017-06-09 17:00     ` Andrew Cooper
@ 2017-06-09 17:08       ` Konrad Rzeszutek Wilk
  2017-06-12  7:30         ` Ross Lagerwall
  0 siblings, 1 reply; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-06-09 17:08 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Ross Lagerwall, xen-devel, Sarah Newman

On Fri, Jun 09, 2017 at 06:00:35PM +0100, Andrew Cooper wrote:
> On 09/06/17 17:38, Konrad Rzeszutek Wilk wrote:
> > On Fri, Jun 09, 2017 at 05:03:36PM +0100, Ross Lagerwall wrote:
> >> Remove the requirement that section twins have the same alignment. The
> >> section alignment of the patched section is respected by the loader in
> >> Xen so it shouldn't matter if the original section alignment was
> >> different.
> > Why would we have different section aligment for the same twins?
> >
> > I understand the change here - if for example the original code
> > had:
> >
> >  .rodata.str.1
> >
> > [I think I got the section name right - that should be a string
> > generated with 1 byte alignment, say 'a'].
> >
> > But the new patch has a new one:
> >
> >  .rodata.str.2
> >
> > ['a' -> 'ab']
> >
> > Is that what we are fixing here?
> 
> Functions also have alignment.  For reasons best known to the compiler,
> the fix for XSA-213 caused the alignment of arch_do_multicall_call() to
> change from 1 to 16.

OK, could this be please be included in the commit description?

And with Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Ross,  you ok committing it in livepatch-build-tools.git? Thanks!
> 
> The build tools choked on this, but the result is legitimate, and did
> work fine.
> 
> ~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
  2017-06-09 17:08       ` Konrad Rzeszutek Wilk
@ 2017-06-12  7:30         ` Ross Lagerwall
  0 siblings, 0 replies; 9+ messages in thread
From: Ross Lagerwall @ 2017-06-12  7:30 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Sarah Newman; +Cc: Andrew Cooper, xen-devel

On 06/09/2017 06:08 PM, Konrad Rzeszutek Wilk wrote:
> On Fri, Jun 09, 2017 at 06:00:35PM +0100, Andrew Cooper wrote:
>> On 09/06/17 17:38, Konrad Rzeszutek Wilk wrote:
>>> On Fri, Jun 09, 2017 at 05:03:36PM +0100, Ross Lagerwall wrote:
>>>> Remove the requirement that section twins have the same alignment. The
>>>> section alignment of the patched section is respected by the loader in
>>>> Xen so it shouldn't matter if the original section alignment was
>>>> different.
>>> Why would we have different section aligment for the same twins?
>>>
>>> I understand the change here - if for example the original code
>>> had:
>>>
>>>   .rodata.str.1
>>>
>>> [I think I got the section name right - that should be a string
>>> generated with 1 byte alignment, say 'a'].
>>>
>>> But the new patch has a new one:
>>>
>>>   .rodata.str.2
>>>
>>> ['a' -> 'ab']
>>>
>>> Is that what we are fixing here?
>>
>> Functions also have alignment.  For reasons best known to the compiler,
>> the fix for XSA-213 caused the alignment of arch_do_multicall_call() to
>> change from 1 to 16.
> 
> OK, could this be please be included in the commit description?

Done.

> 
> And with Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Ross,  you ok committing it in livepatch-build-tools.git? Thanks!
>>

Done.

Thanks for reporting and reviewing.

-- 
Ross Lagerwall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-06-12  7:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 16:03 [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections Ross Lagerwall
2017-06-09 16:03 ` [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement Ross Lagerwall
2017-06-09 16:25   ` Andrew Cooper
2017-06-09 16:38   ` Konrad Rzeszutek Wilk
2017-06-09 17:00     ` Andrew Cooper
2017-06-09 17:08       ` Konrad Rzeszutek Wilk
2017-06-12  7:30         ` Ross Lagerwall
2017-06-09 16:25 ` [PATCH LIVEPATCH-BUILD-TOOLS 1/2] Ignore .discard sections Andrew Cooper
2017-06-09 16:35 ` Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).