[PATCH] KVM/x86: increase frame warning limit in emulate when using KASAN or KCSAN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peng Hao <flyingpeng@xxxxxxxxxxx>

 When building kernel with clang, which will typically
 have sanitizers enabled, there is a warning about a large stack frame.

arch/x86/kvm/emulate.c:3022:5: error: stack frame size (2520) exceeds limit (2048)
in 'emulator_task_switch' [-Werror,-Wframe-larger-than]
int emulator_task_switch(struct x86_emulate_ctxt *ctxt,
    ^
599/2520 (23.77%) spills, 1921/2520 (76.23%) variables

so increase the limit for configurations that have KASAN or KCSAN enabled for not
breaking the majority of builds.

Signed-off-by: Peng Hao <flyingpeng@xxxxxxxxxxx>
---
 arch/x86/kvm/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index addc44fc7187..2165262c1497 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -5,6 +5,12 @@ ccflags-$(CONFIG_KVM_WERROR) += -Werror
 
 include $(srctree)/virt/kvm/Makefile.kvm
 
+ifneq ($(CONFIG_FRAME_WARN),0)
+ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+CFLAGS_emulate.o = -Wframe-larger-than=2520
+endif
+endif
+
 kvm-y			+= x86.o emulate.o i8259.o irq.o lapic.o \
 			   i8254.o ioapic.o irq_comm.o cpuid.o pmu.o mtrr.o \
 			   debugfs.o mmu/mmu.o mmu/page_track.o \
-- 
2.27.0





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux