WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xencons missing string allocation

To: Muli Ben-Yehuda <mulix@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xencons missing string allocation
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Fri, 09 Dec 2005 17:00:24 -0700
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sat, 10 Dec 2005 00:00:12 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1134160653.6463.6.camel@tdi>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: LOSL
References: <1134153451.6136.14.camel@tdi> <20051209185448.GD9830@xxxxxxxxxxxxxxxxxxx> <1134160653.6463.6.camel@tdi>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2005-12-09 at 13:37 -0700, Alex Williamson wrote:
> On Fri, 2005-12-09 at 20:54 +0200, Muli Ben-Yehuda wrote:
> > On Fri, Dec 09, 2005 at 11:37:31AM -0700, Alex Williamson wrote:
> > 
> > > 
> > >    I was trying to boot dom0 w/ "xencons=ttyS1 console=ttyS1".  It gives
> > > some weird error messages:
> > > 
> > > Warning: dev (ttyS2) tty->count(2) != #fd's(1) in release_dev
> > > Warning: dev (ttyS2) tty->count(3) != #fd's(1) in tty_open
> > > 
> > > And blows up with a page fault.  The page fault is because we don't
> > > actually allocate a buffer for the tty driver name.
> > 
> > Errr... the patch looks curious. Why does it work when ->name points
> > to the heap but not when it points to the data segment? they should be
> > equivalent and many tty drivers appear to set ->name to the data
> > segment. Is something trying to modify xencons_driver->name later?
> 
>    You're right, I guess a lot of tty/char drivers seem to have the name
> on the heap.  However, it would suggest there's a path where the name is
> referenced outside of the context of that function since it prevents a
> page fault.  I'll keep looking to make sure I'm not just getting lucky.

   Ok, disregard that previous attempt, it was definitely chasing a
false positive.  I'm not sure this one is correct either, but I'll toss
it out in case anyone else is interested in chasing this problem too.  I
believe the problem is that kcons_device() is incorrectly calculating
the index when xc_num != 0 on serial devices.  If I subtract xc_num from
the console index, which should always give me 0, things work perfectly
for all ttyS console values (that I've tested).  I don't know if
something similar needs to be done for tty devices.  Patch attached,
comments/suggestions welcome.  Thanks,

        Alex


Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---

diff -r 53cff3f88e45 linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c        Fri Dec  9 
11:05:06 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c        Fri Dec  9 
16:34:33 2005
@@ -168,7 +168,7 @@
 
 static struct tty_driver *kcons_device(struct console *c, int *index)
 {
-       *index = c->index;
+       *index = c->index - (xc_mode == XC_SERIAL ? xc_num : 0);
        return xencons_driver;
 }
 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel