Arm32: avoid .rodata to be marked as executable
PATCH 1/1 Arm32: avoid .rodata to be marked as executable
This confuses disassemblers, at the very least. When this data still lived in .init.*, this probably didn't matter much, albeit the "#execinstr" would have been suspicious to me already then. But the latest with their movement to .rodata these attributes should have been dropped.
---
The PRINT() macro in head.S is another source of such confusion of code vs data. While in head.o there are mapping symbols guiding disassemblers, these mapping symbols are gone when looking at xen-syms. But I realize adr's reach is too limited to allow for a halfway reasonable approach of moving those strings (e.g. to, at least, have them all together).
xen/arch/arm/arm32/proc-v7.S +3 -3
@@ -29,7 +29,7 @@ brahma15mp_init: mcr CP32(r0, ACTLR) mov pc, lr - .section ".proc.info", #alloc, #execinstr + .section ".proc.info", #alloc .type __v7_ca15mp_proc_info, #object __v7_ca15mp_proc_info: .long 0x410FC0F0 /* Cortex-A15 */
@@ -38,7 +38,7 @@ __v7_ca15mp_proc_info: .long caxx_processor .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info - .section ".proc.info", #alloc, #execinstr + .section ".proc.info", #alloc .type __v7_ca7mp_proc_info, #object __v7_ca7mp_proc_info: .long 0x410FC070 /* Cortex-A7 */
@@ -47,7 +47,7 @@ __v7_ca7mp_proc_info: .long caxx_processor .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info - .section ".proc.info", #alloc, #execinstr + .section ".proc.info", #alloc .type __v7_brahma15mp_proc_info, #object __v7_brahma15mp_proc_info: .long 0x420F00F0 /* Broadcom Brahma-B15 */
Hi,
Quoted 5 lines · Jan Beulich
This confuses disassemblers, at the very least. When this data still lived in .init.*, this probably didn't matter much, albeit the "#execinstr" would have been suspicious to me already then. But the latest with their movement to .rodata these attributes should have been dropped.
I don't quite understand why this wasn't really a problem for .init.data but it is a problem for .rodata. Can you expand your thought?
Quoted 2 lines
Fixes 9cbe093b7b84 ("xen/arm: link: Link proc_info_list in .rodata instead of .init.data")
I don't view this commit as the buggy one. I would prefer if there is no Fixes tag. But if you want one, then it should be the patch that introduced #execinstr.
Quoted 1 line
Signed-off-by Jan Beulich <[email protected]>
The change below looks good to me. But I don't understand the commit message, so I will wait an answer before acking it.
Quoted 6 lines
---
ThePRINT()macro inhead.Sis another source of such confusion of code vs data. While in head.o there are mapping symbols guiding disassemblers, these mapping symbols are gone when looking at xen-syms. But I realize adr's reach is too limited to allow for a halfway reasonable approach of moving those strings (e.g. to, at least, have them all together).
I have tried it in the past. The solution I have was to differentiate call with MMU on from the one with MMU off. But I considered this wasn't worth the trouble.
Quoted 23 lines
xen/arch/arm/arm32/proc-v7.S +2
-2@@ -29,7 +29,7 @@ brahma15mp_init: mcr CP32(r0, ACTLR) mov pc, lr - .section ".proc.info", #alloc, #execinstr + .section ".proc.info", #alloc .type __v7_ca15mp_proc_info, #object __v7_ca15mp_proc_info: .long 0x410FC0F0 /* Cortex-A15 */@@ -38,7 +38,7 @@ __v7_ca15mp_proc_info: .long caxx_processor .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info - .section ".proc.info", #alloc, #execinstr + .section ".proc.info", #alloc .type __v7_ca7mp_proc_info, #object __v7_ca7mp_proc_info: .long 0x410FC070 /* Cortex-A7 */
xen/arch/arm/arm32/proc-v7.S __v7_ca7mp_proc_info: · line 53
Quoted 8 lines
xen/arch/arm/arm32/proc-v7.S +1
-1@@ -47,7 +47,7 @@ __v7_ca7mp_proc_info: .long caxx_processor .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info - .section ".proc.info", #alloc, #execinstr + .section ".proc.info", #alloc .type __v7_brahma15mp_proc_info, #object __v7_brahma15mp_proc_info: .long 0x420F00F0 /* Broadcom Brahma-B15 */
Cheers,
Signature · 1 line
Julien Grall
Quoted 9 lines · Julien Grall
Quoted 5 lines · Jan Beulich
This confuses disassemblers, at the very least. When this data still lived in .init.*, this probably didn't matter much, albeit the "#execinstr" would have been suspicious to me already then. But the latest with their movement to .rodata these attributes should have been dropped.
I don't quite understand why this wasn't really a problem for .init.data but it is a problem for .rodata. Can you expand your thought?
I've said "probably" for a reason, and my thinking here goes along the lines of what I've said on the other patch regarding .init.*:
There's perhaps not overly much reason to be picky about the attributes of .init.*, and at least on x86 there is also a case (the EFI binary) where we fold all .init.* into just .init anyway.
The alternative to the present description that I see would be to go with just the 1st sentence. But I would be afraid in such a case that you would come back and tell me this is too little of a description.
Quoted 4 lines
Quoted 1 line
Fixes 9cbe093b7b84 ("xen/arm: link: Link proc_info_list in .rodata instead of .init.data")I don't view this commit as the buggy one. I would prefer if there is no Fixes tag. But if you want one, then it should be the patch that introduced #execinstr.
I've dropped the tag.
Jan
Hi Jan,
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Julien Grall
Quoted 5 lines · Jan Beulich
This confuses disassemblers, at the very least. When this data still lived in .init.*, this probably didn't matter much, albeit the "#execinstr" would have been suspicious to me already then. But the latest with their movement to .rodata these attributes should have been dropped.
Quoted 8 lines
Quoted 2 lines
I don't quite understand why this wasn't really a problem for .init.data but it is a problem for .rodata. Can you expand your thought?
I've said "probably" for a reason, and my thinking here goes along the lines of what I've said on the other patch regarding .init.*:
There's perhaps not overly much reason to be picky about the attributes of .init.*, and at least on x86 there is also a case (the EFI binary) where we fold all .init.* into just .init anyway.
Makese sense. Thanks for the explanation.
Quoted 5 lines
The alternative to the present description that I see would be to go with just the 1st sentence. But I would be afraid in such a case that you would come back and tell me this is too little of a description.
How about:
"xen/arm: .proc.info doesn't need to be executable
The section .proc.info lives in .rodata as it doesn't contain any executable code. However, the section is still marked as executable as the consequence .rodata will also be marked executable.
Xen doesn't use the ELF permissions to decide the page-table mapping permission. However, this will confuse disassemblers.
#execinstr is now removed on all the pushsection dealing with .proc.info".
I can update the commit message on commit.
Cheers,
Signature · 1 line
Julien Grall
Quoted 34 lines · Julien Grall
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Julien Grall
Quoted 5 lines · Jan Beulich
This confuses disassemblers, at the very least. When this data still lived in .init.*, this probably didn't matter much, albeit the "#execinstr" would have been suspicious to me already then. But the latest with their movement to .rodata these attributes should have been dropped.
Quoted 8 lines
Quoted 2 lines
I don't quite understand why this wasn't really a problem for .init.data but it is a problem for .rodata. Can you expand your thought?
I've said "probably" for a reason, and my thinking here goes along the lines of what I've said on the other patch regarding .init.*:
There's perhaps not overly much reason to be picky about the attributes of .init.*, and at least on x86 there is also a case (the EFI binary) where we fold all .init.* into just .init anyway.Makese sense. Thanks for the explanation.
Quoted 5 lines
The alternative to the present description that I see would be to go with just the 1st sentence. But I would be afraid in such a case that you would come back and tell me this is too little of a description.
How about:
"xen/arm: .proc.info doesn't need to be executable
The section .proc.info lives in .rodata as it doesn't contain any executable code. However, the section is still marked as executable as the consequence .rodata will also be marked executable.
Quoted 6 lines
Xen doesn't use the ELF permissions to decide the page-table mapping permission. However, this will confuse disassemblers.
#execinstr is now removed on all the pushsection dealing with .proc.info".
I can update the commit message on commit.
I'm fine with the new commit message, but I'd prefer the title to remain as is, as that aspect is what did trigger me making this change.
Jan
Hi Jan,
Quoted 38 lines · Jan Beulich
Quoted 37 lines · Julien Grall
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Julien Grall
Quoted 5 lines · Jan Beulich
This confuses disassemblers, at the very least. When this data still lived in .init.*, this probably didn't matter much, albeit the "#execinstr" would have been suspicious to me already then. But the latest with their movement to .rodata these attributes should have been dropped.
Quoted 8 lines
Quoted 2 lines
I don't quite understand why this wasn't really a problem for .init.data but it is a problem for .rodata. Can you expand your thought?
I've said "probably" for a reason, and my thinking here goes along the lines of what I've said on the other patch regarding .init.*:
There's perhaps not overly much reason to be picky about the attributes of .init.*, and at least on x86 there is also a case (the EFI binary) where we fold all .init.* into just .init anyway.Makese sense. Thanks for the explanation.
Quoted 5 lines
The alternative to the present description that I see would be to go with just the 1st sentence. But I would be afraid in such a case that you would come back and tell me this is too little of a description.
How about:
"xen/arm: .proc.info doesn't need to be executable
The section .proc.info lives in .rodata as it doesn't contain any executable code. However, the section is still marked as executable as the consequence .rodata will also be marked executable.
Xen doesn't use the ELF permissions to decide the page-table mapping permission. However, this will confuse disassemblers.
Quoted 6 lines
Quoted 3 lines
#execinstr is now removed on all the pushsection dealing with .proc.info".
I can update the commit message on commit.
I'm fine with the new commit message, but I'd prefer the title to remain as is, as that aspect is what did trigger me making this > change.
Sure. I will keep your commit title and update the commit message.
Cheers,
Signature · 1 line
Julien Grall
Julien Grall
Acked-byQuoted 4 lines · Julien Grall
Quoted 2 lines
I'm fine with the new commit message, but I'd prefer the title to remain as is, as that aspect is what did trigger me making this > change.
Sure. I will keep your commit title and update the commit message.
Commited with:
Cheers,
Signature · 1 line
Julien Grall