Skip to contentSkip to conversation

PV driver compatibility fixes

PATCH In review [email protected] 4 participants 7 messages Mar 5, 2020 – Mar 17, 2020

lore
Share & tools
lore
#0 lore raw

v2 cover PV driver compatibility fixes

From: Paul Durrant <[email protected]>

Paul Durrant (2):
libxl: create domain 'error' node in xenstore
libxl: make creation of xenstore 'suspend event channel' node

    optional...
 docs/man/xl.cfg.5.pod.in        |  7 +++++++
 docs/misc/xenstore-paths.pandoc | 12 +++++++++---
 tools/libxl/libxl.h             | 13 ++++++++++++-
 tools/libxl/libxl_create.c      | 17 +++++++++++++----
 tools/libxl/libxl_types.idl     |  1 +
 tools/xl/xl_parse.c             |  3 +++
 6 files changed, 45 insertions(+), 8 deletions(-)

---
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Wei Liu <[email protected]>

Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH v2 1/2 libxl: create domain 'error' node in xenstore

From: Paul Durrant <[email protected]>

Several PV drivers (both historically and currently [1]) report errors by writing text into /local/domain/$DOMID/error. This patch creates the node in libxl and makes it writable by the domain, and also adds some text into xenstore-paths.pandoc to state what the node is for.

[1] https://xenbits.xen.org/gitweb/?p=pvdrivers/win/xenvif.git;a=blob;f=src/xenvif/frontend.c;hb=HEAD#l459

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Anthony PERARD <[email protected]>

---
 docs/misc/xenstore-paths.pandoc | 5 +++++
 tools/libxl/libxl_create.c      | 3 +++
 2 files changed, 8 insertions(+)
docs/misc/xenstore-paths.pandoc +5 -0
index 0a6b36146e..e2ab5da54e 100644
@@ -539,6 +539,11 @@ address written in one of these paths to, for example, establish a VNC
 session to the guest (although clearly some level of trust is placed
 in the value supplied by the guest in this case).
 
+#### ~/error [w]
+
+A domain writable path used by some PV drivers to pass error messages
+to the toolstack.
+
 ### Paths private to the toolstack
 
 #### ~/device-model/$DOMID/state [w]
tools/libxl/libxl_create.c +3 -0
index 7891fae426..fb7b3999ae 100644
@@ -797,6 +797,9 @@ retry_transaction:
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/attr", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
+    libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/error", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
 
     if (libxl_defbool_val(info->driver_domain)) {
         /*
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

PATCH v2 2/2 libxl: make creation of xenstore 'suspend event channel' node optional...

In reply to [email protected]

From: Paul Durrant <[email protected]>

... and make the top level 'device' node in xenstore writable by the guest

The purpose and semantics of the suspend event channel node are explained in xenstore-paths.pandoc [1]. It was originally introduced in xend by commit 17636f47a474 "Teach xc_save to use event-channel-based domain suspend if available.". Note that, because, the top-level frontend 'device' node was created writable by the guest in xend, there was no need to explicitly create the 'suspend-event-channel' node as writable node.

However, libxl creates the 'device' node as read-only by the guest and so explicit creation of the 'suspend-event-channel' node is necessary to make it usable. This unfortunately has the side-effect of making some old Windows PV drivers [2] cease to function. This is because they scan the top level 'device' node, find the 'suspend' node and expect it to contain the usual sub-nodes describing a PV frontend. When this is found not to be the case, enumeration ceases and (because the 'suspend' node is observed before the 'vbd' node) no system disk is enumerated. Windows will then crash with bugcheck code 0x7B.

This patch adds a boolean 'suspend_event_channel' field into libxl_create_info to control whether the xenstore node is created and a similarly named option in xl.cfg which, for compatibility with previous libxl behaviour, defaults to true. It also makes the top level device node writable, as xend did, and updates xenstore-paths.pandoc to say that the suspend event channel node may not exist and that the guest may create it if it does not exist.

[1] https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/xenstore-paths.pandoc;hb=HEAD#l177
[2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/para-virtualized_windows_drivers_guide/sect-para-virtualized_windows_drivers_guide-installing_and_configuring_the_para_virtualized_drivers-installing_the_para_virtualized_drivers

NOTE: While adding the new LIBXL_HAVE_CREATEINFO_SUSPEND_EVENT_CHANNEL
definition into libxl.h, this patch corrects the previous stanza which erroneously implies libxl_domain_create_info is a function.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony PERARD <[email protected]>

v2:
- Update xenstore-paths.pandoc and squash patch #3

---
 docs/man/xl.cfg.5.pod.in        |  7 +++++++
 docs/misc/xenstore-paths.pandoc |  7 ++++---
 tools/libxl/libxl.h             | 13 ++++++++++++-
 tools/libxl/libxl_create.c      | 14 ++++++++++----
 tools/libxl/libxl_types.idl     |  1 +
 tools/xl/xl_parse.c             |  3 +++
 6 files changed, 37 insertions(+), 8 deletions(-)
docs/man/xl.cfg.5.pod.in +7 -0
index 0cad561375..5f476f1e1d 100644
@@ -668,6 +668,13 @@ file.
 
 =back
 
+=item B<suspend_event_channel=BOOLEAN>
+
+Create the xenstore path for the domain's suspend event channel. The
+existence of this path can cause problems with older PV drivers running
+in the guest. If this option is not specified then it will default to
+B<true>.
+
 =back
 
 =head2 Devices
docs/misc/xenstore-paths.pandoc +4 -3
index e2ab5da54e..a8eecdb7ed 100644
@@ -176,10 +176,11 @@ The size of the video RAM this domain is configured with.
 
 #### ~/device/suspend/event-channel = ""|EVTCHN [w]
 
-The domain's suspend event channel. The toolstack will create this
-path with an empty value which the guest may choose to overwrite.
+The domain's suspend event channel. The toolstack may create this
+path with an empty value which the guest may choose to overwrite. If
+the path does not exist then the guest may create it.
 
-If the guest overwrites this, it will be with the number of an unbound
+If the guest writes this, it will be with the number of an unbound
 event channel port it has acquired.  The toolstack is expected to use
 an interdomain bind, and then, when it wishes to ask the guest to
 suspend, to signal the event channel.
tools/libxl/libxl.h +12 -1
index 35e13428b2..d2afe48512 100644
@@ -1272,10 +1272,21 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  * LIBXL_HAVE_CREATEINFO_DOMID
  *
  * libxl_domain_create_new() and libxl_domain_create_restore() will use
- * a domid specified in libxl_domain_create_info().
+ * a domid specified in libxl_domain_create_info.
  */
 #define LIBXL_HAVE_CREATEINFO_DOMID
 
+/*
+ * LIBXL_HAVE_CREATEINFO_SUSPEND_EVENT_CHANNEL
+ *
+ * libxl_domain_create_info contains a boolean 'suspend_event_channel'
+ * value to control whether the xenstore path:
+ *
+ * /local/domain/$DOMID/device/suspend/event-channel (RW)
+ *
+ * is created.
+ */
+
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
 int libxl_string_list_length(const libxl_string_list *sl);
tools/libxl/libxl_create.c +10 -4
index fb7b3999ae..8afb0ce2be 100644
@@ -57,6 +57,8 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,
     if (!c_info->ssidref)
         c_info->ssidref = SECINITSID_DOMU;
 
+    libxl_defbool_setdefault(&c_info->suspend_event_channel, true);
+
     return 0;
 }
 
@@ -750,7 +752,7 @@ retry_transaction:
                     roperm, ARRAY_SIZE(roperm));
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/device", dom_path),
-                    roperm, ARRAY_SIZE(roperm));
+                    rwperm, ARRAY_SIZE(rwperm));
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/control", dom_path),
                     roperm, ARRAY_SIZE(roperm));
