xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 3/4] tools/libxc: Avoid generating inappropriate zero-length records
Date: Tue, 26 Jul 2016 10:23:16 +0100	[thread overview]
Message-ID: <20160726092316.GD27082@citrix.com> (raw)
In-Reply-To: <22422.18745.380486.234849@mariner.uk.xensource.com>

On Mon, Jul 25, 2016 at 06:15:37PM +0100, Ian Jackson wrote:
> David Vrabel writes ("Re: [Xen-devel] [PATCH 3/4] tools/libxc: Avoid generating inappropriate zero-length records"):
> > On 21/07/16 18:17, Andrew Cooper wrote:
> > > It was never intended for records such as these to be sent with zero content.
> > 
> > As the original author of the specification I'm perhaps best placed to
> > say what the original intention is.
> 
> I think this discussion of `the intent' is not particularly helpful,
> when the authors of the spec document, and of the code, disagree.  It
> is in any case not necessary to decide what `the original intent' is
> or was.  Accordingly, can all participants please stop referring to
> `the intent' in this way.  (It is of course fine to write `_my_
> intent'.)
> 
> What is necessary is to decide what should be done now.
> 
> I am going to quote liberally from the rest of David's mail but adjust
> some of the wording to try to make it something I can agree with:
> 
>   For records such as HVM_PARAMS which consist of a set of N items,
>   David's intention in the spec, was to most definitely send a record
>   with 0 items.
> 
>   For records that fetch an opaque blob from the hypervisor, again,
>   David's intention was to send this blob as-is with no sort of
>   processing or other checking. i.e., if the hypervisor gives us a
>   zero-length blob we sent that as-is.
> 
>   This makes all the streams look the same with all the same records,
>   regardless of what hardware platform it was run on.  Including
>   zero-length/count records also makes diagnosing problems easier -- the
>   empty record is visible in the stream instead of having to remember that
>   sometimes these records are deliberately omitted.
> 
>   As such, IMO this series should be limited to making the restore
>   side handle the zero count sets or zero length blobs if it does not
>   do so already.
> 
>   The specification should be clarified to note that some records may have
>   zero-length blobs or contain zero items.
> 
> I reviewed the spec in detail at the time and I agree with David's
> point of view as I have rephrased (hopefully without annoying David)
> above.
> 
> I see no reason why zero-content-length records should be treated as
> any kind of special case.
> 
> Is the ultimate bug that we are tripping over here simply that the
> code calls malloc(0) and then bails if the libc produces NULL (as it
> is entitled to do) ?
> 

No, it isn't.

AIUI the issue is receiving end can't deal with zero-length record.  To
to more precise, it is the hypervisor that chokes when toolstack issues
an hypercall with the "malformed" data.

Hence the two approaches presented: one is to omit zero-length record,
the other is to tolerate zero-length record.

If we go with David's approach, I think hypervisor should be made
tolerant to zero-length record. That would be symmetric on both ends --
hv can spit out as well as accept zero-length records. Toolstack should
transparently send and receive records.

Wei.


> Thanks,
> Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-07-26  9:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 17:17 [PATCH RFC 0/4] Fix issues with zero-length records in migration v2 Andrew Cooper
2016-07-21 17:17 ` [PATCH 1/4] docs: Clarify the expected behaviour of zero length records Andrew Cooper
2016-07-25  9:45   ` Wei Liu
2016-07-25 10:21   ` David Vrabel
2016-07-25 10:25     ` Andrew Cooper
2016-07-25 10:35       ` David Vrabel
2016-07-25 10:38         ` Andrew Cooper
2016-07-25 10:44           ` David Vrabel
2016-07-25 10:45             ` Andrew Cooper
2016-07-25 11:18   ` Ian Jackson
2016-07-21 17:17 ` [PATCH 2/4] tools/libxc: Tolerate zero-length records in migration v2 streams Andrew Cooper
2016-07-25  9:46   ` Wei Liu
2016-07-25 12:21   ` David Vrabel
2016-07-25 12:46     ` Andrew Cooper
2016-07-25 13:00       ` David Vrabel
2016-07-21 17:17 ` [PATCH 3/4] tools/libxc: Avoid generating inappropriate zero-length records Andrew Cooper
2016-07-25  9:45   ` Wei Liu
2016-07-25  9:57     ` Andrew Cooper
2016-07-25 10:14       ` Wei Liu
2016-07-25 10:32   ` David Vrabel
2016-07-25 11:44     ` Ian Jackson
2016-07-25 17:15     ` Ian Jackson
2016-07-26  9:23       ` Wei Liu [this message]
2016-07-26 13:37         ` Ian Jackson
2016-07-21 17:17 ` [PATCH 4/4] tools/python: Adjust migration v2 library to warn about " Andrew Cooper
2016-07-25  9:46   ` Wei Liu
2017-03-14 13:20 ` [PATCH RFC 0/4] Fix issues with zero-length records in migration v2 Julien Grall
2017-03-14 13:50   ` Andrew Cooper
2017-03-14 14:21     ` Wei Liu
2017-03-28 18:24       ` Julien Grall

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=20160726092316.GD27082@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).