From: "Jürgen Groß" <jgross@suse.com>
To: Demi Marie Obenour <demi@invisiblethingslab.com>,
xen-devel@lists.xenproject.org
Cc: "Anthony PERARD" <anthony.perard@citrix.com>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: Re: [PATCH] libxl: Fix handling XenStore errors in device creation
Date: Fri, 10 May 2024 10:05:59 +0200 [thread overview]
Message-ID: <c978ac2b-0529-4bd8-a493-55e806740808@suse.com> (raw)
In-Reply-To: <84a6e6376ab9f5aafac8f33bf772d73fcfd0d818.1713998669.git.demi@invisiblethingslab.com>
On 27.04.24 04:17, Demi Marie Obenour wrote:
> If xenstored runs out of memory it is possible for it to fail operations
> that should succeed. libxl wasn't robust against this, and could fail
> to ensure that the TTY path of a non-initial console was created and
> read-only for guests. This doesn't qualify for an XSA because guests
> should not be able to run xenstored out of memory, but it still needs to
> be fixed.
>
> Add the missing error checks to ensure that all errors are properly
> handled and that at no point can a guest make the TTY path of its
> frontend directory writable.
>
> Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Apart from one nit below:
Reviewed-by: Juergen Gross <jgross@suse.com>
> ---
> tools/libs/light/libxl_console.c | 10 ++---
> tools/libs/light/libxl_device.c | 72 ++++++++++++++++++++------------
> tools/libs/light/libxl_xshelp.c | 13 ++++--
> 3 files changed, 59 insertions(+), 36 deletions(-)
>
> diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
> index cd7412a3272a2faf4b9dab0ef4dd077e55472546..adf82aa844a4f4989111bfc8a94af18ad8e114f1 100644
> --- a/tools/libs/light/libxl_console.c
> +++ b/tools/libs/light/libxl_console.c
> @@ -351,11 +351,10 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
> flexarray_append(front, "protocol");
> flexarray_append(front, LIBXL_XENCONSOLE_PROTOCOL);
> }
> - libxl__device_generic_add(gc, XBT_NULL, device,
> - libxl__xs_kvs_of_flexarray(gc, back),
> - libxl__xs_kvs_of_flexarray(gc, front),
> - libxl__xs_kvs_of_flexarray(gc, ro_front));
> - rc = 0;
> + rc = libxl__device_generic_add(gc, XBT_NULL, device,
> + libxl__xs_kvs_of_flexarray(gc, back),
> + libxl__xs_kvs_of_flexarray(gc, front),
> + libxl__xs_kvs_of_flexarray(gc, ro_front));
> out:
> return rc;
> }
> @@ -665,6 +664,7 @@ int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid,
> */
> if (!val) val = "/NO-SUCH-PATH";
> channelinfo->u.pty.path = strdup(val);
> + if (channelinfo->u.pty.path == NULL) abort();
Even with the bad example 2 lines up, please put the "abort();" into a
line of its own.
Juergen
next prev parent reply other threads:[~2024-05-10 8:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-27 2:17 [PATCH] libxl: Fix handling XenStore errors in device creation Demi Marie Obenour
2024-05-10 8:05 ` Jürgen Groß [this message]
2024-05-10 18:00 ` Andrew Cooper
2024-05-10 22:14 ` Demi Marie Obenour
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=c978ac2b-0529-4bd8-a493-55e806740808@suse.com \
--to=jgross@suse.com \
--cc=anthony.perard@citrix.com \
--cc=demi@invisiblethingslab.com \
--cc=marmarek@invisiblethingslab.com \
--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.