Skip to contentSkip to conversation

common/gnttab: Introduce command line feature controls

PATCH In review Andrew Cooper 4 participants 17 messages Aug 24, 2017 – Aug 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/gnttab: Introduce command line feature controls

This patch was originally a workaround for XSA-226. Since then, transitive grants are believed to be functioning properly, and the defaults have changed appropriately.

However, for those people who chose to use the workaround (especially from an attack surface mitigation point of view), retain the ability for the host administrator to choose.

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>

---
 docs/misc/xen-command-line.markdown | 13 +++++++++++
 xen/common/grant_table.c            | 44 +++++++++++++++++++++++++++++++++++--
 2 files changed, 55 insertions(+), 2 deletions(-)
docs/misc/xen-command-line.markdown +13 -0
index 4002eab..78c7b51 100644
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.
+
 ### gnttab\_max\_frames
 > `= <integer>`
 
xen/common/grant_table.c +42 -2

62 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 31 lines · Andrew Cooper

This patch was originally a workaround for XSA-226. Since then, transitive grants are believed to be functioning properly, and the defaults have changed appropriately.

However, for those people who chose to use the workaround (especially from an attack surface mitigation point of view), retain the ability for the host administrator to choose.

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>

---
 docs/misc/xen-command-line.markdown | 13 +++++++++++
 xen/common/grant_table.c            | 44 +++++++++++++++++++++++++++++++++++--
 2 files changed, 55 insertions(+), 2 deletions(-)
docs/misc/xen-command-line.markdown +2 -0
index 4002eab..78c7b51 100644
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 10 lines
docs/misc/xen-command-line.markdown +10 -0
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 9 lines
docs/misc/xen-command-line.markdown +1 -0
+
 ### gnttab\_max\_frames
 > `= <integer>`
 
xen/common/grant_table.c +0 -0
index 36895aa..f9c313d 100644

xen/common/grant_table.c integer_param("gnttab_max_nr_frames", max_nr_grant_frames); · line 56

Quoted 7 lines
xen/common/grant_table.c +4 -0
@@ -50,6 +50,42 @@ integer_param("gnttab_max_nr_frames", max_nr_grant_frames);
 unsigned int __read_mostly max_grant_frames;
 integer_param("gnttab_max_frames", max_grant_frames);
 
+static unsigned int __read_mostly opt_gnttab_max_version = 2;
+static bool __read_mostly opt_transitive_grants = true;
+
+static void __init parse_gnttab(char *s)

Do you mind using:

static int __init parse_gnttab(const char *s)

in order to comply with my runtime parameter series?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 30 lines · Juergen Gross
Quoted 29 lines · Andrew Cooper

This patch was originally a workaround for XSA-226. Since then, transitive grants are believed to be functioning properly, and the defaults have changed appropriately.

However, for those people who chose to use the workaround (especially from an attack surface mitigation point of view), retain the ability for the host administrator to choose.

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>

---
 docs/misc/xen-command-line.markdown | 13 +++++++++++
 xen/common/grant_table.c            | 44 +++++++++++++++++++++++++++++++++++--
 2 files changed, 55 insertions(+), 2 deletions(-)
docs/misc/xen-command-line.markdown +0 -0
index 4002eab..78c7b51 100644
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

The reason this workaround was so effective, and why several large users still wish to clobber them, is because nothing uses transitive grants.

Quoted 19 lines
Quoted 10 lines
docs/misc/xen-command-line.markdown +1 -0
+
 ### gnttab\_max\_frames
 > `= <integer>`
 
xen/common/grant_table.c +0 -0
index 36895aa..f9c313d 100644

xen/common/grant_table.c integer_param("gnttab_max_nr_frames", max_nr_grant_frames); · line 56

Quoted 7 lines
xen/common/grant_table.c +4 -0
@@ -50,6 +50,42 @@ integer_param("gnttab_max_nr_frames", max_nr_grant_frames);
 unsigned int __read_mostly max_grant_frames;
 integer_param("gnttab_max_frames", max_grant_frames);
 
+static unsigned int __read_mostly opt_gnttab_max_version = 2;
+static bool __read_mostly opt_transitive_grants = true;
+
+static void __init parse_gnttab(char *s)

Do you mind using:

Quoted 3 lines

static int __init parse_gnttab(const char *s)

in order to comply with my runtime parameter series?

If the result will still compile. What should the semantics be? (I've had a quick look through your series, but I can't see the semantics stated anywhere obvious)

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 46 lines · Andrew Cooper
Quoted 30 lines · Juergen Gross
Quoted 29 lines · Andrew Cooper

This patch was originally a workaround for XSA-226. Since then, transitive grants are believed to be functioning properly, and the defaults have changed appropriately.

However, for those people who chose to use the workaround (especially from an attack surface mitigation point of view), retain the ability for the host administrator to choose.

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>

---
 docs/misc/xen-command-line.markdown | 13 +++++++++++
 xen/common/grant_table.c            | 44 +++++++++++++++++++++++++++++++++++--
 2 files changed, 55 insertions(+), 2 deletions(-)
docs/misc/xen-command-line.markdown +0 -0
index 4002eab..78c7b51 100644
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 1 line

Ideally yes, but how do you suggest doing this in a compatible way?

An ELF note in the guest kernel indicating it is aware of that possibility in order to allow v2 grants for that guest without transient grants?

Quoted 2 lines

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

So the only really compatible way would be to disallow v2 grants. OTOH I guess there aren't so many guests using v2 right now...

Quoted 2 lines

The reason this workaround was so effective, and why several large users still wish to clobber them, is because nothing uses transitive grants.

Right. And only very few guests use v2 grants.

Quoted 20 lines
Quoted 20 lines
Quoted 11 lines
docs/misc/xen-command-line.markdown +1 -0
+
 ### gnttab\_max\_frames
 > `= <integer>`
 
xen/common/grant_table.c +0 -0
index 36895aa..f9c313d 100644

xen/common/grant_table.c integer_param("gnttab_max_nr_frames", max_nr_grant_frames); · line 56

Quoted 7 lines
xen/common/grant_table.c +4 -0
@@ -50,6 +50,42 @@ integer_param("gnttab_max_nr_frames", max_nr_grant_frames);
 unsigned int __read_mostly max_grant_frames;
 integer_param("gnttab_max_frames", max_grant_frames);
 
+static unsigned int __read_mostly opt_gnttab_max_version = 2;
+static bool __read_mostly opt_transitive_grants = true;
+
+static void __init parse_gnttab(char *s)

Do you mind using:

Quoted 7 lines
Quoted 3 lines

static int __init parse_gnttab(const char *s)

in order to comply with my runtime parameter series?

If the result will still compile. What should the semantics be? (I've had a quick look through your series, but I can't see the semantics stated anywhere obvious)

The parsing routine must not change the parameter string and should return an error (e.g. -EINVAL) in case of an illegal parameter.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 51 lines · Juergen Gross
Quoted 45 lines · Andrew Cooper
Quoted 30 lines · Juergen Gross
Quoted 29 lines · Andrew Cooper

This patch was originally a workaround for XSA-226. Since then, transitive grants are believed to be functioning properly, and the defaults have changed appropriately.

However, for those people who chose to use the workaround (especially from an attack surface mitigation point of view), retain the ability for the host administrator to choose.

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>

---
 docs/misc/xen-command-line.markdown | 13 +++++++++++
 xen/common/grant_table.c            | 44 +++++++++++++++++++++++++++++++++++--
 2 files changed, 55 insertions(+), 2 deletions(-)
docs/misc/xen-command-line.markdown +0 -0
index 4002eab..78c7b51 100644
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 1 line

Ideally yes, but how do you suggest doing this in a compatible way?

An ELF note in the guest kernel indicating it is aware of that possibility in order to allow v2 grants for that guest without transient grants?

Quoted 8 lines
Quoted 2 lines

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

