From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH] kvm tools: Sanitize output characters in serial console Date: Wed, 10 Aug 2011 10:01:52 +0300 Message-ID: <1312959712.1316.0.camel@lappy> References: <1312934218-32666-1-git-send-email-asias.hejun@gmail.com> <4E421784.2020703@kernel.org> <4E421A72.9080203@gmail.com> <4E422211.9000704@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Pekka Enberg , Cyrill Gorcunov , Ingo Molnar , Prasad Joshi , kvm@vger.kernel.org To: Asias He Return-path: Received: from mail-fx0-f46.google.com ([209.85.161.46]:56005 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750814Ab1HJHCv (ORCPT ); Wed, 10 Aug 2011 03:02:51 -0400 Received: by fxh19 with SMTP id 19so669016fxh.19 for ; Wed, 10 Aug 2011 00:02:50 -0700 (PDT) In-Reply-To: <4E422211.9000704@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 w= rote: > >> 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 e= nabled > >>>> =EF=BF=BD[ 0.695000] serial8250: ttyS0 at I/O 0x3f8 (irq =3D = 0) is a 16550A > >>>> =EF=BF=BD[ 0.942000] serial8250: ttyS1 at I/O 0x2f8 (irq =3D = 0) is a 16550A > >>>> =EF=BF=BD[ 1.189000] serial8250: ttyS2 at I/O 0x3e8 (irq =3D = 0) is a 16550A > >>>> [ 1.194000] Non-volatile memory driver v1.3 > >>>> > >>>> After: > >>>> > >>>> [ 0.541000] Serial: 8250/16550 driver, 4 ports, IRQ sharing e= nabled > >>>> [ 0.788000] serial8250: ttyS0 at I/O 0x3f8 (irq =3D 0) is a 1= 6550A > >>>> [ 1.041000] serial8250: ttyS1 at I/O 0x2f8 (irq =3D 0) is a 1= 6550A > >>>> [ 1.294000] serial8250: ttyS2 at I/O 0x3e8 (irq =3D 0) is a 1= 6550A > >>>> [ 1.309000] Non-volatile memory driver v1.3 > >>>> > >>>> Signed-off-by: Asias He > >>>> --- > >>>> 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 > >>>> #include > >>>> #include > >>>> +#include > >>>> > >>>> #include "kvm/read-write.h" > >>>> #include "kvm/term.h" > >>>> @@ -57,8 +58,10 @@ int term_putc(int who, char *addr, int cnt) > >>>> if (who !=3D 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 > >=20 > > OK, cool. Do we know what the extra characters are and why the gues= t > > is sending them? > >=20 >=20 >=20 > This tells us >=20 > while (cnt--) { > if (isascii(*addr)) > fprintf(stdout, "%c", *addr++); > else > fprintf(stdout, "\n---%x---\n", *addr++); > } >=20 > the extra chars is 0xff. >=20 > The reason is not understood. >=20 They are being printed when the serial device is probed. Can we mistakenly interpret the probe as a print request? --=20 Sasha.