All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: Asias He <asias.hejun@gmail.com>
Cc: Pekka Enberg <penberg@kernel.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	Prasad Joshi <prasadjoshi124@gmail.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH] kvm tools: Sanitize output characters in serial console
Date: Wed, 10 Aug 2011 10:01:52 +0300	[thread overview]
Message-ID: <1312959712.1316.0.camel@lappy> (raw)
In-Reply-To: <4E422211.9000704@gmail.com>

On Wed, 2011-08-10 at 14:15 +0800, Asias He wrote:
> On 08/10/2011 01:55 PM, Pekka Enberg wrote:
> > On Wed, Aug 10, 2011 at 8:43 AM, Asias He <asias.hejun@gmail.com> wrote:
> >> On 08/10/2011 01:30 PM, Pekka Enberg wrote:
> >>> On 8/10/11 2:56 AM, Asias He wrote:
> >>>> This patch fixes strange characters in serial console.
> >>>>
> >>>> Before:
> >>>>
> >>>> [    0.448000] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> >>>> �[    0.695000] serial8250: ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A
> >>>> �[    0.942000] serial8250: ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A
> >>>> �[    1.189000] serial8250: ttyS2 at I/O 0x3e8 (irq = 0) is a 16550A
> >>>> [    1.194000] Non-volatile memory driver v1.3
> >>>>
> >>>> After:
> >>>>
> >>>> [    0.541000] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> >>>> [    0.788000] serial8250: ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A
> >>>> [    1.041000] serial8250: ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A
> >>>> [    1.294000] serial8250: ttyS2 at I/O 0x3e8 (irq = 0) is a 16550A
> >>>> [    1.309000] Non-volatile memory driver v1.3
> >>>>
> >>>> Signed-off-by: Asias He<asias.hejun@gmail.com>
> >>>> ---
> >>>>   tools/kvm/term.c |    7 +++++--
> >>>>   1 files changed, 5 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/tools/kvm/term.c b/tools/kvm/term.c
> >>>> index 2a3e1f0..85b41e7 100644
> >>>> --- a/tools/kvm/term.c
> >>>> +++ b/tools/kvm/term.c
> >>>> @@ -5,6 +5,7 @@
> >>>>   #include<unistd.h>
> >>>>   #include<sys/uio.h>
> >>>>   #include<signal.h>
> >>>> +#include<ctype.h>
> >>>>
> >>>>   #include "kvm/read-write.h"
> >>>>   #include "kvm/term.h"
> >>>> @@ -57,8 +58,10 @@ int term_putc(int who, char *addr, int cnt)
> >>>>       if (who != active_console)
> >>>>           return -1;
> >>>>
> >>>> -    while (cnt--)
> >>>> -        fprintf(stdout, "%c", *addr++);
> >>>> +    while (cnt--) {
> >>>> +        if (isascii(*addr))
> >>>
> >>> Do things like backspace still work with this?
> >>
> >> Sure. Have a try ;-)
> >>
> >> http://en.wikipedia.org/wiki/ASCII
> > 
> > OK, cool. Do we know what the extra characters are and why the guest
> > is sending them?
> > 
> 
> 
> This tells us
> 
>         while (cnt--) {
>                if (isascii(*addr))
>                        fprintf(stdout, "%c", *addr++);
>                else
>                        fprintf(stdout, "\n---%x---\n", *addr++);
>         }
> 
> the extra chars is 0xff.
> 
> The reason is not understood.
> 

They are being printed when the serial device is probed. Can we
mistakenly interpret the probe as a print request?

-- 

Sasha.


  parent reply	other threads:[~2011-08-10  7:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09 23:56 [PATCH] kvm tools: Sanitize output characters in serial console Asias He
2011-08-10  5:30 ` Pekka Enberg
2011-08-10  5:43   ` Asias He
2011-08-10  5:55     ` Pekka Enberg
2011-08-10  6:15       ` Asias He
2011-08-10  6:53         ` walimis
2011-08-10  7:22           ` Amos Kong
2011-08-10  8:31           ` Asias He
2011-08-10  9:19             ` Pekka Enberg
2011-08-10  7:01         ` Sasha Levin [this message]
2011-08-11  8:36 ` Avi Kivity

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=1312959712.1316.0.camel@lappy \
    --to=levinsasha928@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.