[PATCH v2] KVM/x86: make function emulator_do_task_switch as noinline_for_stack

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

 



From: Peng Hao <flyingpeng@xxxxxxxxxxx>

When KASAN is enabled and built with clang:
clang report
arch/x86/kvm/emulate.c:3022:5: error: stack frame size (2488) exceeds limit (2048) in 'emulator_task_switch' [-Werror,-Wframe-larger-than]
int emulator_task_switch(struct x86_emulate_ctxt *ctxt,
    ^

since emulator_do_task_switch() consumes a lot of stack space, mark it as
noinline_for_stack to prevent it from blowing up emulator_task_switch()'s
stack size.

Signed-off-by: Peng Hao <flyingpeng@xxxxxxxxxxx>
---
 arch/x86/kvm/emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 5d4c86133453..bbc185b9725d 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2918,7 +2918,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, u16 old_tss_sel,
 	return load_state_from_tss32(ctxt, &tss_seg);
 }
 
-static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
+static noinline_for_stack int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
 				   u16 tss_selector, int idt_index, int reason,
 				   bool has_error_code, u32 error_code)
 {
-- 
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