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] xenconsole fix

To: Pete Zaitcev <zaitcev@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xenconsole fix
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Sat, 8 Jul 2006 14:16:29 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 07 Jul 2006 22:17:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060707122450.147079b5.zaitcev@xxxxxxxxxx>
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>
References: <20060707083556.GK4417%yamahata@xxxxxxxxxxxxx> <20060707122450.147079b5.zaitcev@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
On Fri, Jul 07, 2006 at 12:24:50PM -0700, Pete Zaitcev wrote:
> On Fri, 7 Jul 2006 17:35:56 +0900, Isaku Yamahata <yamahata@xxxxxxxxxxxxx> 
> wrote:
> 
> > xenconsole fix. reference of tty->count in xencons_close() is racy.
> > It must be protected by tty_sem semaphore like con_close() in
> > drivers/char/vt.c
> 
> > +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c    Fri Jul 07 
> > 17:34:08 2006 +0900
> > @@ -536,6 +536,7 @@ static void xencons_close(struct tty_str
> >     if (DUMMY_TTY(tty))
> >             return;
> >  
> > +   down(&tty_sem);
> >     if (tty->count == 1) {
> >             tty->closing = 1;
> >             tty_wait_until_sent(tty, 0);
> ......
> >     }
> > +   up(&tty_sem);
> >  }
> 
> This is clearly not a safe idea. You do not know what the line
> discipline is going to do. If you are concerned about tty->count,
> then why don't you drop the mutex before all those convoluted
> functions get called?

You're right. It's daingerous. How about this patch?
Setting TTY_CLOSING is intrusinve.
But referencing tty->count is already intrusive.
-- 
yamahata

Attachment: 10648:747aaae397bf_add_tty_sem.patch
Description: Text document

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