All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Juergen Gross <jgross@suse.com>, <linux-kernel@vger.kernel.org>,
	<xen-devel@lists.xenproject.org>
Cc: <boris.ostrovsky@oracle.com>
Subject: Re: [Xen-devel] [PATCH 4/4] xen: select grant interface version
Date: Tue, 12 Sep 2017 19:54:22 +0100	[thread overview]
Message-ID: <b733a132-e3a8-d096-a015-f1762165cc21@citrix.com> (raw)
In-Reply-To: <20170908144849.2958-5-jgross@suse.com>

On 08/09/17 15:48, Juergen Gross wrote:
>  static void gnttab_request_version(void)
>  {
> -	int rc;
> +	long rc;
>  	struct gnttab_set_version gsv;
>  
> -	gsv.version = 1;
> +	rc = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);

This hypercall is information leak and layering violation.  Please can
we avoid adding more dependence on its presence?  (I'm got a
proto-series which strips various corners off the hypervisor for attack
surface reduction purposes, and this hypercall is one victim which is
restricted to privileged domains only.)

For translated guests, it is definitely not the right number to check. 
What matters is the maximum frame inside the translated guest, not on
the host.

For PV guests, I'm not sure what to suggest, but the result of
XENMEM_maximum_ram_page isn't applicable.  Xen's max_page can increase
at runtime through memory hotplug, after which ballooning operations can
leave Linux with a frame it wishes to grant which exceeds the limit
calculated here.

The more I look into this, the more of a mess it turns out to be.

~Andrew

> +	if (rc < 0 || !(rc >> 32))
> +		gsv.version = 1;
> +	else
> +		gsv.version = 2;
> +	if (xen_gnttab_version >= 1 && xen_gnttab_version <= 2)
> +		gsv.version = xen_gnttab_version;
>  
>  	rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);
>  	if (rc == 0 && gsv.version == 2)

  parent reply	other threads:[~2017-09-12 18:54 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08 14:48 [PATCH 0/4] xen: grant table interface v2 support Juergen Gross
2017-09-08 14:48 ` [PATCH 1/4] xen: re-introduce support for grant v2 interface Juergen Gross
2017-09-08 14:48   ` Juergen Gross
2017-09-12 15:41   ` Boris Ostrovsky
2017-09-12 15:41   ` [Xen-devel] " Boris Ostrovsky
2017-09-12 15:45     ` Juergen Gross
2017-09-12 15:45       ` Juergen Gross
2017-09-08 14:48 ` [PATCH 2/4] xen: limit grant v2 interface to the v1 functionality Juergen Gross
2017-09-08 14:48 ` Juergen Gross
2017-09-12 15:44   ` Boris Ostrovsky
2017-09-12 15:44   ` Boris Ostrovsky
2017-09-12 15:50     ` Juergen Gross
2017-09-12 15:50       ` Juergen Gross
2017-09-12 16:05       ` Boris Ostrovsky
2017-09-12 16:05       ` Boris Ostrovsky
2017-09-12 16:09         ` Juergen Gross
2017-09-12 16:21           ` Boris Ostrovsky
2017-09-12 16:21           ` Boris Ostrovsky
2017-09-12 18:18             ` Juergen Gross
2017-09-12 18:18             ` Juergen Gross
2017-09-13 13:22               ` Boris Ostrovsky
2017-09-13 13:38                 ` Juergen Gross
2017-09-13 13:50                   ` Boris Ostrovsky
2017-09-13 13:50                     ` Boris Ostrovsky
2017-09-13 14:45                     ` Juergen Gross
2017-09-13 16:20                       ` Boris Ostrovsky
2017-09-13 16:20                       ` Boris Ostrovsky
2017-09-14  8:13                         ` Juergen Gross
2017-09-14  8:13                         ` Juergen Gross
2017-09-13 14:45                     ` Juergen Gross
2017-09-13 13:38                 ` Juergen Gross
2017-09-13 13:22               ` Boris Ostrovsky
2017-09-12 16:09         ` Juergen Gross
2017-09-08 14:48 ` [PATCH 3/4] xen: add grant interface version dependent constants to gnttab_ops Juergen Gross
2017-09-12 16:02   ` Boris Ostrovsky
2017-09-12 16:02   ` Boris Ostrovsky
2017-09-08 14:48 ` Juergen Gross
2017-09-08 14:48 ` [PATCH 4/4] xen: select grant interface version Juergen Gross
2017-09-08 14:48 ` Juergen Gross
2017-09-12 16:21   ` Boris Ostrovsky
2017-09-12 16:21   ` [Xen-devel] " Boris Ostrovsky
2017-09-12 18:54   ` Andrew Cooper [this message]
2017-09-13  9:23     ` Juergen Gross
2017-09-15 13:00       ` Juergen Gross
2017-09-15 13:00       ` [Xen-devel] " Juergen Gross
2017-09-15 13:21         ` Jan Beulich
2017-09-15 13:21         ` [Xen-devel] " Jan Beulich
     [not found]         ` <59BBEFFC020000780017B8EF@suse.com>
2017-09-15 13:27           ` Juergen Gross
2017-09-15 13:27           ` [Xen-devel] " Juergen Gross
2017-09-13  9:23     ` Juergen Gross
2017-09-12 18:54   ` Andrew Cooper

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=b733a132-e3a8-d096-a015-f1762165cc21@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --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.