From patchwork Wed Mar 29 14:24:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Schmoll X-Patchwork-Id: 9651715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6BD67602C8 for ; Wed, 29 Mar 2017 14:27:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6256F26BE9 for ; Wed, 29 Mar 2017 14:27:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56BBC28494; Wed, 29 Mar 2017 14:27:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8147226BE9 for ; Wed, 29 Mar 2017 14:27:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctEXE-0006d3-5g; Wed, 29 Mar 2017 14:25:16 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctEXC-0006cl-Jk for xen-devel@lists.xenproject.org; Wed, 29 Mar 2017 14:25:14 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 17/65-19998-9C3CBD85; Wed, 29 Mar 2017 14:25:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRWlGSWpSXmKPExsVyMfSase6Jw7c jDKZ+NLD4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNOv37FUnA7suLqp6PsDYwXA7oYuTiEBGYy SrT8n8UE4rAINLBK3F17mRHEkRCYwyqx9tl0ti5GTiAnR2LN9aOsEHaRxJF9c8DivAKCEidnP mEBsYUEvCQ2PXgIVsMpYCkxYeYiRogVv1kkbi44B1bEJmAgMXvlRWYQm0VAVaLz4xNmiEEBEg /bjrKD2MICwRKf/uwFqxcRUJR48PIm2FBmASWJ/WevMULYXhKnn15jmsAoMAvJHbOQpGYxcgD Z6hLr5wlBhNUkbm+7yg5ha0ssW/iaeQEj6ypG9eLUorLUIl1LvaSizPSMktzEzBxdQwNjvdzU 4uLE9NScxKRiveT83E2MwICuZ2Bg3MH4+qfTIUZJDiYlUd4ThrcjhPiS8lMqMxKLM+KLSnNSi w8xynBwKEnw3j0ElBMsSk1PrUjLzAHGFkxagoNHSYSX/yBQmre4IDG3ODMdInWK0ZLjwaldb5 g45szeDSQ/9R9+wyTEkpeflyolzjsJZJ4ASENGaR7cOFj8X2KUlRLmZWRgYBDiKUgtys0sQZV /xSjOwagkzHscZApPZl4J3NZXQAcxAR0kbnML5KCSRISUVAPjMo++HG71qG2S3q0fP/THP0xb +0sygu+dwf7VZ9YZzHi8Irf6bSmnvRmjlNaqXKkMh2VLClUkCheccG8x4Y+c1Wy7QrRBnecm9 60Vl37/8Ht7vVLjeEbWn2/rD0Y9ru+vfPwpy2Db2W9K3f5njk7T26x8a0F10c5VAhqOrutFXj LsnOKwKfe9EktxRqKhFnNRcSIAjIhLgfoCAAA= X-Env-Sender: eggi.innovations@gmail.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1490797511!88660144!1 X-Originating-IP: [209.85.214.51] X-SpamReason: No, hits=1.2 required=7.0 tests=HTML_20_30,HTML_MESSAGE, RCVD_BY_IP X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53518 invoked from network); 29 Mar 2017 14:25:12 -0000 Received: from mail-it0-f51.google.com (HELO mail-it0-f51.google.com) (209.85.214.51) by server-15.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Mar 2017 14:25:12 -0000 Received: by mail-it0-f51.google.com with SMTP id y18so154011244itc.0 for ; Wed, 29 Mar 2017 07:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+EsIjumWhtwrSLy4Pvaex/xljQCcygUcgw8WfB9Gng8=; b=n9CU2XXUgvTYRoNqpNx/1n3l33ku5VF58l0IfEuWg0NlSyHDgz9JONkbpEeFjXTjri 5DtARptevo0eBi4vbu0B3mW9ACnsZp1gshRlEQoy41vPqNFgR5/RtoRLvSV26gcpHkYx PG+HsfCAMtpB4j332lJ34+BRhWbbkxTUqfy6xVfVlHFVS1/NfULV1jbq8v5Qzj+0AUAN 7bYCMqgAJkwogpg4wCOdu4+spsxSfFwErTTrc7FpwPzpFYDY5oOt7svlYPyfGzLEvFYb QTs+sozu3C4dYfj2tIY9HeeavM9NaQzN0SYuFBMEDmXwas14IR+jOnxxQH7JrKjrhvVu siwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+EsIjumWhtwrSLy4Pvaex/xljQCcygUcgw8WfB9Gng8=; b=uLwYw+pfCuQek2uQrFxQi6iv9pNPU1mH2s2nRJqyQmjfk9Xvgm/ekWcRrRGpcTTk9z zqBqeWzT1NUiRhBr/Aa5A1rN3hmbahr6EfxoqeJitJwcNpc+71OUCY1LjQ3T775h+hik 4YpgGnVVDo9nNe0Cja3JPwB8H9B/A0KXBP+QCEaRlaieW6+wYdI24t47mowvSJBsiYey O85wZUbuooajPIPhplG8vnuqW/RKVSTMyFpNmsf02aLfJJlDqj4bWOAVJWkMAzGUuz+r ywgBQIU6AM/nwITwsa0KWFyeYucil9NTvXf1xDPoE1Mh5IZlD9mWPpZBsEbR1J+ZVcvJ uhlg== X-Gm-Message-State: AFeK/H04Qryl+a8LlRZqOHCxFUMUJNB9vWWpAvLl9E5e+CQRkLxv/2A+f41QNMdjFCQs2XifGDGYkg7AC9jKAA== X-Received: by 10.36.83.209 with SMTP id n200mr1459079itb.40.1490797495677; Wed, 29 Mar 2017 07:24:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.19.28 with HTTP; Wed, 29 Mar 2017 07:24:15 -0700 (PDT) In-Reply-To: <20170329104118.g2gj6grorjptfsve@citrix.com> References: <20170322112107.2tkxz6b3kd5emwjf@citrix.com> <20170324125608.imozb5dt42sbhkgz@citrix.com> <20170326130435.t6ncmasbn766d6tg@citrix.com> <9F9E8099-DD6C-4CCA-BF4E-29759006C0C2@gmail.com> <20170328115439.jbm3qq2jdvnsm36e@citrix.com> <20170329104118.g2gj6grorjptfsve@citrix.com> From: Felix Schmoll Date: Wed, 29 Mar 2017 16:24:15 +0200 Message-ID: To: Wei Liu Cc: xen-devel@lists.xenproject.org Subject: Re: [Xen-devel] [GSoC] GSoC Introduction : Fuzzing Xen hypercall interface X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, here the final patch for the domain_id: Felix 2017-03-29 12:41 GMT+02:00 Wei Liu : > On Wed, Mar 29, 2017 at 07:52:47AM +0200, Felix Schmoll wrote: > > > > > > Yes. That would be good. > > > > > > > I'm free every afternoon this week (German time, I suppose you're in > > Europe), so just let me know at least three hours in advance when you're > > free > > to have a chat. > > > > I can do 4-5pm today and tomorrow. Please join #xendevel on freenode. > > Wei. > diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 2d97d36c38..1e152c8a07 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1569,6 +1569,7 @@ int xc_domctl(xc_interface *xch, struct xen_domctl *domctl); int xc_sysctl(xc_interface *xch, struct xen_sysctl *sysctl); int xc_version(xc_interface *xch, int cmd, void *arg); +int xc_domid(xc_interface *xch); int xc_flask_op(xc_interface *xch, xen_flask_op_t *op); diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index 72e6242417..37b11e41a9 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -530,6 +530,12 @@ int xc_version(xc_interface *xch, int cmd, void *arg) return rc; } +int xc_domid(xc_interface *xch) +{ + return xencall0(xch->xcall, __HYPERVISOR_domain_id); +} + + unsigned long xc_make_page_below_4G( xc_interface *xch, uint32_t domid, unsigned long mfn) { diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 614501f761..eddb264f2d 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1297,6 +1297,7 @@ static arm_hypercall_t arm_hypercall_table[] = { HYPERCALL(platform_op, 1), HYPERCALL_ARM(vcpu_op, 3), HYPERCALL(vm_assist, 2), + HYPERCALL(domain_id, 0), }; #ifndef NDEBUG diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index e7238ce293..3d541e01e1 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -132,6 +132,7 @@ static const hypercall_table_t hvm_hypercall_table[] = { COMPAT_CALL(mmuext_op), HYPERCALL(xenpmu_op), COMPAT_CALL(dm_op), + HYPERCALL(domain_id), HYPERCALL(arch_1) }; diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c index e30181817a..184741bf16 100644 --- a/xen/arch/x86/hypercall.c +++ b/xen/arch/x86/hypercall.c @@ -67,6 +67,7 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] = ARGS(tmem_op, 1), ARGS(xenpmu_op, 2), ARGS(dm_op, 3), + ARGS(domain_id, 0), ARGS(mca, 1), ARGS(arch_1, 1), }; diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index 9d29d2f088..f12314b5ca 100644 --- a/xen/arch/x86/pv/hypercall.c +++ b/xen/arch/x86/pv/hypercall.c @@ -79,6 +79,7 @@ static const hypercall_table_t pv_hypercall_table[] = { #endif HYPERCALL(xenpmu_op), COMPAT_CALL(dm_op), + HYPERCALL(domain_id), HYPERCALL(mca), HYPERCALL(arch_1), }; diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 84618715dc..5107aacd06 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -431,6 +431,12 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) return -ENOSYS; } +DO(domain_id)(void) +{ + struct domain *d = current->domain; + return d->domain_id; +} + DO(nmi_op)(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { struct xennmi_callback cb; diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 91ba8bb48e..4ad62aa01b 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -121,6 +121,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); #define __HYPERVISOR_xc_reserved_op 39 /* reserved for XenClient */ #define __HYPERVISOR_xenpmu_op 40 #define __HYPERVISOR_dm_op 41 +#define __HYPERVISOR_domain_id 42 /* custom hypercall */ /* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48 diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index cc99aea57d..5c7bc6233e 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -83,6 +83,9 @@ do_xen_version( XEN_GUEST_HANDLE_PARAM(void) arg); extern long +do_domain_id(void); + +extern long do_console_io( int cmd, int count,