@@ -782,9 +784,13 @@ retry_transaction:
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/control/sysrq", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
-    libxl__xs_mknod(gc, t,
-                    GCSPRINTF("%s/device/suspend/event-channel", dom_path),
-                    rwperm, ARRAY_SIZE(rwperm));
+
+    if (libxl_defbool_val(info->suspend_event_channel))
+        libxl__xs_mknod(gc, t,
+                        GCSPRINTF("%s/device/suspend/event-channel",
+                                  dom_path),
+                        rwperm, ARRAY_SIZE(rwperm));
+
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/data", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
tools/libxl/libxl_types.idl +1 -0
index d0d431614f..2bce19bcf0 100644
@@ -418,6 +418,7 @@ libxl_domain_create_info = Struct("domain_create_info",[
     ("run_hotplug_scripts",libxl_defbool),
     ("driver_domain",libxl_defbool),
     ("passthrough",  libxl_passthrough),
+    ("suspend_event_channel",libxl_defbool),
     ], dir=DIR_IN)
 
 libxl_domain_restore_params = Struct("domain_restore_params", [
tools/xl/xl_parse.c +3 -0
index b881184804..122c6eb641 100644
@@ -2725,6 +2725,9 @@ skip_usbdev:
 
     parse_vkb_list(config, d_config);
 
+    xlu_cfg_get_defbool(config, "suspend_event_channel",
+                        &c_info->suspend_event_channel, 0);
+
     xlu_cfg_destroy(config);
 }
 
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw

Re: [Xen-devel] [PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional...

Ping?

Quoted 202 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: 05 March 2020 12:14
To: [email protected]
Cc: Durrant, Paul <[email protected]>; Ian Jackson <[email protected]>; Wei Liu <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Jan Beulich <[email protected]>; Julien Grall <[email protected]>; Stefano Stabellini <[email protected]>; Anthony PERARD <[email protected]>
Subject: [PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional...

From: Paul Durrant <[email protected]>

... and make the top level 'device' node in xenstore writable by the guest

The purpose and semantics of the suspend event channel node are explained in xenstore-paths.pandoc [1]. It was originally introduced in xend by commit 17636f47a474 "Teach xc_save to use event-channel-based domain suspend if available.". Note that, because, the top-level frontend 'device' node was created writable by the guest in xend, there was no need to explicitly create the 'suspend-event-channel' node as writable node.

However, libxl creates the 'device' node as read-only by the guest and so explicit creation of the 'suspend-event-channel' node is necessary to make it usable. This unfortunately has the side-effect of making some old Windows PV drivers [2] cease to function. This is because they scan the top level 'device' node, find the 'suspend' node and expect it to contain the usual sub-nodes describing a PV frontend. When this is found not to be the case, enumeration ceases and (because the 'suspend' node is observed before the 'vbd' node) no system disk is enumerated. Windows will then crash with bugcheck code 0x7B.

This patch adds a boolean 'suspend_event_channel' field into libxl_create_info to control whether the xenstore node is created and a similarly named option in xl.cfg which, for compatibility with previous libxl behaviour, defaults to true. It also makes the top level device node writable, as xend did, and updates xenstore-paths.pandoc to say that the suspend event channel node may not exist and that the guest may create it if it does not exist.

[1] https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/xenstore-paths.pandoc;hb=HEAD#l177
[2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/para-
virtualized_windows_drivers_guide/sect-para-virtualized_windows_drivers_guide- installing_and_configuring_the_para_virtualized_drivers-installing_the_para_virtualized_drivers

NOTE: While adding the new LIBXL_HAVE_CREATEINFO_SUSPEND_EVENT_CHANNEL
definition into libxl.h, this patch corrects the previous stanza which erroneously implies libxl_domain_create_info is a function.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony PERARD <[email protected]>

v2:
- Update xenstore-paths.pandoc and squash patch #3

---
 docs/man/xl.cfg.5.pod.in        |  7 +++++++
 docs/misc/xenstore-paths.pandoc |  7 ++++---
 tools/libxl/libxl.h             | 13 ++++++++++++-
 tools/libxl/libxl_create.c      | 14 ++++++++++----
 tools/libxl/libxl_types.idl     |  1 +
 tools/xl/xl_parse.c             |  3 +++
 6 files changed, 37 insertions(+), 8 deletions(-)
docs/man/xl.cfg.5.pod.in +7 -0
index 0cad561375..5f476f1e1d 100644
@@ -668,6 +668,13 @@ file.
 
 =back
 
+=item B<suspend_event_channel=BOOLEAN>
+
+Create the xenstore path for the domain's suspend event channel. The
+existence of this path can cause problems with older PV drivers running
+in the guest. If this option is not specified then it will default to
+B<true>.
+
 =back
 
 =head2 Devices
docs/misc/xenstore-paths.pandoc +4 -3
index e2ab5da54e..a8eecdb7ed 100644
@@ -176,10 +176,11 @@ The size of the video RAM this domain is configured with.
 
 #### ~/device/suspend/event-channel = ""|EVTCHN [w]
 
-The domain's suspend event channel. The toolstack will create this
-path with an empty value which the guest may choose to overwrite.
+The domain's suspend event channel. The toolstack may create this
+path with an empty value which the guest may choose to overwrite. If
+the path does not exist then the guest may create it.
 
-If the guest overwrites this, it will be with the number of an unbound
+If the guest writes this, it will be with the number of an unbound
 event channel port it has acquired.  The toolstack is expected to use
 an interdomain bind, and then, when it wishes to ask the guest to
 suspend, to signal the event channel.
tools/libxl/libxl.h +12 -1
index 35e13428b2..d2afe48512 100644
@@ -1272,10 +1272,21 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  * LIBXL_HAVE_CREATEINFO_DOMID
  *
  * libxl_domain_create_new() and libxl_domain_create_restore() will use
- * a domid specified in libxl_domain_create_info().
+ * a domid specified in libxl_domain_create_info.
  */
 #define LIBXL_HAVE_CREATEINFO_DOMID
 
+/*
+ * LIBXL_HAVE_CREATEINFO_SUSPEND_EVENT_CHANNEL
+ *
+ * libxl_domain_create_info contains a boolean 'suspend_event_channel'
+ * value to control whether the xenstore path:
+ *
+ * /local/domain/$DOMID/device/suspend/event-channel (RW)
+ *
+ * is created.
+ */
+
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
 int libxl_string_list_length(const libxl_string_list *sl);
tools/libxl/libxl_create.c +10 -4
index fb7b3999ae..8afb0ce2be 100644
@@ -57,6 +57,8 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,
     if (!c_info->ssidref)
         c_info->ssidref = SECINITSID_DOMU;
 
+    libxl_defbool_setdefault(&c_info->suspend_event_channel, true);
+
     return 0;
 }
 
@@ -750,7 +752,7 @@ retry_transaction:
                     roperm, ARRAY_SIZE(roperm));
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/device", dom_path),
-                    roperm, ARRAY_SIZE(roperm));
+                    rwperm, ARRAY_SIZE(rwperm));
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/control", dom_path),
                     roperm, ARRAY_SIZE(roperm));
@@ -782,9 +784,13 @@ retry_transaction:
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/control/sysrq", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
-    libxl__xs_mknod(gc, t,
-                    GCSPRINTF("%s/device/suspend/event-channel", dom_path),
-                    rwperm, ARRAY_SIZE(rwperm));
+
+    if (libxl_defbool_val(info->suspend_event_channel))
+        libxl__xs_mknod(gc, t,
+                        GCSPRINTF("%s/device/suspend/event-channel",
+                                  dom_path),
+                        rwperm, ARRAY_SIZE(rwperm));
+
     libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/data", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
tools/libxl/libxl_types.idl +1 -0
index d0d431614f..2bce19bcf0 100644
@@ -418,6 +418,7 @@ libxl_domain_create_info = Struct("domain_create_info",[
     ("run_hotplug_scripts",libxl_defbool),
     ("driver_domain",libxl_defbool),
     ("passthrough",  libxl_passthrough),
+    ("suspend_event_channel",libxl_defbool),
     ], dir=DIR_IN)
 
 libxl_domain_restore_params = Struct("domain_restore_params", [
tools/xl/xl_parse.c +3 -1
index b881184804..122c6eb641 100644
@@ -2725,6 +2725,9 @@ skip_usbdev:
 
     parse_vkb_list(config, d_config);
 
+    xlu_cfg_get_defbool(config, "suspend_event_channel",
+                        &c_info->suspend_event_channel, 0);
+
     xlu_cfg_destroy(config);
 }
 
--
Quoted 1 line

2.20.1

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

#4 lore raw

Re: [Xen-devel] [PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional...

In reply to [email protected]

[email protected] writes ("[PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional..."):

Quoted 4 lines

From: Paul Durrant <[email protected]>

... and make the top level 'device' node in xenstore writable by the guest

Sorry for taking a long time to review this. Thanks for your proposal.

Quoted 8 lines

The purpose and semantics of the suspend event channel node are explained in xenstore-paths.pandoc [1]. It was originally introduced in xend by commit 17636f47a474 "Teach xc_save to use event-channel-based domain suspend if available.". Note that, because, the top-level frontend 'device' node was created writable by the guest in xend, there was no need to explicitly create the 'suspend-event-channel' node as writable node.

Quoted 9 lines

However, libxl creates the 'device' node as read-only by the guest and so explicit creation of the 'suspend-event-channel' node is necessary to make it usable. This unfortunately has the side-effect of making some old Windows PV drivers [2] cease to function. This is because they scan the top level 'device' node, find the 'suspend' node and expect it to contain the usual sub-nodes describing a PV frontend. When this is found not to be the case, enumeration ceases and (because the 'suspend' node is observed before the 'vbd' node) no system disk is enumerated. Windows will then crash with bugcheck code 0x7B.

This is quite a thorny problem.

I am uncomfortable with making ~/device writeable by the guest. From what you say it is necessary for at least these guests but I worry that there might be something out there somewhere (maybe not even in our tree) which trusts it too much. (libxl used to be in this category, before XSA-175/178, so this is sadly not a theoretical concern.) It's true that xend apparently make this writeable but we have been making it readonly for a while now and maybe people read xenstore-ls to see, or just didn't care...

I'm not sure how we could conduct an audit to find problems. It seems like that would be hard to do thoroughly (and a disproportionate effort). But we could at least
- make this path writeable only as a bug compatibility feature, ie when needed to support this old guest
- make sure we document it clearly in xenstore-paths as that is the arch reference that people will use when coding
- document the fact that there may be security implications of setting thsi compat option

Quoted 7 lines

This patch adds a boolean 'suspend_event_channel' field into libxl_create_info to control whether the xenstore node is created and a similarly named option in xl.cfg which, for compatibility with previous libxl behaviour, defaults to true. It also makes the top level device node writable, as xend did, and updates xenstore-paths.pandoc to say that the suspend event channel node may not exist and that the guest may create it if it does not exist.

So my inclination is to ask you to rework this patch so that:

- the name of the config option more clearly indicates its status as a bug compat workaround
- the ~/device writeability is controlled by the same compat flag, with corresponding update to the docs for the compat flag
- adding an entry for the top-level ~/device to xenstore-paths.pandoc

But I am open to other approaches.

Quoted 3 lines

NOTE: While adding the new LIBXL_HAVE_CREATEINFO_SUSPEND_EVENT_CHANNEL
definition into libxl.h, this patch corrects the previous stanza which erroneously implies libxl_domain_create_info is a function.

Normally we like things broken out into their own patches but this one is trivial I won't insist on that.

Ian.

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

#5 lore raw

Re: [Xen-devel] [PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional...

Quoted 38 lines

-----Original Message-----
From: Ian Jackson <[email protected]>
Sent: 17 March 2020 16:51
To: Paul Durrant <[email protected]>
Cc: [email protected]; Wei Liu <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Jan Beulich <[email protected]>; Julien Grall <[email protected]>; Stefano Stabellini <[email protected]>; Anthony Perard <[email protected]>
Subject: Re: [PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional...

[email protected] writes ("[PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional..."):

Quoted 4 lines

From: Paul Durrant <[email protected]>

... and make the top level 'device' node in xenstore writable by the guest

Sorry for taking a long time to review this. Thanks for your proposal.

Quoted 8 lines

The purpose and semantics of the suspend event channel node are explained in xenstore-paths.pandoc [1]. It was originally introduced in xend by commit 17636f47a474 "Teach xc_save to use event-channel-based domain suspend if available.". Note that, because, the top-level frontend 'device' node was created writable by the guest in xend, there was no need to explicitly create the 'suspend-event-channel' node as writable node.

Quoted 9 lines

However, libxl creates the 'device' node as read-only by the guest and so explicit creation of the 'suspend-event-channel' node is necessary to make it usable. This unfortunately has the side-effect of making some old Windows PV drivers [2] cease to function. This is because they scan the top level 'device' node, find the 'suspend' node and expect it to contain the usual sub-nodes describing a PV frontend. When this is found not to be the case, enumeration ceases and (because the 'suspend' node is observed before the 'vbd' node) no system disk is enumerated. Windows will then crash with bugcheck code 0x7B.

Quoted 2 lines

This is quite a thorny problem.

Indeed.

Quoted 9 lines

I am uncomfortable with making ~/device writeable by the guest. From what you say it is necessary for at least these guests but I worry that there might be something out there somewhere (maybe not even in our tree) which trusts it too much. (libxl used to be in this category, before XSA-175/178, so this is sadly not a theoretical concern.) It's true that xend apparently make this writeable but we have been making it readonly for a while now and maybe people read xenstore-ls to see, or just didn't care...

That's true. I imagine most things don't care but there is a risk they might.

Quoted 3 lines

I'm not sure how we could conduct an audit to find problems. It seems like that would be hard to do thoroughly (and a disproportionate effort).

Impossible really. We don't have code for all frontends :-(

Quoted 7 lines

But we could at least
- make this path writeable only as a bug compatibility feature, ie when needed to support this old guest
- make sure we document it clearly in xenstore-paths as that is the arch reference that people will use when coding
- document the fact that there may be security implications of setting thsi compat option

I'm ok with that approach.

Quoted 9 lines
Quoted 8 lines

This patch adds a boolean 'suspend_event_channel' field into libxl_create_info to control whether the xenstore node is created and a similarly named option in xl.cfg which, for compatibility with previous libxl behaviour, defaults to true. It also makes the top level device node writable, as xend did, and updates xenstore-paths.pandoc to say that the suspend event channel node may not exist and that the guest may create it if it does not exist.

Quoted 4 lines

So my inclination is to ask you to rework this patch so that:

- the name of the config option more clearly indicates its status as a bug compat workaround

So, naming-wise... 'xend_compat', or is that too vague?

Quoted 7 lines

- the ~/device writeability is controlled by the same compat flag, with corresponding update to the docs for the compat flag
- adding an entry for the top-level ~/device to xenstore-paths.pandoc

But I am open to other approaches.

That all sounds fine.

Quoted 6 lines
Quoted 3 lines

NOTE: While adding the new LIBXL_HAVE_CREATEINFO_SUSPEND_EVENT_CHANNEL
definition into libxl.h, this patch corrects the previous stanza which erroneously implies libxl_domain_create_info is a function.

Normally we like things broken out into their own patches but this one is trivial I won't insist on that.

OK. It did seem too trivial to break out.

Paul

Quoted 2 lines

Ian.

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

#6 lore raw

Re: [Xen-devel] [PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional...

Paul Durrant writes ("RE: [PATCH v2 2/2] libxl: make creation of xenstore 'suspend event channel' node optional..."):

Quoted 9 lines

So, naming-wise... 'xend_compat', or is that too vague?

Quoted 6 lines

- the ~/device writeability is controlled by the same compat flag, with corresponding update to the docs for the compat flag
- adding an entry for the top-level ~/device to xenstore-paths.pandoc

But I am open to other approaches.

That all sounds fine.

We had this conversation on IRC:

17:01 * Diziet reads.
17:02 <Diziet> I think "xend_compat" is a bit of a vague name, yes.
"xend_suspend_evtchn_compat" maybe ?
17:03 <Diziet> xadimgnik: Would it be possible to put into the xl.cfg(5) doc
bit for this something about *which* pv drivers are likely to be affected ? I think that would help users (at the very least, it would help them dismiss it if it wasn't relevant to them).
17:23 <xadimgnik> Diziet: sure, I can add some text and the name is ok 17:31 <Diziet> Thanks.
17:31 <Diziet> Shall I c&p this into an email or will you do that ? 17:35 <xadimgnik> Diziet: it'd be helpful if you did it, thanks

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