0003-kvm-Fix-undefined-reference-to-__stack_chk_fail.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From: Petr Vorel <petr.vorel@gmail.com>
  2. Date: Fri, 10 Jun 2022 09:13:09 +0200
  3. Subject: [PATCH] kvm: Fix undefined reference to __stack_chk_fail()
  4. Some x86_64 buildroot toolchains (bootlin-x86-64-glibc,
  5. bootlin-x86-64-musl) try to link to __stack_chk_fail().
  6. -nostdlib is not enough, it requires also -fno-stack-protector.
  7. x86_64-buildroot-linux-gnu/bin/ld: /tmp/ccgBXEoR.o: in function `handle_page_fault':
  8. kvm_pagefault01.c:(.text+0x5d): undefined reference to `__stack_chk_fail'
  9. collect2: error: ld returned 1 exit status
  10. [ upstream status: 1a51aa710 ("kvm: Fix undefined reference to __stack_chk_fail()") ]
  11. Suggested-by: Martin Doucha <mdoucha@suse.cz>
  12. Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
  13. Reviewed-by: Martin Doucha <mdoucha@suse.cz>
  14. Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  15. Reviewed-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
  16. Tested-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
  17. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
  18. ---
  19. testcases/kernel/kvm/Makefile | 2 +-
  20. 1 file changed, 1 insertion(+), 1 deletion(-)
  21. diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
  22. index 8d5193d8e..c5a09719c 100644
  23. --- a/testcases/kernel/kvm/Makefile
  24. +++ b/testcases/kernel/kvm/Makefile
  25. @@ -9,7 +9,7 @@ ASFLAGS =
  26. CPPFLAGS += -I$(abs_srcdir)/include
  27. GUEST_CPPFLAGS = $(CPPFLAGS) -DCOMPILE_PAYLOAD
  28. GUEST_CFLAGS = -ffreestanding -O2 -Wall -fno-asynchronous-unwind-tables -mno-mmx -mno-sse
  29. -GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none
  30. +GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fno-stack-protector
  31. GUEST_LDLIBS =
  32. FILTER_OUT_MAKE_TARGETS := lib_guest lib_host lib_x86
  33. --
  34. 2.36.1