All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Jürgen Groß" <jgross@suse.com>,
	"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 19:00:49 +0100	[thread overview]
Message-ID: <7384a44d-0eb8-4033-98b6-ddb7fd9a8131@citrix.com> (raw)
In-Reply-To: <c978ac2b-0529-4bd8-a493-55e806740808@suse.com>

On 10/05/2024 9:05 am, Jürgen Groß wrote:
> 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.

I've fixed this on commit.

~Andrew


  reply	other threads:[~2024-05-10 18:01 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ß
2024-05-10 18:00   ` Andrew Cooper [this message]
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=7384a44d-0eb8-4033-98b6-ddb7fd9a8131@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=demi@invisiblethingslab.com \
    --cc=jgross@suse.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.