From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel De Graaf Subject: Re: [PATCH v12 for-xen-4.5 01/20] common/symbols: Export hypervisor symbols to privileged guest Date: Fri, 26 Sep 2014 17:43:29 -0400 Message-ID: <5425DE01.80506@tycho.nsa.gov> References: <1411673336-32736-1-git-send-email-boris.ostrovsky@oracle.com> <1411673336-32736-2-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1411673336-32736-2-git-send-email-boris.ostrovsky@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky , jbeulich@suse.com, kevin.tian@intel.com, suravee.suthikulpanit@amd.com, Aravind.Gopalakrishnan@amd.com, dietmar.hahn@ts.fujitsu.com Cc: andrew.cooper3@citrix.com, xen-devel@lists.xen.org, keir@xen.org, jun.nakajima@intel.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org On 09/25/2014 03:28 PM, Boris Ostrovsky wrote: > Export Xen's symbols as {
} triplet via new XENPF_get_symbol > hypercall > > Signed-off-by: Boris Ostrovsky > Reviewed-by: Konrad Rzeszutek Wilk > Reviewed-by: Dietmar Hahn > Tested-by: Dietmar Hahn For the XSM parts: Acked-by: Daniel De Graaf One comment on the patch in general (outside the XSM parts): [...] > diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c > index 2162811..68bc6d9 100644 > --- a/xen/arch/x86/platform_hypercall.c > +++ b/xen/arch/x86/platform_hypercall.c > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -601,6 +602,38 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op) > } > break; > > + case XENPF_get_symbol: > + { > + static char name[KSYM_NAME_LEN + 1]; /* protected by xenpf_lock */ > + XEN_GUEST_HANDLE(char) nameh; > + uint32_t namelen, copylen; > + > + guest_from_compat_handle(nameh, op->u.symdata.name); > + > + ret = xensyms_read(&op->u.symdata.symnum, &op->u.symdata.type, > + &op->u.symdata.address, name); > + > + namelen = strlen(name) + 1; > + > + if ( namelen > op->u.symdata.namelen ) > + { > + /* Caller's buffer is too small for the whole string */ > + if ( op->u.symdata.namelen ) > + name[op->u.symdata.namelen] = '\0'; I don't think this assignment is needed at all: name[copylen] is never copied to the guest and the buffer is not reused internally. > + copylen = op->u.symdata.namelen; > + } > + else > + copylen = namelen; > + > + op->u.symdata.namelen = namelen; > + > + if ( !ret && copy_to_guest(nameh, name, copylen) ) > + ret = -EFAULT; > + if ( !ret && __copy_field_to_guest(u_xenpf_op, op, u.symdata) ) > + ret = -EFAULT; > + } > + break; > + > default: > ret = -ENOSYS; > break; [...] -- Daniel De Graaf National Security Agency