|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6 15/36] ARM: introduce vgic_access_guest_memory()
Hi Andre, On 04/07/2017 06:32 PM, Andre Przywara wrote: This function allows to copy a chunk of data from and to guest physical memory. It looks up the associated page from the guest's p2m tree and maps this page temporarily for the time of the access. This function was originally written by Vijaya as part of an earlier series: https://patchwork.kernel.org/patch/8177251i This likely means the From: should be "Vijaya...". Hmmmm.... it is not what I meant by a check. If a user uses this function he will expect *all* the buffer filled and not only a part if a page boundary is crossed. This would be a potential security issue if the buffer is then written back to the guest memory (I know this is not the case today, but still...). I think it would be better if we return -EINVAL if the in this case. + + if ( is_write ) + memcpy(p + offset, buf, size); + else + memcpy(buf, p + offset, size); + + unmap_domain_page(p); + put_page(page); + + return 0; +} + +/* * Local variables: * mode: C * c-file-style: "BSD" diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 52856ca..967c2be 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -319,6 +319,9 @@ extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops); int vgic_v2_init(struct domain *d, int *mmio_count); int vgic_v3_init(struct domain *d, int *mmio_count); +int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, + uint32_t size, bool_t is_write); + extern int domain_vgic_register(struct domain *d, int *mmio_count); extern int vcpu_vgic_free(struct vcpu *v); extern bool vgic_to_sgi(struct vcpu *v, register_t sgir, Cheers, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |