xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xenproject.org, xen-devel@lists.xen.org
Subject: Re: [PATCH v2] xenconsole: add option to avoid escape sequences in log
Date: Tue, 31 Jul 2018 10:10:10 +0100	[thread overview]
Message-ID: <20180731091010.chflw6m32uqeatsq@citrix.com> (raw)
In-Reply-To: <20180731031532.11752-1-marmarek@invisiblethingslab.com>

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@invisiblethingslab.com>

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

... 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-07-31  9:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  3:15 [PATCH v2] xenconsole: add option to avoid escape sequences in log Marek Marczykowski-Górecki
2018-07-31  9:10 ` Wei Liu [this message]
2018-07-31 16:11   ` Marek Marczykowski-Górecki

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=20180731091010.chflw6m32uqeatsq@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=xen-devel@lists.xen.org \
    --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 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).