diff options
Diffstat (limited to 'meta/recipes-extended/ltp/ltp/0001-kvm-Fix-stack-access-mode-in-KVM-test-ELF-headers.patch')
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0001-kvm-Fix-stack-access-mode-in-KVM-test-ELF-headers.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-kvm-Fix-stack-access-mode-in-KVM-test-ELF-headers.patch b/meta/recipes-extended/ltp/ltp/0001-kvm-Fix-stack-access-mode-in-KVM-test-ELF-headers.patch new file mode 100644 index 0000000000..764e9c0d9f --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0001-kvm-Fix-stack-access-mode-in-KVM-test-ELF-headers.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | From 608fc7bcda43e60536ae1f19842f7affba8f0aea Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Doucha <mdoucha@suse.cz> | ||
3 | Date: Wed, 1 Jun 2022 16:16:34 +0200 | ||
4 | Subject: [PATCH] kvm: Fix stack access mode in KVM test ELF headers | ||
5 | |||
6 | When the linker converts guest payload binary into a linkable resource | ||
7 | object file, it somehow defaults to requesting executable stack section | ||
8 | for the final test binary. This trips some build-time security checks | ||
9 | on newer systems. Add explicit linker option to make the stack | ||
10 | non-executable. | ||
11 | |||
12 | Suggested-by: Fabian Vogt <fvogt@suse.com> | ||
13 | Signed-off-by: Martin Doucha <mdoucha@suse.cz> | ||
14 | Reviewed-by: Petr Vorel <pvorel@suse.cz> | ||
15 | Reviewed-by: Cyril Hrubis <chrubis@suse.cz> | ||
16 | |||
17 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
18 | Upstream-Status: Backport [https://github.com/linux-test-project/ltp/commit/f9715d7c2e78713e26533c6e0846aaabf5c4095b] | ||
19 | --- | ||
20 | testcases/kernel/kvm/Makefile | 4 ++-- | ||
21 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile | ||
24 | index 69a9946fe..adab56952 100644 | ||
25 | --- a/testcases/kernel/kvm/Makefile | ||
26 | +++ b/testcases/kernel/kvm/Makefile | ||
27 | @@ -50,11 +50,11 @@ include $(top_srcdir)/include/mk/generic_leaf_target.mk | ||
28 | ifdef VERBOSE | ||
29 | $(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) | ||
30 | objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin | ||
31 | - ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin | ||
32 | + ld -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin | ||
33 | else | ||
34 | @$(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) | ||
35 | @objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin | ||
36 | - @ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin | ||
37 | + @ld -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin | ||
38 | @echo KVM_CC $(target_rel_dir)$@ | ||
39 | endif | ||
40 | @rm $*-payload.elf $*-payload.bin | ||