lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251217032450.954344-3-lixianglai@loongson.cn>
Date: Wed, 17 Dec 2025 11:24:50 +0800
From: Xianglai Li <lixianglai@...ngson.cn>
To: loongarch@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	kvm@...r.kernel.org,
	lixianglai@...ngson.cn
Cc: stable@...r.kernel.org,
	Huacai Chen <chenhuacai@...nel.org>,
	WANG Xuerui <kernel@...0n.name>,
	Tianrui Zhao <zhaotianrui@...ngson.cn>,
	Bibo Mao <maobibo@...ngson.cn>,
	Charlie Jenkins <charlie@...osinc.com>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 2/2] LoongArch: KVM: fix "unreliable stack" issue

Insert the appropriate UNWIND macro definition into the kvm_exc_entry in
the assembly function to guide the generation of correct ORC table entries,
thereby solving the timeout problem of loading the livepatch-sample module
on a physical machine running multiple vcpus virtual machines.

While solving the above problems, we have gained an additional benefit,
that is, we can obtain more call stack information

Stack information that can be obtained before the problem is fixed:
[<0>] kvm_vcpu_block+0x88/0x120 [kvm]
[<0>] kvm_vcpu_halt+0x68/0x580 [kvm]
[<0>] kvm_emu_idle+0xd4/0xf0 [kvm]
[<0>] kvm_handle_gspr+0x7c/0x700 [kvm]
[<0>] kvm_handle_exit+0x160/0x270 [kvm]
[<0>] kvm_exc_entry+0x100/0x1e0

Stack information that can be obtained after the problem is fixed:
[<0>] kvm_vcpu_block+0x88/0x120 [kvm]
[<0>] kvm_vcpu_halt+0x68/0x580 [kvm]
[<0>] kvm_emu_idle+0xd4/0xf0 [kvm]
[<0>] kvm_handle_gspr+0x7c/0x700 [kvm]
[<0>] kvm_handle_exit+0x160/0x270 [kvm]
[<0>] kvm_exc_entry+0x100/0x1e0
[<0>] kvm_arch_vcpu_ioctl_run+0x260/0x488 [kvm]
[<0>] kvm_vcpu_ioctl+0x200/0xcd8 [kvm]
[<0>] sys_ioctl+0x498/0xf00
[<0>] do_syscall+0x94/0x190
[<0>] handle_syscall+0xb8/0x158

Cc: stable@...r.kernel.org
Signed-off-by: Xianglai Li <lixianglai@...ngson.cn>
---
Cc: Huacai Chen <chenhuacai@...nel.org>
Cc: WANG Xuerui <kernel@...0n.name>
Cc: Tianrui Zhao <zhaotianrui@...ngson.cn>
Cc: Bibo Mao <maobibo@...ngson.cn>
Cc: Charlie Jenkins <charlie@...osinc.com>
Cc: Xianglai Li <lixianglai@...ngson.cn>
Cc: Thomas Gleixner <tglx@...utronix.de>

 arch/loongarch/kvm/switch.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/loongarch/kvm/switch.S b/arch/loongarch/kvm/switch.S
index 93845ce53651..e3ecb24a3bc5 100644
--- a/arch/loongarch/kvm/switch.S
+++ b/arch/loongarch/kvm/switch.S
@@ -170,6 +170,7 @@ SYM_CODE_START(kvm_exc_entry)
 	/* restore per cpu register */
 	ld.d	u0, a2, KVM_ARCH_HPERCPU
 	addi.d	sp, sp, -PT_SIZE
+	UNWIND_HINT_REGS
 
 	/* Prepare handle exception */
 	or	a0, s0, zero
@@ -214,6 +215,7 @@ SYM_FUNC_START(kvm_enter_guest)
 	addi.d	a2, sp, -PT_SIZE
 	/* Save host GPRs */
 	kvm_save_host_gpr a2
+	st.d	ra, a2, PT_ERA
 
 	addi.d	a2, a1, KVM_VCPU_ARCH
 	st.d	sp, a2, KVM_ARCH_HSP
-- 
2.39.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