[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.12 RFC] xen/console: Handle NUL character in buffer sent via CONSOLEIO_write


On 2/27/19 10:25 AM, Jan Beulich wrote:
On 27.02.19 at 00:03, <julien.grall@xxxxxxx> wrote:
After upgrading Debian to Buster, I started noticing console mangling
when using zsh. This is happenning because output sent by zsh to the
console may contain NUL character in the middle of the buffer.

Linux is sending the buffer as it is to Xen console via CONSOLEIO_write.
However, the implementation in Xen considers NUL character is used to
terminate the buffer and therefore will ignore anything after it.

The actual documentation of CONSOLEIO_write is pretty limited. From the
declaration, the hypercall takes a buffer and size. So this could lead
to think the NUL character is allowed in the middle of the buffer.

This patch updates the console API to pass the size along the buffer
down so we can remove the reliance on buffer terminating by a NUL

We don't need the behavior for internal producers, so I think the change
touches way too much code. I think all you need to do is make the
hypercall handler sense null characters, and perhaps simply invoke lower
level handlers multiple times. Or replace them by something else (e.g. a

I have to disagree here. If the OS decides to pass a buffer containing NUL character, then we should honor it and send the NUL character to the serial. Otherwise you may have a different behavior when running on baremetal and on Xen. One case I have in mind is debugging over HVC console.

So we need to modify the console API for handling this purpose. Yes, it will allow the internal producers to put NUL character in it. But that's not a real issue by itself.


Julien Grall

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.