All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	ian.campbell@citrix.com, xen-devel@lists.xenproject.org,
	wei.liu2@citrix.com, ian.jackson@eu.citrix.com,
	jbeulich@suse.com, mpohlack@amazon.de, dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v1 1/4] xsm/libxl/xen_version: Add XSM for some of the xen_version commands.
Date: Fri, 9 Oct 2015 13:20:54 +0100	[thread overview]
Message-ID: <5617B126.2060205@citrix.com> (raw)
In-Reply-To: <1444359390-14153-2-git-send-email-konrad.wilk@oracle.com>

On 09/10/15 03:56, Konrad Rzeszutek Wilk wrote:
> The XENVER_[compile_info|changeset|commandline] are now
> guarded by an XSM check.
>
> The rest: XENVER_[version|extraversion|capabilities|
> parameters|get_features|page_size|guest_handle] behave
> as before (no XSM check).
>
> We allow the initial domain to see these while the other
> guests are not permitted.
>
> As such we also modify the toolstack such that if we fail
> to get any data instead of printing (null) we just print "".
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  tools/flask/policy/policy/modules/xen/xen.te |  2 +-
>  tools/libxl/libxl.c                          |  3 +++
>  xen/common/kernel.c                          | 11 ++++++++++-
>  xen/include/xsm/dummy.h                      | 24 ++++++++++++++++++++++++
>  xen/include/xsm/xsm.h                        |  6 ++++++
>  xen/xsm/dummy.c                              |  1 +
>  xen/xsm/flask/hooks.c                        | 25 +++++++++++++++++++++++++
>  xen/xsm/flask/policy/access_vectors          |  2 ++
>  8 files changed, 72 insertions(+), 2 deletions(-)
>
> diff --git a/tools/flask/policy/policy/modules/xen/xen.te b/tools/flask/policy/policy/modules/xen/xen.te
> index d35ae22..d0ad758 100644
> --- a/tools/flask/policy/policy/modules/xen/xen.te
> +++ b/tools/flask/policy/policy/modules/xen/xen.te
> @@ -86,7 +86,7 @@ allow dom0_t dom0_t:domain {
>  };
>  allow dom0_t dom0_t:domain2 {
>  	set_cpuid gettsc settsc setscheduler set_max_evtchn set_vnumainfo
> -	get_vnumainfo psr_cmt_op psr_cat_op
> +	get_vnumainfo psr_cmt_op psr_cat_op version_use
>  };
>  allow dom0_t dom0_t:resource { add remove };
>  
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 22bbc29..efa6462 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -5272,6 +5272,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
>      xc_version(ctx->xch, XENVER_extraversion, &u.xen_extra);
>      info->xen_version_extra = strdup(u.xen_extra);
>  
> +    memset(&u.xen_cc, 0, sizeof(xen_compile_info_t));

FILLZERO()

