From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KV7Yp-0002Yv-3v for qemu-devel@nongnu.org; Mon, 18 Aug 2008 12:26:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KV7Yo-0002XX-95 for qemu-devel@nongnu.org; Mon, 18 Aug 2008 12:26:26 -0400 Received: from [199.232.76.173] (port=48898 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KV7Yn-0002XC-V5 for qemu-devel@nongnu.org; Mon, 18 Aug 2008 12:26:26 -0400 Received: from mx1.redhat.com ([66.187.233.31]:46044) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KV7Yn-0008Od-Oh for qemu-devel@nongnu.org; Mon, 18 Aug 2008 12:26:25 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m7IGQJY3024229 for ; Mon, 18 Aug 2008 12:26:19 -0400 Received: from file.fab.redhat.com (file.fab.redhat.com [10.33.63.6]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m7IGQJ8V015398 for ; Mon, 18 Aug 2008 12:26:19 -0400 Received: from file.fab.redhat.com (localhost.localdomain [127.0.0.1]) by file.fab.redhat.com (8.13.1/8.13.1) with ESMTP id m7IGQIIp029104 for ; Mon, 18 Aug 2008 17:26:18 +0100 Received: (from berrange@localhost) by file.fab.redhat.com (8.13.1/8.13.1/Submit) id m7IGQIao029100 for qemu-devel@nongnu.org; Mon, 18 Aug 2008 17:26:18 +0100 Date: Mon, 18 Aug 2008 17:26:18 +0100 From: "Daniel P. Berrange" Subject: Re: [Qemu-devel] pty/tty functions for BSD too Message-ID: <20080818162618.GA20089@redhat.com> References: <20080818105912.GF4686@implementation.uk.xensource.com> <48A981F1.6070606@codemonkey.ws> <20080818142333.GQ4686@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Reply-To: "Daniel P. Berrange" , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mon, Aug 18, 2008 at 07:16:36PM +0300, Blue Swirl wrote: > On 8/18/08, Samuel Thibault wrote: > > Anthony Liguori, le Mon 18 Aug 2008 09:06:41 -0500, a =E9crit : > > > > > Samuel Thibault wrote: > > > >In Xen, pty/tty functions are enabled for BSD too, shouldn't we e= nable > > > >them in upstream qemu too, as patched below? > > > > > > > > > > And you're sure that these functions compile/work on NetBSD/OpenBS= D? > > > > > > The defines are explicit in Xen, so I guess somebody tested it. I > > haven't myself. I wonder why there is no FreeBSD however. >=20 > The patch does not work on OpenBSD, because while openpty() is > available, ptsname() isn't. >=20 > I tested the attached version on OpenBSD and Linux, pty name is > printed correctly. Passing a non-NULL value to openpty()'s name parameter is not safe [quote openpty(1)] BUGS Nobody knows how much space should be reserved for name. So, call= - ing openpty() or forkpty() with non-NULL name may not be secure. [/quote] If BSD has no other way to determine the PTY name, then at least it should be conditionalized so that systems with ptsname() use it, only falling back to using the 'name' arg to openpty() for OS lacking ptsname Regards, Daniel --=20 |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange= / :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 950= 5 :|