[LTP] [PATCH 4/9] kvm_svm02: Fix saved stack segment index value

Martin Doucha mdoucha@suse.cz
Tue Apr 30 14:22:00 CEST 2024


The VMCB init helper function expects GDT item index while the VMCB
segment selector values are byte offsets. Shift the byte offset
of saved stack segment selector to get the correct GDT index.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/kvm/kvm_svm02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/kvm/kvm_svm02.c b/testcases/kernel/kvm/kvm_svm02.c
index 5d2e2ce37..f72fb3812 100644
--- a/testcases/kernel/kvm/kvm_svm02.c
+++ b/testcases/kernel/kvm/kvm_svm02.c
@@ -96,7 +96,7 @@ void main(void)
 	vmsave_buf = kvm_alloc_vmcb();
 
 	/* Save allocated stack for later VM reinit */
-	ss = vcpu->vmcb->ss.selector;
+	ss = vcpu->vmcb->ss.selector >> 3;
 	rsp = vcpu->vmcb->rsp;
 
 	/* Load partial state from vmsave_buf and save it to vcpu->vmcb */
-- 
2.44.0



More information about the ltp mailing list