>      xc_version(ctx->xch, XENVER_compile_info, &u.xen_cc);
>      info->compiler = strdup(u.xen_cc.compiler);
>      info->compile_by = strdup(u.xen_cc.compile_by);
> @@ -5281,6 +5282,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
>      xc_version(ctx->xch, XENVER_capabilities, &u.xen_caps);
>      info->capabilities = strdup(u.xen_caps);
>  
> +    memset(&u.xen_cc, 0, sizeof(xen_changeset_info_t));
>      xc_version(ctx->xch, XENVER_changeset, &u.xen_chgset);
>      info->changeset = strdup(u.xen_chgset);
>  
> @@ -5289,6 +5291,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
>  
>      info->pagesize = xc_version(ctx->xch, XENVER_pagesize, NULL);
>  
> +    memset(&u.xen_commandline, 0, sizeof(xen_commandline_t));
>      xc_version(ctx->xch, XENVER_commandline, &u.xen_commandline);
>      info->commandline = strdup(u.xen_commandline);
>  
> diff --git a/xen/common/kernel.c b/xen/common/kernel.c
> index 6a3196a..210ec99 100644
> --- a/xen/common/kernel.c
> +++ b/xen/common/kernel.c
> @@ -13,6 +13,7 @@
>  #include <xen/nmi.h>
>  #include <xen/guest_access.h>
>  #include <xen/hypercall.h>
> +#include <xsm/xsm.h>
>  #include <asm/current.h>
>  #include <public/nmi.h>
>  #include <public/version.h>
> @@ -226,9 +227,17 @@ void __init do_initcalls(void)
>  /*
>   * Simple hypercalls.
>   */
> -
> +#define XENVER_CMD_XSM_CHECK    ( (1U << XENVER_compile_info) | \
> +                                  (1U << XENVER_changeset) | \
> +                                  (1U << XENVER_commandline) )
>  DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>  {
> +    if ( ( 1 << cmd ) & XENVER_CMD_XSM_CHECK )
> +    {
> +        int rc = xsm_version_op(XSM_PRIV, cmd);
> +        if ( rc )
> +            return rc;

This call should be unconditional.  It is not going to make a
measureable difference on XENVER_version latency.

~Andrew

  parent reply	other threads:[~2015-10-09 12:20 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09  2:56 [PATCH v1] Add build-id to XENVER hypercall Konrad Rzeszutek Wilk
2015-10-09  2:56 ` [PATCH v1 1/4] xsm/libxl/xen_version: Add XSM for some of the xen_version commands Konrad Rzeszutek Wilk
2015-10-09  9:31   ` Ian Campbell
2015-10-30 10:24     ` Martin Pohlack
2015-10-09 12:20   ` Andrew Cooper [this message]
2015-10-30 10:24   ` Martin Pohlack
2015-10-09  2:56 ` [PATCH v1 2/4] xen-version: Add third parameter (len) to the do_version hypercall Konrad Rzeszutek Wilk
2015-10-09  8:25   ` Jan Beulich
2015-10-09 12:29     ` Andrew Cooper
2015-10-09 12:46       ` Ian Campbell
2015-10-09 12:58         ` Andrew Cooper
2015-10-09 14:38         ` Jan Beulich
2015-10-09 14:48           ` Ian Campbell
2015-10-28 17:55           ` Konrad Rzeszutek Wilk
2015-10-28 18:34             ` Andrew Cooper
2015-10-28 18:58               ` Konrad Rzeszutek Wilk
2015-10-29  9:06               ` Jan Beulich
2015-10-09  2:56 ` [PATCH v1 3/4] XENVER_build_id: Provide ld-embedded build-ids Konrad Rzeszutek Wilk
2015-10-09  9:35   ` Ian Campbell
2015-10-09 11:40   ` Martin Pohlack
2015-10-09 12:47   ` Andrew Cooper
2015-10-09 15:18   ` Jan Beulich
2016-01-06 18:07     ` Konrad Rzeszutek Wilk
2015-10-09  2:56 ` [PATCH v1 4/4] libxl: info: Display build_id of the hypervisor Konrad Rzeszutek Wilk
2015-10-09  9:36   ` Ian Campbell
2015-10-09 12:59   ` Andrew Cooper
2015-10-09 13:06     ` Ian Campbell
2015-10-09 13:11       ` Andrew Cooper
2015-10-09 13:14       ` Ian Campbell
2015-10-09 13:16   ` Ian Campbell
2015-10-09  8:17 ` [PATCH v1] Add build-id to XENVER hypercall Jan Beulich
2015-10-09 12:15   ` Andrew Cooper
2015-10-09 13:25     ` Konrad Rzeszutek Wilk
2015-10-09 15:14       ` Jan Beulich
2015-10-28 15:42         ` Konrad Rzeszutek Wilk
2015-10-28 19:00           ` Konrad Rzeszutek Wilk
2015-10-29  8:55             ` Jan Beulich
2015-10-29 19:47               ` Konrad Rzeszutek Wilk
2015-10-30  8:11                 ` Jan Beulich
2015-10-09 14:32     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5617B126.2060205@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=mpohlack@amazon.de \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.