Make gnu stack sections allocatable.

Apparently on some arches this needs to be explicit.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2023-02-01 16:29:38 -05:00
parent da9670f334
commit acb278c5bd
2 changed files with 30 additions and 28 deletions

View File

@ -49,7 +49,7 @@ index 40bc68fedaa..a94e31ab71d 100644
hello: .byte 'h',0,'e',0,'l',0,'l',0,'o',0,'\n',0,'\r',0,0,0 hello: .byte 'h',0,'e',0,'l',0,'l',0,'o',0,'\n',0,'\r',0,0,0
#endif #endif
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/gnuefi/crt0-efi-aa64.S b/gnuefi/crt0-efi-aa64.S diff --git a/gnuefi/crt0-efi-aa64.S b/gnuefi/crt0-efi-aa64.S
index a9302588b71..c028213a03f 100644 index a9302588b71..c028213a03f 100644
--- a/gnuefi/crt0-efi-aa64.S --- a/gnuefi/crt0-efi-aa64.S
@ -58,7 +58,7 @@ index a9302588b71..c028213a03f 100644
0: ldp x29, x30, [sp], #32 0: ldp x29, x30, [sp], #32
ret ret
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/gnuefi/crt0-efi-arm.S b/gnuefi/crt0-efi-arm.S diff --git a/gnuefi/crt0-efi-arm.S b/gnuefi/crt0-efi-arm.S
index 04e75e9481a..66f0b0777e7 100644 index 04e75e9481a..66f0b0777e7 100644
--- a/gnuefi/crt0-efi-arm.S --- a/gnuefi/crt0-efi-arm.S
@ -67,7 +67,7 @@ index 04e75e9481a..66f0b0777e7 100644
.L_DYNAMIC: .L_DYNAMIC:
.word _DYNAMIC - . .word _DYNAMIC - .
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/gnuefi/crt0-efi-ia32.S b/gnuefi/crt0-efi-ia32.S diff --git a/gnuefi/crt0-efi-ia32.S b/gnuefi/crt0-efi-ia32.S
index 031a592ab35..1d3787fa79e 100644 index 031a592ab35..1d3787fa79e 100644
--- a/gnuefi/crt0-efi-ia32.S --- a/gnuefi/crt0-efi-ia32.S
@ -76,7 +76,7 @@ index 031a592ab35..1d3787fa79e 100644
.long .dummy1-.dummy0 // Page RVA .long .dummy1-.dummy0 // Page RVA
.long 10 // Block Size (2*4+2) .long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/gnuefi/crt0-efi-ia64.S b/gnuefi/crt0-efi-ia64.S diff --git a/gnuefi/crt0-efi-ia64.S b/gnuefi/crt0-efi-ia64.S
index dacb4c4c658..f02adc1d3fb 100644 index dacb4c4c658..f02adc1d3fb 100644
--- a/gnuefi/crt0-efi-ia64.S --- a/gnuefi/crt0-efi-ia64.S
@ -85,7 +85,7 @@ index dacb4c4c658..f02adc1d3fb 100644
data4 12 // Block Size (2*4+2*2) data4 12 // Block Size (2*4+2*2)
data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point
data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/gnuefi/crt0-efi-mips64el.S b/gnuefi/crt0-efi-mips64el.S diff --git a/gnuefi/crt0-efi-mips64el.S b/gnuefi/crt0-efi-mips64el.S
index 5ad2503ca79..34853dd06af 100644 index 5ad2503ca79..34853dd06af 100644
--- a/gnuefi/crt0-efi-mips64el.S --- a/gnuefi/crt0-efi-mips64el.S
@ -94,7 +94,7 @@ index 5ad2503ca79..34853dd06af 100644
.end _start .end _start
.set pop .set pop
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/gnuefi/crt0-efi-x64.S b/gnuefi/crt0-efi-x64.S diff --git a/gnuefi/crt0-efi-x64.S b/gnuefi/crt0-efi-x64.S
index 5c86cde12e8..eb6b30c934c 100644 index 5c86cde12e8..eb6b30c934c 100644
--- a/gnuefi/crt0-efi-x64.S --- a/gnuefi/crt0-efi-x64.S
@ -103,7 +103,7 @@ index 5c86cde12e8..eb6b30c934c 100644
.long 10 // Block Size (2*4+2) .long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/gnuefi/reloc_ia64.S b/gnuefi/reloc_ia64.S diff --git a/gnuefi/reloc_ia64.S b/gnuefi/reloc_ia64.S
index 40203bfb982..af2c934dd14 100644 index 40203bfb982..af2c934dd14 100644
--- a/gnuefi/reloc_ia64.S --- a/gnuefi/reloc_ia64.S
@ -112,14 +112,14 @@ index 40203bfb982..af2c934dd14 100644
fptr_mem_base: fptr_mem_base:
.space MAX_FUNCTION_DESCRIPTORS*16 .space MAX_FUNCTION_DESCRIPTORS*16
fptr_mem_limit: fptr_mem_limit:
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/aa64/efi_stub.S b/lib/aa64/efi_stub.S diff --git a/lib/aa64/efi_stub.S b/lib/aa64/efi_stub.S
index 464eae58aea..dbefa895d78 100644 index 464eae58aea..dbefa895d78 100644
--- a/lib/aa64/efi_stub.S --- a/lib/aa64/efi_stub.S
+++ b/lib/aa64/efi_stub.S +++ b/lib/aa64/efi_stub.S
@@ -1 +1,2 @@ @@ -1 +1,2 @@
/* This stub is a stub to make the build happy */ /* This stub is a stub to make the build happy */
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/aa64/setjmp.S b/lib/aa64/setjmp.S diff --git a/lib/aa64/setjmp.S b/lib/aa64/setjmp.S
index 46c29b16d23..e8afaa78478 100644 index 46c29b16d23..e8afaa78478 100644
--- a/lib/aa64/setjmp.S --- a/lib/aa64/setjmp.S
@ -128,7 +128,7 @@ index 46c29b16d23..e8afaa78478 100644
mov w0, #1 mov w0, #1
csel w0, w1, w0, ne csel w0, w1, w0, ne
br x30 br x30
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/div.S b/lib/arm/div.S diff --git a/lib/arm/div.S b/lib/arm/div.S
index 71158b6f621..1dcbfb00119 100644 index 71158b6f621..1dcbfb00119 100644
--- a/lib/arm/div.S --- a/lib/arm/div.S
@ -137,14 +137,14 @@ index 71158b6f621..1dcbfb00119 100644
@ What to do about division by zero? For now, just return. @ What to do about division by zero? For now, just return.
ASM_PFX(__aeabi_idiv0): ASM_PFX(__aeabi_idiv0):
bx r14 bx r14
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/efi_stub.S b/lib/arm/efi_stub.S diff --git a/lib/arm/efi_stub.S b/lib/arm/efi_stub.S
index 464eae58aea..dbefa895d78 100644 index 464eae58aea..dbefa895d78 100644
--- a/lib/arm/efi_stub.S --- a/lib/arm/efi_stub.S
+++ b/lib/arm/efi_stub.S +++ b/lib/arm/efi_stub.S
@@ -1 +1,2 @@ @@ -1 +1,2 @@
/* This stub is a stub to make the build happy */ /* This stub is a stub to make the build happy */
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/ldivmod.S b/lib/arm/ldivmod.S diff --git a/lib/arm/ldivmod.S b/lib/arm/ldivmod.S
index edbf89ed58b..aa140d8af23 100644 index edbf89ed58b..aa140d8af23 100644
--- a/lib/arm/ldivmod.S --- a/lib/arm/ldivmod.S
@ -153,7 +153,7 @@ index edbf89ed58b..aa140d8af23 100644
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/llsl.S b/lib/arm/llsl.S diff --git a/lib/arm/llsl.S b/lib/arm/llsl.S
index 0f5c4078b97..cdb0ff76ea8 100644 index 0f5c4078b97..cdb0ff76ea8 100644
--- a/lib/arm/llsl.S --- a/lib/arm/llsl.S
@ -162,7 +162,7 @@ index 0f5c4078b97..cdb0ff76ea8 100644
lsl r1,r0,r3 lsl r1,r0,r3
mov r0,#0 mov r0,#0
bx lr bx lr
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/llsr.S b/lib/arm/llsr.S diff --git a/lib/arm/llsr.S b/lib/arm/llsr.S
index 432b27d7ac7..c04e5ae6fbe 100644 index 432b27d7ac7..c04e5ae6fbe 100644
--- a/lib/arm/llsr.S --- a/lib/arm/llsr.S
@ -171,7 +171,7 @@ index 432b27d7ac7..c04e5ae6fbe 100644
lsr r0,r1,r3 lsr r0,r1,r3
mov r1,#0 mov r1,#0
bx lr bx lr
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/mullu.S b/lib/arm/mullu.S diff --git a/lib/arm/mullu.S b/lib/arm/mullu.S
index 39b9a80bd26..7fb12eaa248 100644 index 39b9a80bd26..7fb12eaa248 100644
--- a/lib/arm/mullu.S --- a/lib/arm/mullu.S
@ -180,7 +180,7 @@ index 39b9a80bd26..7fb12eaa248 100644
mla r1, r2, r1, ip mla r1, r2, r1, ip
mla r1, r3, lr, r1 mla r1, r3, lr, r1
ldmia sp!, {pc} ldmia sp!, {pc}
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/setjmp.S b/lib/arm/setjmp.S diff --git a/lib/arm/setjmp.S b/lib/arm/setjmp.S
index bd61a8d803a..ac6779ec0c1 100644 index bd61a8d803a..ac6779ec0c1 100644
--- a/lib/arm/setjmp.S --- a/lib/arm/setjmp.S
@ -189,7 +189,7 @@ index bd61a8d803a..ac6779ec0c1 100644
.type longjmp, %function .type longjmp, %function
longjmp: longjmp:
ldmia r0, {r3-r12,r14} ldmia r0, {r3-r12,r14}
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/arm/uldiv.S b/lib/arm/uldiv.S diff --git a/lib/arm/uldiv.S b/lib/arm/uldiv.S
index f478898d23c..1ce4d3202b3 100644 index f478898d23c..1ce4d3202b3 100644
--- a/lib/arm/uldiv.S --- a/lib/arm/uldiv.S
@ -198,7 +198,7 @@ index f478898d23c..1ce4d3202b3 100644
bx r14 bx r14
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/ctors.S b/lib/ctors.S diff --git a/lib/ctors.S b/lib/ctors.S
index 522d31b90d2..c8146af1dd9 100644 index 522d31b90d2..c8146af1dd9 100644
--- a/lib/ctors.S --- a/lib/ctors.S
@ -208,14 +208,14 @@ index 522d31b90d2..c8146af1dd9 100644
_fini_array_end: _fini_array_end:
.long 0 .long 0
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/ia32/efi_stub.S b/lib/ia32/efi_stub.S diff --git a/lib/ia32/efi_stub.S b/lib/ia32/efi_stub.S
index 464eae58aea..dbefa895d78 100644 index 464eae58aea..dbefa895d78 100644
--- a/lib/ia32/efi_stub.S --- a/lib/ia32/efi_stub.S
+++ b/lib/ia32/efi_stub.S +++ b/lib/ia32/efi_stub.S
@@ -1 +1,2 @@ @@ -1 +1,2 @@
/* This stub is a stub to make the build happy */ /* This stub is a stub to make the build happy */
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/ia32/setjmp.S b/lib/ia32/setjmp.S diff --git a/lib/ia32/setjmp.S b/lib/ia32/setjmp.S
index aa9c08469e1..64d0f111a6e 100644 index aa9c08469e1..64d0f111a6e 100644
--- a/lib/ia32/setjmp.S --- a/lib/ia32/setjmp.S
@ -224,7 +224,7 @@ index aa9c08469e1..64d0f111a6e 100644
movl (%edx), %ebx movl (%edx), %ebx
movl 4(%edx), %esi movl 4(%edx), %esi
movl 8(%edx), %edi movl 8(%edx), %edi
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/ia64/palproc.S b/lib/ia64/palproc.S diff --git a/lib/ia64/palproc.S b/lib/ia64/palproc.S
index c304a78d85e..9751c505384 100644 index c304a78d85e..9751c505384 100644
--- a/lib/ia64/palproc.S --- a/lib/ia64/palproc.S
@ -233,7 +233,7 @@ index c304a78d85e..9751c505384 100644
PROCEDURE_EXIT(MakeStackedPALCall) PROCEDURE_EXIT(MakeStackedPALCall)
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/ia64/setjmp.S b/lib/ia64/setjmp.S diff --git a/lib/ia64/setjmp.S b/lib/ia64/setjmp.S
index bbb29d8b8f5..8e53c022117 100644 index bbb29d8b8f5..8e53c022117 100644
--- a/lib/ia64/setjmp.S --- a/lib/ia64/setjmp.S
@ -242,14 +242,14 @@ index bbb29d8b8f5..8e53c022117 100644
invala invala
mov ar.rsc = r16 mov ar.rsc = r16
br.ret.sptk b0 br.ret.sptk b0
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/mips64el/efi_stub.S b/lib/mips64el/efi_stub.S diff --git a/lib/mips64el/efi_stub.S b/lib/mips64el/efi_stub.S
index 464eae58aea..dbefa895d78 100644 index 464eae58aea..dbefa895d78 100644
--- a/lib/mips64el/efi_stub.S --- a/lib/mips64el/efi_stub.S
+++ b/lib/mips64el/efi_stub.S +++ b/lib/mips64el/efi_stub.S
@@ -1 +1,2 @@ @@ -1 +1,2 @@
/* This stub is a stub to make the build happy */ /* This stub is a stub to make the build happy */
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/mips64el/setjmp.S b/lib/mips64el/setjmp.S diff --git a/lib/mips64el/setjmp.S b/lib/mips64el/setjmp.S
index 930aca44102..f0808e49288 100644 index 930aca44102..f0808e49288 100644
--- a/lib/mips64el/setjmp.S --- a/lib/mips64el/setjmp.S
@ -258,7 +258,7 @@ index 930aca44102..f0808e49288 100644
li $v0, 1 li $v0, 1
movn $v0, $a1, $a1 movn $v0, $a1, $a1
jr $ra jr $ra
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/x64/efi_stub.S b/lib/x64/efi_stub.S diff --git a/lib/x64/efi_stub.S b/lib/x64/efi_stub.S
index b4312556e00..fc0cced6878 100644 index b4312556e00..fc0cced6878 100644
--- a/lib/x64/efi_stub.S --- a/lib/x64/efi_stub.S
@ -267,7 +267,7 @@ index b4312556e00..fc0cced6878 100644
ret ret
#endif #endif
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
diff --git a/lib/x64/setjmp.S b/lib/x64/setjmp.S diff --git a/lib/x64/setjmp.S b/lib/x64/setjmp.S
index e3e51959719..3892d016c6d 100644 index e3e51959719..3892d016c6d 100644
--- a/lib/x64/setjmp.S --- a/lib/x64/setjmp.S
@ -276,7 +276,7 @@ index e3e51959719..3892d016c6d 100644
cmp %rax,%rdx cmp %rax,%rdx
cmove %rcx,%rax cmove %rcx,%rax
jmp *0x38(%rdi) jmp *0x38(%rdi)
+ .section .note.GNU-stack + .section .note.GNU-stack,"a"
-- --
2.39.0 2.39.0

View File

@ -182,7 +182,9 @@ find %{buildroot}/%{_prefix}/ -type l | sed 's,%{buildroot}/\+,/,' > compat.lst
%endif %endif
%changelog %changelog
* Wed Feb 01 2023 Peter Jones <pjones@redhat.com> - 3.0.11-8 * Tue Feb 21 2023 Peter Jones <pjones@redhat.com> - 3.0.11-12
- Build with --no-warn-rwx-segment, since we don't wind up with segment maps
in the final bianries anyway.
- Add .note.GNU-stack sections to all the .S files we build. - Add .note.GNU-stack sections to all the .S files we build.
- Don't use _hardened_ldflags since it's meant for GCC rather than ld and - Don't use _hardened_ldflags since it's meant for GCC rather than ld and
doesn't do anything meaningful for us anyway. doesn't do anything meaningful for us anyway.