All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, Xin Li <talons.lee@gmail.com>
Cc: Sergey Dyasli <sergey.dyasli@citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Xin Li <xin.li@citrix.com>, Tim Deegan <tim@xen.org>,
	xen-devel@lists.xen.org, Ming Lu <ming.lu@citrix.com>,
	Daniel de Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH 2/2] xen/xsm: Add new SILO mode for XSM
Date: Fri, 29 Jun 2018 04:36:05 -0600	[thread overview]
Message-ID: <5B360B9502000078001CF112@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <20180629092810.25993-2-xin.li@citrix.com>

>>> On 29.06.18 at 11:28, <talons.lee@gmail.com> wrote:
> When SILO is enabled, there would be no page-sharing between
> unprivileged VMs (no grant tables or event channels).

What is the relation between page sharing and event channels?

> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -143,6 +143,17 @@ config XSM_FLASK_POLICY
>  
>  	  If unsure, say Y.
>  
> +config XSM_SILO
> +	def_bool y
> +	prompt "SILO support"
> +	depends on XSM
> +	---help---
> +	  Enables SILO as the access control mechanism used by the XSM framework.
> +	  This will deny any unmediated communication channels between unprivileged
> +	  VMs.
> +
> +	  If unsure, say Y.

It would be helpful to clarify here that this is not the default mode of
operation. In fact, another Kconfig (choice) might be useful to have to
select the built-in default. In fact "deny any" suggests that this is what
is going to happen regardless of command line options. At the very
least I think this wants to be "This will allow to deny any ..." or "In this
mode, any ... will by denied".

Andrew, the chosen name here may underline the relevance of my
comment regarding XSM_FLASK vs just FLASK, albeit things are
unclear/ambiguous if I also take into account the code further down.
The descriptions above make it sound as if this was an override to
whatever access control mechanism was in place (dummy or flask
currently). Code below suggests though that this is meant to be a
clone of dummy, with just some minimal adjustments. I guess it's
rather the description that needs adjustment, but the alternative
of being a global override even in FLASK mode certainly exists.

Furthermore it is unclear here what an "unmediated communication
channel" is, and what "mediated communication channels" (if any)
are still available in this new mode.

> --- /dev/null
> +++ b/xen/xsm/silo.c
> @@ -0,0 +1,106 @@
> +/******************************************************************************
> + * xsm/silo.c
> + *
> + * SILO module for XSM(Xen Security Modules)
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; If not, see <http://www.gnu.org/licenses/>.
> + *
> + * Copyright (c) 2018 Citrix Systems Ltd.
> + */
> +
> +#include <xen/sched.h>
> +#include <xsm/xsm.h>
> +
> +struct xsm_operations silo_xsm_ops;
> +
> +/*
> + * check if inter-domain communication is allowed
> + * return true when pass check
> + */

Uppercase first letter please, and I'd prefer if you also put a full stop here.

> +static bool silo_mode_dom_check(domid_t ldom, domid_t rdom)
> +{
> +    domid_t hd_dom = hardware_domain->domain_id;

I don't think you mean the hardware domain here, but the control domain
(of which in theory there may be multiple).

> +    domid_t cur_dom = current->domain->domain_id;
> +
> +    if ( ldom == DOMID_SELF )
> +        ldom = cur_dom;
> +    if ( rdom == DOMID_SELF )
> +        rdom = cur_dom;
> +
> +    return (hd_dom == cur_dom || hd_dom == ldom || hd_dom == rdom ||
> +            ldom == rdom);
> +}
> +
> +static int silo_evtchn_unbound(struct domain *d1, struct evtchn *chn,
> +                               domid_t id2)
> +{
> +    if ( silo_mode_dom_check(d1->domain_id, id2) )
> +        return dummy_xsm_ops.evtchn_unbound(d1, chn, id2);

Urgh. Why is this not xsm_evtchn_unbound() from dummy.h? It would be
really nice to avoid such extra indirect calls here.

Furthermore, this hook is called in two contexts. Is the above really
appropriate also in the alloc_unbound_xen_event_channel() case?

> +static int silo_grant_mapref(struct domain *d1, struct domain *d2,
> +                             uint32_t flags)
> +{
> +    if ( silo_mode_dom_check(d1->domain_id, d2->domain_id) )
> +        return dummy_xsm_ops.grant_mapref(d1, d2, flags);
> +    return -EPERM;
> +}

What about the unmap counterpart?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-06-29 10:36 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  9:28 [PATCH 1/2] xen/xsm: Introduce new boot parameter xsm Xin Li
2018-06-29  9:28 ` [PATCH 2/2] xen/xsm: Add new SILO mode for XSM Xin Li
2018-06-29  9:51   ` Andrew Cooper
2018-07-02  6:42     ` Xin Li (Talons)
2018-06-29 10:36   ` Jan Beulich [this message]
2018-07-02  6:57     ` Xin Li (Talons)
2018-07-02  7:28       ` Jan Beulich
2018-07-02  9:22         ` Xin Li (Talons)
2018-07-02  9:38           ` Jan Beulich
2018-07-23 10:45             ` Xin Li (Talons)
2018-07-24  7:49               ` Jan Beulich
2018-07-24  8:18             ` Xin Li (Talons)
2018-08-17 19:25               ` Daniel De Graaf
2018-06-29 13:21   ` Julien Grall
2018-07-02  6:41     ` Xin Li (Talons)
2018-06-29  9:47 ` [PATCH 1/2] xen/xsm: Introduce new boot parameter xsm Andrew Cooper
2018-06-29 10:04   ` Jan Beulich
2018-07-02  7:34     ` Xin Li (Talons)
2018-07-02  8:24       ` Jan Beulich
2018-07-02  8:39         ` Xin Li (Talons)
2018-07-02  9:04           ` Jan Beulich
2018-07-02  7:21   ` Xin Li (Talons)
2018-07-03  1:26 Xin Li
2018-07-03  1:26 ` [PATCH 2/2] xen/xsm: Add new SILO mode for XSM Xin Li
2018-07-03  7:33   ` Jan Beulich
2018-07-03  9:07     ` Xin Li (Talons)
2018-07-03 10:15       ` Jan Beulich
2018-07-03 10:53         ` Xin Li (Talons)
2018-09-28  8:18 [PATCH 1/2] xen/xsm: Introduce new boot parameter xsm Xin Li
2018-09-28  8:18 ` [PATCH 2/2] xen/xsm: Add new SILO mode for XSM Xin Li
2018-09-28 17:24   ` Daniel De Graaf
2018-09-29  9:22 [PATCH 1/2] xen/xsm: Introduce new boot parameter xsm Xin Li
2018-09-29  9:22 ` [PATCH 2/2] xen/xsm: Add new SILO mode for XSM Xin Li
2018-10-02  9:33   ` Jan Beulich
2018-10-08  7:49     ` Xin Li (Talons)
2018-10-08  8:28       ` 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=5B360B9502000078001CF112@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ming.lu@citrix.com \
    --cc=sergey.dyasli@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=talons.lee@gmail.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xin.li@citrix.com \
    /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.