So the only really compatible way would be to disallow v2 grants. OTOH I guess there aren't so many guests using v2 right now...

Quoted 2 lines

The reason this workaround was so effective, and why several large users still wish to clobber them, is because nothing uses transitive grants.

Right. And only very few guests use v2 grants.

We tried disabling gnttab v2 by default first, which is why the max_ver:
parameter is present in this patch.

Some vendor versions of Linux refused to fall back from gnttab v2 to gnttab v1 on migrate, even though they are perfectly happy booting in a v1-only situation.

Also
https://github.com/xenserver/win-xenbus/blob/c2a60d437b42f2349361629f15275e4fabdcc22e/src/xenbus/gnttab.c#L566-L571
which was discovered out of the blue, when all windows guests installed on older versions of XenServer started turning blue.

Leaving v2 active and creating an ABI breakage turned out to be the viable way to inhibit the use of transitive grants in cases which needed to run arbitrary guests.

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 10 lines
docs/misc/xen-command-line.markdown +1 -0
+
 ### gnttab\_max\_frames
 > `= <integer>`
 
xen/common/grant_table.c +0 -0
index 36895aa..f9c313d 100644

xen/common/grant_table.c integer_param("gnttab_max_nr_frames", max_nr_grant_frames); · line 56

Quoted 7 lines
xen/common/grant_table.c +4 -0
@@ -50,6 +50,42 @@ integer_param("gnttab_max_nr_frames", max_nr_grant_frames);
 unsigned int __read_mostly max_grant_frames;
 integer_param("gnttab_max_frames", max_grant_frames);
 
+static unsigned int __read_mostly opt_gnttab_max_version = 2;
+static bool __read_mostly opt_transitive_grants = true;
+
+static void __init parse_gnttab(char *s)

Do you mind using:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

static int __init parse_gnttab(const char *s)

in order to comply with my runtime parameter series?

If the result will still compile. What should the semantics be? (I've had a quick look through your series, but I can't see the semantics stated anywhere obvious)

The parsing routine must not change the parameter string and should return an error (e.g. -EINVAL) in case of an illegal parameter.

Let me see what I can do.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
In reply to Andrew Cooper
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 17:16, <[email protected]> wrote:
Quoted 7 lines · Juergen Gross
Quoted 6 lines · Andrew Cooper
docs/misc/xen-command-line.markdown +0 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 4 lines

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

That workaround should not be used as an argument to not provide a way to query the capability. It was put in place knowing that it would cause problems for (hypothetical) guests using transitive grants.

I'm not sure Jürgen's ELF note suggestion would be very useful
though: I don't see how Xen knowing a guest kernel can deal with the situation would change anything - I don't think we should fail the loading of a kernel without such a note when transitive grants are disabled, not the least because we know of no kernels using them, and hence we'd pointlessly prevent the use of older kernels in such a case.

What about a negative XENFEAT_*? New code could query it, and existing code is hosed anyway if run on such a system.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 17:16, <[email protected]> wrote:
Quoted 21 lines · Juergen Gross
Quoted 8 lines · Andrew Cooper
docs/misc/xen-command-line.markdown +2 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 10 lines
docs/misc/xen-command-line.markdown +10 -0
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 8 lines
Quoted 4 lines

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

That workaround should not be used as an argument to not provide a way to query the capability. It was put in place knowing that it would cause problems for (hypothetical) guests using transitive grants.

I am not objecting to introducing a mechanism if a suitable one can be found.

However, the heritage of XSA-226 is a valid reason to not block this patch because a mechanism isn't present.

Quoted 11 lines

I'm not sure Jürgen's ELF note suggestion would be very useful
though: I don't see how Xen knowing a guest kernel can deal with the situation would change anything - I don't think we should fail the loading of a kernel without such a note when transitive grants are disabled, not the least because we know of no kernels using them, and hence we'd pointlessly prevent the use of older kernels in such a case.

What about a negative XENFEAT_*? New code could query it, and existing code is hosed anyway if run on such a system.

Better yet, how about combining it with Juergens "xen: add new hypercall to get grant table limits"?

We could have a features_available bitmap along with other gnttab related maxima.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 48 lines · Andrew Cooper
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 17:16, <[email protected]> wrote:
Quoted 21 lines · Juergen Gross
Quoted 8 lines · Andrew Cooper
docs/misc/xen-command-line.markdown +2 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 10 lines
docs/misc/xen-command-line.markdown +10 -0
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 8 lines
Quoted 4 lines

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

That workaround should not be used as an argument to not provide a way to query the capability. It was put in place knowing that it would cause problems for (hypothetical) guests using transitive grants.

I am not objecting to introducing a mechanism if a suitable one can be found.

However, the heritage of XSA-226 is a valid reason to not block this patch because a mechanism isn't present.

Quoted 9 lines

I'm not sure Jürgen's ELF note suggestion would be very useful
though: I don't see how Xen knowing a guest kernel can deal with the situation would change anything - I don't think we should fail the loading of a kernel without such a note when transitive grants are disabled, not the least because we know of no kernels using them, and hence we'd pointlessly prevent the use of older kernels in such a case.

Quoted 5 lines
Quoted 2 lines

What about a negative XENFEAT_*? New code could query it, and existing code is hosed anyway if run on such a system.

Better yet, how about combining it with Juergens "xen: add new hypercall to get grant table limits"?

I suspect this new hypercall has just been killed.

Quoted 2 lines

We could have a features_available bitmap along with other gnttab related maxima.

Feel free to recycle my patch then. :-)

OTOH XENFEAT_* might be just the place where such information should be made available.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw
In reply to Andrew Cooper
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 25.08.17 at 14:10, <[email protected]> wrote:
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 17:16, <[email protected]> wrote:
Quoted 21 lines · Juergen Gross
Quoted 8 lines · Andrew Cooper
docs/misc/xen-command-line.markdown +2 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 10 lines
docs/misc/xen-command-line.markdown +10 -0
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 8 lines
Quoted 4 lines

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

That workaround should not be used as an argument to not provide a way to query the capability. It was put in place knowing that it would cause problems for (hypothetical) guests using transitive grants.

Quoted 5 lines

I am not objecting to introducing a mechanism if a suitable one can be found.

However, the heritage of XSA-226 is a valid reason to not block this patch because a mechanism isn't present.

Code submission deadline for 4.10 isn't very far away; we shouldn't ship a major version with a partial workaround.

Quoted 8 lines
Quoted 8 lines

I'm not sure Jürgen's ELF note suggestion would be very useful
though: I don't see how Xen knowing a guest kernel can deal with the situation would change anything - I don't think we should fail the loading of a kernel without such a note when transitive grants are disabled, not the least because we know of no kernels using them, and hence we'd pointlessly prevent the use of older kernels in such a case.

Quoted 8 lines
Quoted 2 lines

What about a negative XENFEAT_*? New code could query it, and existing code is hosed anyway if run on such a system.

Better yet, how about combining it with Juergens "xen: add new hypercall to get grant table limits"?

We could have a features_available bitmap along with other gnttab related maxima.

That's certainly an option, if the introduction of that sub-op really continues to be necessary.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw
Quoted 34 lines · Jan Beulich
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 25.08.17 at 14:10, <[email protected]> wrote:
Quoted 31 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 17:16, <[email protected]> wrote:
Quoted 7 lines · Juergen Gross
Quoted 6 lines · Andrew Cooper
docs/misc/xen-command-line.markdown +0 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 4 lines

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

That workaround should not be used as an argument to not provide a way to query the capability. It was put in place knowing that it would cause problems for (hypothetical) guests using transitive grants.

Quoted 8 lines
Quoted 5 lines

I am not objecting to introducing a mechanism if a suitable one can be found.

However, the heritage of XSA-226 is a valid reason to not block this patch because a mechanism isn't present.

Code submission deadline for 4.10 isn't very far away; we shouldn't ship a major version with a partial workaround.

I'd say we shouldn't ship a major version with a risky, unused feature on by default.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw
Quoted 38 lines · George Dunlap
Quoted 37 lines · Jan Beulich
Quoted 37 lines
Quoted 1 line
Quoted 1 line · On 25.08.17 at 14:10, <[email protected]> wrote:
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 17:16, <[email protected]> wrote:
Quoted 21 lines · Juergen Gross
Quoted 8 lines · Andrew Cooper
docs/misc/xen-command-line.markdown +2 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 10 lines
docs/misc/xen-command-line.markdown +10 -0
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 8 lines
Quoted 4 lines

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

That workaround should not be used as an argument to not provide a way to query the capability. It was put in place knowing that it would cause problems for (hypothetical) guests using transitive grants.

I am not objecting to introducing a mechanism if a suitable one can be found.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

However, the heritage of XSA-226 is a valid reason to not block this patch because a mechanism isn't present.

Code submission deadline for 4.10 isn't very far away; we shouldn't ship a major version with a partial workaround.

I'd say we shouldn't ship a major version with a risky, unused feature on by default.

You are aware that this "unused feature" is part of the public interface since about 8 years or so?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw
Quoted 38 lines · Juergen Gross
Quoted 37 lines · George Dunlap
Quoted 36 lines · Jan Beulich
Quoted 36 lines
Quoted 1 line
Quoted 1 line · On 25.08.17 at 14:10, <[email protected]> wrote:
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 17:16, <[email protected]> wrote:
Quoted 21 lines · Juergen Gross
Quoted 8 lines · Andrew Cooper
docs/misc/xen-command-line.markdown +2 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 10 lines
docs/misc/xen-command-line.markdown +10 -0
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

So shouldn't there be a way for the guest to query the support of transient grants?

Quoted 8 lines
Quoted 4 lines

Ideally yes, but how do you suggest doing this in a compatible way?

All Xen downstreams which haven't backported the eventual transitive fixes will have this clobber in place, without any query-ability.

That workaround should not be used as an argument to not provide a way to query the capability. It was put in place knowing that it would cause problems for (hypothetical) guests using transitive grants.

I am not objecting to introducing a mechanism if a suitable one can be found.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

However, the heritage of XSA-226 is a valid reason to not block this patch because a mechanism isn't present.

Code submission deadline for 4.10 isn't very far away; we shouldn't ship a major version with a partial workaround.

I'd say we shouldn't ship a major version with a risky, unused feature on by default.

You are aware that this "unused feature" is part of the public interface since about 8 years or so?

Like so many things from Xen's past, it shouldn't have gone in in this state. gnttab v2 in particular suffers massively from second system syndrome, and is far more complicated for both Xen and guests to use than v1. The fact that no up-to-date guests use v2 is also a telling datapoint.

As for this command line patch, I am going to insist on it being a 4.10 blocker, and all 4.$X.$N+1 releases.

We shipped XSA-226 with this workaround, and several downstreams *really* *are* using it. Even with hindsight, shipping this patch was the correct thing to do. There wasn't a functioning fix for XSA-226 until a week after the embargo, when OSSTest discovered that the proposed proper fix for transitive grants broke all grant copy operations for 32bit guests.

I'm also quite disappointed with how the post-embargo handling of XSA-226 has gone.

Choosing to disable a feature (as opposed to fixing it) is always a tough decision, but the timeline speaks for itself. The decision wasn't taken lightly.

For full transparency, the decision was taken by me (as the only person on the security team not on holidy, or working part time), 1 week into the 2 week embargo period, after having worked a full weekend (as well as some Amazon engineers, hence the special thanks in the CREDITS), trying to fix crash after crash to do with transitive grant race conditions, only to find that once the crashes were sorted, a reference count leak was still present. There was no obvious fix or end in sight, and the currently embargoed information was took what was believed to be a theoretical issue and turn it into a very real and easy-to-exploit heap corruption issue. The second part of the XSA-226 fix was only completed on the morning of public embargo, and still, testing eventually showed that the first part was actually buggy.

