|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 2/4] x86/hvm: Consider phyaddr_abi when copying from/to guest memory
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
xen/arch/x86/hvm/hvm.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 6f1174c512..5923166b9b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3499,7 +3499,11 @@ unsigned int copy_to_user_hvm(void *to, const void
*from, unsigned int len)
return 0;
}
- rc = hvm_copy_to_guest_linear((unsigned long)to, from, len, 0, NULL);
+ if ( is_hvm_physaddr_abi(current->domain) )
+ rc = hvm_copy_to_guest_phys((unsigned long)to, from, len, current);
+ else
+ rc = hvm_copy_to_guest_linear((unsigned long)to, from, len, 0, NULL);
+
return rc ? len : 0; /* fake a copy_to_user() return code */
}
@@ -3513,7 +3517,10 @@ unsigned int clear_user_hvm(void *to, unsigned int len)
return 0;
}
- rc = hvm_copy_to_guest_linear((unsigned long)to, NULL, len, 0, NULL);
+ if ( is_hvm_physaddr_abi(current->domain) )
+ rc = hvm_copy_to_guest_phys((unsigned long)to, NULL, len, current);
+ else
+ rc = hvm_copy_to_guest_linear((unsigned long)to, NULL, len, 0, NULL);
return rc ? len : 0; /* fake a clear_user() return code */
}
@@ -3528,7 +3535,11 @@ unsigned int copy_from_user_hvm(void *to, const void
*from, unsigned int len)
return 0;
}
- rc = hvm_copy_from_guest_linear(to, (unsigned long)from, len, 0, NULL);
+ if ( is_hvm_physaddr_abi(current->domain) )
+ rc = hvm_copy_from_guest_phys(to, (unsigned long)from, len);
+ else
+ rc = hvm_copy_from_guest_linear(to, (unsigned long)from, len, 0, NULL);
+
return rc ? len : 0; /* fake a copy_from_user() return code */
}
--
2.47.2
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |