All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
	andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com,
	mpohlack@amazon.de, xen-devel@lists.xenproject.org,
	dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v3 1/3] xsm/xen_version: Add XSM for the xen_version hypercall (v6).
Date: Tue, 12 Jan 2016 09:08:03 -0700	[thread overview]
Message-ID: <569532F302000078000C6017@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1452219920-14043-2-git-send-email-konrad.wilk@oracle.com>

>>> On 08.01.16 at 03:25, <konrad.wilk@oracle.com> wrote:
> @@ -226,9 +227,10 @@ void __init do_initcalls(void)
>  /*
>   * Simple hypercalls.
>   */
> -
>  DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>  {
> +    bool_t deny = !!xsm_version_op(XSM_OTHER, cmd);
> +
>      switch ( cmd )
>      {
>      case XENVER_version:
> @@ -354,10 +356,17 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          return 0;
>  
>      case XENVER_commandline:
> -        if ( copy_to_guest(arg, saved_cmdline, ARRAY_SIZE(saved_cmdline)) )
> +    {
> +        size_t len = ARRAY_SIZE(saved_cmdline);
> +
> +        if ( deny )
> +            len = strlen(xen_deny()) + 1;
> +
> +        if ( copy_to_guest(arg, deny ? xen_deny() : saved_cmdline, len) )
>              return -EFAULT;
>          return 0;
>      }
> +    }
>  
>      return -ENOSYS;
>  }

As said before, I don't think it is appropriate for "deny" to be
ignored for all other sub-ops when there is a designated policy.

> --- a/xen/common/version.c
> +++ b/xen/common/version.c
> @@ -55,3 +55,8 @@ const char *xen_banner(void)
>  {
>      return XEN_BANNER;
>  }
> +
> +const char *xen_deny(void)
> +{
> +    return "<denied>\0";
> +}

There's still this strange extra NUL character here.

> @@ -1621,6 +1622,28 @@ static int flask_pmu_op (struct domain *d, unsigned int op)
>  }
>  #endif /* CONFIG_X86 */
>  
> +static int flask_version_op (uint32_t op)
> +{
> +    u32 dsid = domain_sid(current->domain);
> +
> +    switch ( op )
> +    {
> +    case XENVER_version:
> +    case XENVER_extraversion:
> +    case XENVER_compile_info:
> +    case XENVER_capabilities:
> +    case XENVER_changeset:
> +    case XENVER_platform_parameters:
> +    case XENVER_get_features:
> +    case XENVER_pagesize:
> +    case XENVER_guest_handle:
> +        return 0; /* These MUST always be accessible to guests. */
> +    default:
> +        return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_XEN2,
> +                            XEN2__VERSION_PRIV, NULL);
> +    }
> +}

And along with the comment above, I don't think there should be
a switch statement here, but instead "op" should be subjected to
policy restrictions.

Jan

  parent reply	other threads:[~2016-01-12 16:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08  2:25 [PATCH v3] Add build-id to XENVER hypercall Konrad Rzeszutek Wilk
2016-01-08  2:25 ` [PATCH v3 1/3] xsm/xen_version: Add XSM for the xen_version hypercall (v6) Konrad Rzeszutek Wilk
2016-01-08 17:57   ` Daniel De Graaf
2016-01-12 16:08   ` Jan Beulich [this message]
2016-01-08  2:25 ` [PATCH v3 2/3] XENVER_build_id: Provide ld-embedded build-ids (v8) Konrad Rzeszutek Wilk
2016-01-12 16:25   ` Jan Beulich
2016-01-12 16:43     ` Konrad Rzeszutek Wilk
2016-01-12 17:00       ` Jan Beulich
2016-01-14  2:02         ` Konrad Rzeszutek Wilk
2016-01-14  8:58           ` Jan Beulich
2016-01-14  9:07             ` Martin Pohlack
2016-01-14  9:14               ` Jan Beulich
2016-01-25 15:16         ` Konrad Rzeszutek Wilk
2016-01-25 16:10           ` Jan Beulich
2016-01-15 21:49     ` Konrad Rzeszutek Wilk
2016-01-18  8:51       ` Jan Beulich
2016-01-19 16:05         ` Konrad Rzeszutek Wilk
2016-01-19 16:36           ` Jan Beulich
2016-01-19 16:47             ` Konrad Rzeszutek Wilk
2016-02-17 11:37   ` Ian Jackson
2016-01-08  2:25 ` [PATCH v3 3/3] libxl: info: Display build_id of the hypervisor Konrad Rzeszutek Wilk
2016-01-11 14:12   ` Wei Liu
2016-01-14  2:58     ` Konrad Rzeszutek Wilk

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=569532F302000078000C6017@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.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.