KVM: Fix ELF segment with RWX permissions warnings
PATCH 1/1 KVM: Fix ELF segment with RWX permissions warnings
Linker complains that some ASM bootstrap segments have both write and execute permissions. Rename .data.gdt32 section because the ASM compiler seems to make it writable regardless of section flags. Also define new ELF segment for writable data sections.
Signed-off-by Martin Doucha <[email protected]>
--- testcases/kernel/kvm/Makefile | 2 +- testcases/kernel/kvm/bootstrap_x86.S | 2 +- testcases/kernel/kvm/bootstrap_x86_64.S | 2 +- testcases/kernel/kvm/linker/x86.lds | 5 +++-- testcases/kernel/kvm/linker/x86_64.lds | 5 +++-- 5 files changed, 9 insertions(+), 7 deletions(-)
testcases/kernel/kvm/Makefile +1 -1
@@ -9,7 +9,7 @@ ASFLAGS = CPPFLAGS += -I$(abs_srcdir)/include GUEST_CPPFLAGS = $(CPPFLAGS) -DCOMPILE_PAYLOAD GUEST_CFLAGS = -ffreestanding -O2 -Wall -fno-asynchronous-unwind-tables -mno-mmx -mno-sse -GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fno-stack-protector +GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fno-stack-protector -z noexecstack GUEST_LDLIBS = KVM_LD ?= $(LD)
testcases/kernel/kvm/bootstrap_x86.S +1 -1
@@ -31,7 +31,7 @@ protected_mode_entry: mov %eax, %es jmp init_memlayout -.section .data.gdt32, "a", @progbits +.section .init.gdt32, "a", @progbits .macro gdt32_entry type:req l=0 d=0 dpl=0 limit=0xfffff g=1 p=1 .4byte \limit & 0xffff
testcases/kernel/kvm/bootstrap_x86_64.S +1 -1
@@ -32,7 +32,7 @@ protected_mode_entry: mov %eax, %es jmp init_memlayout -.section .data.gdt32, "a", @progbits +.section .init.gdt32, "a", @progbits .macro gdt32_entry type:req l=0 d=0 dpl=0 limit=0xfffff g=1 p=1 .4byte \limit & 0xffff
testcases/kernel/kvm/linker/x86.lds +3 -2
@@ -4,6 +4,7 @@ PHDRS { headers PT_PHDR PHDRS ; text PT_LOAD FILEHDR PHDRS ; + data PT_LOAD ; bss PT_LOAD ; }
@@ -18,7 +19,7 @@ SECTIONS .init.boot : { *(.init.protected_mode) - *(.data.gdt32) + *(.init.gdt32) *(.init.memlayout) } :text
@@ -40,7 +41,7 @@ SECTIONS { *(.data.strings) *(.data) - } + } :data .preinit_array : {
testcases/kernel/kvm/linker/x86_64.lds +3 -2
@@ -4,6 +4,7 @@ PHDRS { headers PT_PHDR PHDRS ; text PT_LOAD FILEHDR PHDRS ; + data PT_LOAD ; bss PT_LOAD ; }
@@ -18,7 +19,7 @@ SECTIONS .init.boot : { *(.init.protected_mode) - *(.data.gdt32) + *(.init.gdt32) *(.init.memlayout) } :text
@@ -40,7 +41,7 @@ SECTIONS { *(.data.strings) *(.data) - } + } :data .preinit_array : {
Signature · 5 lines
2.39.2 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Martin,
thank you, merged!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp