Ignore .discard sections
PATCH 1/2 Ignore .discard sections
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.
--- create-diff-object.c | 8 ++++++++ 1 file changed, 8 insertions(+)
create-diff-object.c +8 -0
@@ -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 ;
Signature · 7 lines
2.9.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 Remove section alignment requirement
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.
--- create-diff-object.c | 1 - 1 file changed, 1 deletion(-)
create-diff-object.c +0 -1
@@ -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);
Signature · 7 lines
2.9.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
Quoted 6 lines · 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 <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
In reply to Ross LagerwallQuoted 4 lines · 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.
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
Quoted 21 lines
Signed-off-by Ross Lagerwall <[email protected]>--- create-diff-object.c | 1 - 1 file changed, 1 deletion(-)create-diff-object.c +0
-1@@ -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);Signature · 1 line
2.9.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
Quoted 15 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · 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.
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'].
Quoted 7 lines
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
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
Quoted 20 lines · Andrew Cooper
Quoted 19 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · 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.
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
Quoted 7 lines
Quoted 3 lines
['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 <[email protected]>
Ross, you ok committing it in livepatch-build-tools.git? Thanks!
Quoted 5 lines
The build tools choked on this, but the result is legitimate, and did work fine.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH LIVEPATCH-BUILD-TOOLS 2/2] Remove section alignment requirement
Quoted 23 lines · Konrad Rzeszutek Wilk
Quoted 22 lines · Andrew Cooper
Quoted 21 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · 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.
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']
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
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.
Quoted 5 lines
And with Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>
Ross, you ok committing it in livepatch-build-tools.git? Thanks!
Quoted 1 line
Done.
Thanks for reporting and reviewing.
Signature · 6 lines
Ross Lagerwall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 4 lines · 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 <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 4 lines · 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 <[email protected]>
(And CC-ing Sarah)
Quoted 26 lines
--- create-diff-object.c | 8 ++++++++ 1 file changed, 8 insertions(+)create-diff-object.c +8
-0@@ -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 ;Signature · 1 line
2.9.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel