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

Re: [Xen-devel] [PATCH v2] xenconsole: add option to avoid escape sequences in log



On Tue, Jul 31, 2018 at 05:15:32AM +0200, Marek Marczykowski-Górecki wrote:
> Add --replace-escape option to xenconsoled, which replaces ESC with
> '.' in console output written to log file. This makes it slightly safer
> to do tail -f on a console output of untrusted guest.
> The pty output is unaffected by this option.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>

Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>

... though I would like to make a minor modification when committing.
See below.

>  static int write_all(int fd, const char* buf, size_t len)
>  {
> +     char buf_replaced[1024];
> +     size_t this_round;

These two can be moved into ... 

> +
>       while (len) {
> -             ssize_t ret = write(fd, buf, len);
> +             ssize_t ret;
> +             if (replace_escape) {

... here.

Let me know if you disagree.

> +                     if (len > sizeof(buf_replaced))
> +                             this_round = sizeof(buf_replaced);
> +                     else
> +                             this_round = len;
> +                     do_replace_escape(buf, buf_replaced, this_round);
> +                     ret = write(fd, buf_replaced, this_round);
> +             } else
> +                     ret = write(fd, buf, len);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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