public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]  KVM/x86: increase frame warning limit in emulate when using KASAN or KCSAN
@ 2024-06-13  2:19 flyingpenghao
  2024-06-13 19:17 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: flyingpenghao @ 2024-06-13  2:19 UTC (permalink / raw)
  To: seanjc, pbonzini; +Cc: kvm, Peng Hao

From: Peng Hao <flyingpeng@tencent.com>

 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@tencent.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-13 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13  2:19 [PATCH] KVM/x86: increase frame warning limit in emulate when using KASAN or KCSAN flyingpenghao
2024-06-13 19:17 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox