linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found] <E1XCqEY-0005zn-RQ@lists.xen.org>
@ 2014-07-31 13:53 ` Ian Campbell
       [not found] ` <1406814787.10395.2.camel@kazak.uk.xensource.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2014-07-31 13:53 UTC (permalink / raw)
  To: Frediano Ziglio
  Cc: linux-api, linux-kernel, David Vrabel, xen-devel, Boris Ostrovsky

On Thu, 2014-07-31 at 14:16 +0100, Frediano Ziglio wrote:

>  include/xen/interface/domctl.h     | 1090 ++++++++++++++++++++++++++++++++++++

domctl is an stable toolstack only hypervisor interface, so the kernel
cannot use it because it would then break.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found] ` <1406814787.10395.2.camel@kazak.uk.xensource.com>
@ 2014-07-31 14:11   ` David Vrabel
       [not found]   ` <E1XCr4q-0007Nh-3J@lists.xen.org>
       [not found]   ` <E1XCr4p-0007Nh-Qu@lists.xen.org>
  2 siblings, 0 replies; 8+ messages in thread
From: David Vrabel @ 2014-07-31 14:11 UTC (permalink / raw)
  To: Ian Campbell, Frediano Ziglio
  Cc: xen-devel, Boris Ostrovsky, linux-api, linux-kernel

On 31/07/14 14:53, Ian Campbell wrote:
> On Thu, 2014-07-31 at 14:16 +0100, Frediano Ziglio wrote:
> 
>>  include/xen/interface/domctl.h     | 1090 ++++++++++++++++++++++++++++++++++++
> 
> domctl is an stable toolstack only hypervisor interface, so the kernel
> cannot use it because it would then break.

Ok.  I guess we'll have to resurrect the idea to do something with XSM.

David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found]   ` <E1XCr4q-0007Nh-3J@lists.xen.org>
@ 2014-07-31 14:43     ` Frediano Ziglio
       [not found]     ` <1406817823.6753.4.camel@hamster.uk.xensource.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Frediano Ziglio @ 2014-07-31 14:43 UTC (permalink / raw)
  To: David Vrabel
  Cc: xen-devel, Boris Ostrovsky, Ian Campbell, linux-kernel, linux-api

On Thu, 2014-07-31 at 15:11 +0100, David Vrabel wrote:
> On 31/07/14 14:53, Ian Campbell wrote:
> > On Thu, 2014-07-31 at 14:16 +0100, Frediano Ziglio wrote:
> > 
> >>  include/xen/interface/domctl.h     | 1090 ++++++++++++++++++++++++++++++++++++
> > 
> > domctl is an stable toolstack only hypervisor interface, so the kernel
> > cannot use it because it would then break.
> 
> Ok.  I guess we'll have to resurrect the idea to do something with XSM.
> 
> David
> 

The code just require that:
- sizeof(struct xen_domctl) does not increase;
- position and size of cmd, domain and interface_version does not
change;
- XEN_DOMCTL_createdomain is 1.

For safety there is a check on interface_version.

Frediano

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found]     ` <1406817823.6753.4.camel@hamster.uk.xensource.com>
@ 2014-07-31 14:58       ` Ian Campbell
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2014-07-31 14:58 UTC (permalink / raw)
  To: Frediano Ziglio
  Cc: xen-devel, Boris Ostrovsky, David Vrabel, linux-kernel, linux-api

On Thu, 2014-07-31 at 15:43 +0100, Frediano Ziglio wrote:
> The code just require that:
> - sizeof(struct xen_domctl) does not increase;
> - position and size of cmd, domain and interface_version does not
> change;
> - XEN_DOMCTL_createdomain is 1.

This is not a stable interface, so you cannot actually rely on any of
those.

For the first one in particular its not that hard to imagine someone
needing a larger subop struct at some point.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xen-devel] [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found]     ` <E1XCr4p-0007Nh-Qu-GuqFBffKawuEi8DpZVb4nw@public.gmane.org>
@ 2014-07-31 17:49       ` George Dunlap
       [not found]         ` <CAFLBxZYnaeEGTbuU5QoKJOU62Ck9p_B53bjAd46Z7uVgOxXH8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: George Dunlap @ 2014-07-31 17:49 UTC (permalink / raw)
  To: David Vrabel
  Cc: Ian Campbell, Frediano Ziglio, xen-devel, Boris Ostrovsky,
	linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kernel

On Thu, Jul 31, 2014 at 10:11 AM, David Vrabel <david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> wrote:
> On 31/07/14 14:53, Ian Campbell wrote:
>> On Thu, 2014-07-31 at 14:16 +0100, Frediano Ziglio wrote:
>>
>>>  include/xen/interface/domctl.h     | 1090 ++++++++++++++++++++++++++++++++++++
>>
>> domctl is an stable toolstack only hypervisor interface, so the kernel
>> cannot use it because it would then break.
>
> Ok.  I guess we'll have to resurrect the idea to do something with XSM.

What kind of thing did you have in mind for XSM?

In general it seems like allowing a vcpu to switch into an XSM label
(not sure I've got the terminology right here) when it context
switches into a particular process might be the most flexible way for
that to work.

But would that actually be easier than implementing stub domains?

 -George

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xen-devel] [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found]         ` <CAFLBxZYnaeEGTbuU5QoKJOU62Ck9p_B53bjAd46Z7uVgOxXH8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-07-31 17:58           ` David Vrabel
  0 siblings, 0 replies; 8+ messages in thread
From: David Vrabel @ 2014-07-31 17:58 UTC (permalink / raw)
  To: George Dunlap
  Cc: Ian Campbell, Frediano Ziglio, xen-devel, Boris Ostrovsky,
	linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kernel

On 31/07/14 18:49, George Dunlap wrote:
> On Thu, Jul 31, 2014 at 10:11 AM, David Vrabel <david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> wrote:
>> On 31/07/14 14:53, Ian Campbell wrote:
>>> On Thu, 2014-07-31 at 14:16 +0100, Frediano Ziglio wrote:
>>>
>>>>  include/xen/interface/domctl.h     | 1090 ++++++++++++++++++++++++++++++++++++
>>>
>>> domctl is an stable toolstack only hypervisor interface, so the kernel
>>> cannot use it because it would then break.
>>
>> Ok.  I guess we'll have to resurrect the idea to do something with XSM.
> 
> What kind of thing did you have in mind for XSM?

A multicall-like hypercall that has an additional parameter for a handle
to a XSM context to use for the contained hypercalls.

> In general it seems like allowing a vcpu to switch into an XSM label
> (not sure I've got the terminology right here) when it context
> switches into a particular process might be the most flexible way for
> that to work.

I think we want something than can a different policy on a per-fd basis.

David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xen-devel] [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found] ` <E1XCqEY-0005zn-V2-GuqFBffKawuEi8DpZVb4nw@public.gmane.org>
@ 2014-08-01  8:27   ` Jan Beulich
       [not found]     ` <53DB6B8D02000078000284D3-tRfBTM6QL9aeHWOVceGJHFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2014-08-01  8:27 UTC (permalink / raw)
  To: Frediano Ziglio
  Cc: David Vrabel, xen-devel, Boris Ostrovsky, Konrad Rzeszutek Wilk,
	linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kernel

>>> On 31.07.14 at 15:16, <frediano.ziglio-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> wrote:
> Add a RESTRICT ioctl to /dev/xen/privcmd, which allows privileged commands
> file descriptor to be restricted to only working with a particular domain.

The "with" here has been quite confusing, and I realized that you
mean the subject domain rather than the actor one only after
having gone through quite some parts of the patch. For a patch
this size, a little more of a description (and the original motivation)
would have helped.

Wrt motivation: Why does this need enforcing in the kernel at all?
Doesn't XSM_DM_PRIV mode deal specifically with what you're
trying to do here? Or else I guess I really need some better
explanation of what this is about.

Jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xen-devel] [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain
       [not found]     ` <53DB6B8D02000078000284D3-tRfBTM6QL9aeHWOVceGJHFaTQe2KTcn/@public.gmane.org>
@ 2014-08-01 13:44       ` Frediano Ziglio
  0 siblings, 0 replies; 8+ messages in thread
From: Frediano Ziglio @ 2014-08-01 13:44 UTC (permalink / raw)
  To: Jan Beulich
  Cc: David Vrabel, xen-devel, Boris Ostrovsky, Konrad Rzeszutek Wilk,
	linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kernel

On Fri, 2014-08-01 at 09:27 +0100, Jan Beulich wrote:
> >>> On 31.07.14 at 15:16, <frediano.ziglio-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> wrote:
> > Add a RESTRICT ioctl to /dev/xen/privcmd, which allows privileged commands
> > file descriptor to be restricted to only working with a particular domain.
> 
> The "with" here has been quite confusing, and I realized that you
> mean the subject domain rather than the actor one only after
> having gone through quite some parts of the patch. For a patch
> this size, a little more of a description (and the original motivation)
> would have helped.
> 

Yes, you are right.

> Wrt motivation: Why does this need enforcing in the kernel at all?
> Doesn't XSM_DM_PRIV mode deal specifically with what you're
> trying to do here? Or else I guess I really need some better
> explanation of what this is about.
> 
> Jan
> 

This is quite old for me but you are right, perhaps is not that clear
for other people. In XenServer we have some patches that allow Qemu
running in dom0 but work only for a specific domain. The patches
required changes to libxc, kernel and Qemu. We are reimplementing these
patches as the old implementation has some problems (one is that the
patch for libxc was quite big). This feature was removed as kernel
patches did not work with newer (3.x) kernels.

Now, XSM_DM_PRIV works checking if the domain target is the domain we
are going to handle. However if your dom0 (as in XenServer) has all Qemu
to handle all VMs it cannot be bound to a single target so XSM is not
usable. Xen has no knowledge of process or file descriptor (which are
kernel specific) so there is actually no way it can distinguish which
domain should be restricted to. It would solve if the restriction would
be done for system call (so we can say execute this hypercall(s) with
these policies). However this require to change the target to be at
least CPU specific and handle preemption correctly in order to not mix
policies. This could be quite heavy so we hack the kernel in order to do
the restriction instead (it also was easier to port the patches).

Actually changes in Qemu to handle the privcmd/evtchn restrictions are
quite small, mainly restrict these two handles with an ioctl. Other
parts of the patch (chroot, setuid, groups, resource limits, and mostly
xenstore accesses) are more heavy.

Frediano

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-01 13:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1XCqEY-0005zn-RQ@lists.xen.org>
2014-07-31 13:53 ` [PATCH 1/2] xen: Implement ioctl to restrict privcmd to a specific domain Ian Campbell
     [not found] ` <1406814787.10395.2.camel@kazak.uk.xensource.com>
2014-07-31 14:11   ` David Vrabel
     [not found]   ` <E1XCr4q-0007Nh-3J@lists.xen.org>
2014-07-31 14:43     ` Frediano Ziglio
     [not found]     ` <1406817823.6753.4.camel@hamster.uk.xensource.com>
2014-07-31 14:58       ` Ian Campbell
     [not found]   ` <E1XCr4p-0007Nh-Qu@lists.xen.org>
     [not found]     ` <E1XCr4p-0007Nh-Qu-GuqFBffKawuEi8DpZVb4nw@public.gmane.org>
2014-07-31 17:49       ` [Xen-devel] " George Dunlap
     [not found]         ` <CAFLBxZYnaeEGTbuU5QoKJOU62Ck9p_B53bjAd46Z7uVgOxXH8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-31 17:58           ` David Vrabel
     [not found] <E1XCqEY-0005zn-V2@lists.xen.org>
     [not found] ` <E1XCqEY-0005zn-V2-GuqFBffKawuEi8DpZVb4nw@public.gmane.org>
2014-08-01  8:27   ` Jan Beulich
     [not found]     ` <53DB6B8D02000078000284D3-tRfBTM6QL9aeHWOVceGJHFaTQe2KTcn/@public.gmane.org>
2014-08-01 13:44       ` Frediano Ziglio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).