From 4f62f2db8e355b67da71e6ac164e41fc727fc1ec Mon Sep 17 00:00:00 2001 From: Tao Su Date: Sun, 4 Jan 2026 03:20:14 +0000 Subject: [PATCH] Use correct GPA range when accepting pages in `protect_gpa_tdvm_call()` --- ostd/src/arch/x86/tdx_guest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ostd/src/arch/x86/tdx_guest.rs b/ostd/src/arch/x86/tdx_guest.rs index c3389ef88..0eaef3399 100644 --- a/ostd/src/arch/x86/tdx_guest.rs +++ b/ostd/src/arch/x86/tdx_guest.rs @@ -52,7 +52,7 @@ pub unsafe fn protect_gpa_tdvm_call(gpa: Paddr, size: usize) -> Result<(), PageC debug_assert!(gpa.is_multiple_of(PAGE_SIZE)); map_gpa(gpa as u64, size as u64).map_err(|_| PageConvertError::TdVmcall)?; - for page_gpa in (0..size).step_by(PAGE_SIZE) { + for page_gpa in (gpa..gpa + size).step_by(PAGE_SIZE) { // SAFETY: The caller ensures the safety of this operation. unsafe { accept_page(0, page_gpa as u64).map_err(|_| PageConvertError::TdCall)?;