At the moment, all of our downstreams which followed the embargoed advise will be using these command line options to mitigate the vulnerability. The fact that this patch wasn't committed to the stable trees is bad, because it will cause our downstreams to regress move to a newer version of Xen and the command line options they set up no longer have any effect.

With a believed transitive fix now in place, there is certainly room for arguing over the default to avoid the ABI breakage.

However, all downstreams who have mitigated the vulnerability or reduce their hypervisor attack surface by setting gnttab=max_ver:1 or gnttab=no-transitive need this to keep on working going forwards.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 25.08.17 at 20:43, <[email protected]> wrote:

At the moment, all of our downstreams which followed the embargoed advise will be using these command line options to mitigate the vulnerability. The fact that this patch wasn't committed to the stable trees is bad, because it will cause our downstreams to regress move to a newer version of Xen and the command line options they set up no longer have any effect.

No-one should ever re-base onto a new major or stable version by dropping all locally carried patches.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw
In reply to Andrew Cooper
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 16:50, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +2 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 10 lines
docs/misc/xen-command-line.markdown +10 -0
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

Btw, with the need to use v2 on huge systems I'm no longer convinced providing an option to disable it is a good idea.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#14 lore raw
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 16:50, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

Btw, with the need to use v2 on huge systems I'm no longer convinced providing an option to disable it is a good idea.

"necessary to support larger systems" is not a valid reason to prevent smaller systems having the option to reduce their hypervisor attack surface.

We have an unnecessarily large number of XSAs from hypervisor features which noone uses, and a similarly large number of XSAs from features which are only used in specialised usecases.

Removing unused attack surfaces in common cases makes perfect sense for downstreams.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#15 lore raw
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 25.08.17 at 14:05, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 16:50, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

Btw, with the need to use v2 on huge systems I'm no longer convinced providing an option to disable it is a good idea.

Quoted 2 lines

"necessary to support larger systems" is not a valid reason to prevent smaller systems having the option to reduce their hypervisor attack surface.

Well, yes, one can view it that way. Two questions then, though:
1) If at some point someone comes up with a much better quality v3, how will your option syntax fit that (i.e. to exclude just v2)?
2) Switching between versions (post-migration) requires extra code in guests, albeit perhaps not very much. Is it wise to require OSes to be capable of switching back and forth?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#16 lore raw
Quoted 27 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 25.08.17 at 14:05, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.08.17 at 16:50, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0 -0
@@ -868,6 +868,19 @@ Controls EPT related features.
 
 Specify which console gdbstub should use. See **console**.
 
Quoted 14 lines

docs/misc/xen-command-line.markdown Controls EPT related features. · line 882

Quoted 12 lines
docs/misc/xen-command-line.markdown +12 -0
+### gnttab
+> `= List of [ max_ver:<integer>, transitive ]`
+
+> Default: `gnttab=max_ver:2,transitive`
+
+Control various aspects of the grant table behaviour available to guests.
+
+* `max_ver` Select the maximum grant table version to offer to guests.  Valid
+version are 1 and 2.
+* `transitive` Permit or disallow the use of transitive grants.  Note that the
+use of grant table v2 without transitive grants is an ABI breakage from the
+guests point of view.

Btw, with the need to use v2 on huge systems I'm no longer convinced providing an option to disable it is a good idea.

Quoted 2 lines

"necessary to support larger systems" is not a valid reason to prevent smaller systems having the option to reduce their hypervisor attack surface.

Quoted 6 lines

Well, yes, one can view it that way. Two questions then, though:
1) If at some point someone comes up with a much better quality v3, how will your option syntax fit that (i.e. to exclude just v2)?
2) Switching between versions (post-migration) requires extra code in guests, albeit perhaps not very much. Is it wise to require OSes to be capable of switching back and forth?

BTW: the documentation of "transitive" could be better: does specifying "transitive" permit or disallow the use of transitive grants?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel