@@ -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)
@@ -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
@@ -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
@@ -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 :
{
@@ -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 :
{
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 <mdoucha@suse.cz> --- 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(-)