From 30982e6e4bbc9ef337aa239f8172e92f8bf483ee Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Wed, 28 Feb 2024 18:24:07 +0100 Subject: [PATCH] Avoid linker warnings regarding executable stack Add .note.GNU-stack section to assembly files which recent ld versions require to determine whether an executable stack is required. If no such ELF section is present, the linker assumes that the stack needs executable rights. See also [1]. [1] - https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart --- bindings/cpu_vectors_x86_64.S | 2 ++ bindings/virtio/boot.S | 2 ++ bindings/virtio/pagetable.S | 2 ++ bindings/xen/boot.S | 2 ++ bindings/xen/hypercall_page.S | 2 ++ bindings/xen/pagetable.S | 2 ++ 6 files changed, 12 insertions(+) diff --git a/bindings/cpu_vectors_x86_64.S b/bindings/cpu_vectors_x86_64.S index 2914c540..acaccbfc 100644 --- a/bindings/cpu_vectors_x86_64.S +++ b/bindings/cpu_vectors_x86_64.S @@ -120,3 +120,5 @@ IRQ_ENTRY 12 IRQ_ENTRY 13 IRQ_ENTRY 14 IRQ_ENTRY 15 + +.section .note.GNU-stack,"",%progbits diff --git a/bindings/virtio/boot.S b/bindings/virtio/boot.S index de216127..41fd0950 100644 --- a/bindings/virtio/boot.S +++ b/bindings/virtio/boot.S @@ -201,3 +201,5 @@ ENTRY(_newstack) cli hlt END(_newstack) + +.section .note.GNU-stack,"",%progbits diff --git a/bindings/virtio/pagetable.S b/bindings/virtio/pagetable.S index 47e5d34c..98c86971 100644 --- a/bindings/virtio/pagetable.S +++ b/bindings/virtio/pagetable.S @@ -1046,3 +1046,5 @@ cpu_pdpt: cpu_pml4: .quad cpu_pdpt + 0x3 .fill 0x1ff, 0x8, 0x0 + +.section .note.GNU-stack,"",%progbits diff --git a/bindings/xen/boot.S b/bindings/xen/boot.S index 4ddd5935..291c0e15 100644 --- a/bindings/xen/boot.S +++ b/bindings/xen/boot.S @@ -231,3 +231,5 @@ mxcsr_ptr: */ .space 4096 bootstack: + +.section .note.GNU-stack,"",%progbits diff --git a/bindings/xen/hypercall_page.S b/bindings/xen/hypercall_page.S index ffc34049..9874d215 100644 --- a/bindings/xen/hypercall_page.S +++ b/bindings/xen/hypercall_page.S @@ -132,3 +132,5 @@ DECLARE_HYPERCALL(arch_4) DECLARE_HYPERCALL(arch_5) DECLARE_HYPERCALL(arch_6) DECLARE_HYPERCALL(arch_7) + +.section .note.GNU-stack,"",%progbits diff --git a/bindings/xen/pagetable.S b/bindings/xen/pagetable.S index 1efbbfd0..d343c28d 100644 --- a/bindings/xen/pagetable.S +++ b/bindings/xen/pagetable.S @@ -528,3 +528,5 @@ cpu_pdpt: cpu_pml4: .quad cpu_pdpt + 0x3 .fill 0x1ff, 0x8, 0x0 + +.section .note.GNU-stack,"",%progbits