On Thu, Oct 09, 2025 at 11:41:04AM +0000, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrangé ([email protected]) wrote:
> > On Thu, Oct 09, 2025 at 01:56:09AM +0000, Dr. David Alan Gilbert wrote:
> > > * Gerd Hoffmann ([email protected]) wrote:
> > > > Starting with the edk2-stable202508 tag OVMF (and ArmVirt too) have
> > > > optional support for logging to a memory buffer.  There is guest side
> > > > support -- for example in linux kernels v6.17+ -- to read that buffer.
> > > > But that might not helpful if your guest stops booting early enough that
> > > > guest tooling can not be used yet.  So host side support to read that
> > > > log buffer is a useful thing to have.
> > > > 
> > > > This patch implements both qmp and hmp monitor commands to read the
> > > > firmware log.
> > > > 
> > > > Signed-off-by: Gerd Hoffmann <[email protected]>
> > > 
> > > I'm OK with that, but I wonder if it would be better to have a command
> > > that wrote the buffer to a file rather than displaying it directly; I 
> > > don't
> > > think we normally have anything else which outputs that much raw guest
> > > provided data directly.
> > > I assume when it goes wrong you end up with random unprintable junk in
> > > the buffer.
> > 
> > 128 KB is on the high side, but is not terrible. Libvirt (arbitrarily)
> > caps a QMP reply at 10 MB. Libvirt is going to want to send this on to
> > the client app and will likely do that streaming in memory, so having
> > it iin a file is not required from our POV.
> > 
> > IIRC, some of the query-block command replies can get insanely huge
> > when the qcow2 chain is very long.
> 
> OK, what about sanitisation - if that text contains random binary what 
> happens,
> or should we make sure it's sanitised?

As prior art, the QGA  'guest-exec' command will return stdout/stderr
of the command in base64 format.  The downside is that it is bloated
in size, but it is at least safe wrt JSON encoding.  The HMP command
could still dump the raw data IMHO, as that's human facing and base64
is horrible for human consumption.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to