From owner-freebsd-stable@FreeBSD.ORG Sun Jul 26 12:43:21 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1A4C1065670; Sun, 26 Jul 2009 12:43:21 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 77C648FC13; Sun, 26 Jul 2009 12:43:21 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 6139841C6BB; Sun, 26 Jul 2009 14:25:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id vXpDsJzww50g; Sun, 26 Jul 2009 14:25:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 9996441C6A7; Sun, 26 Jul 2009 14:25:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 5810D4448E6; Sun, 26 Jul 2009 12:23:56 +0000 (UTC) Date: Sun, 26 Jul 2009 12:23:56 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Kostik Belousov In-Reply-To: <20090726120608.GE55190@deviant.kiev.zoral.com.ua> Message-ID: <20090726122230.E245@maildrop.int.zabbadoz.net> References: <4A6B0BD3.6040206@protected-networks.net> <4A6B9A60.90302@FreeBSD.org> <4A6BAC1A.5080303@protected-networks.net> <20090726120608.GE55190@deviant.kiev.zoral.com.ua> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-stable , Jamie Gritton Subject: Re: regression with jexec? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2009 12:43:22 -0000 On Sun, 26 Jul 2009, Kostik Belousov wrote: > On Sat, Jul 25, 2009 at 09:06:34PM -0400, Michael Butler wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Jamie Gritton wrote: >>> Michael Butler wrote: >>>> imb@aaron:/home/imb> sudo jexec 5 tcsh >>>> jexec: Unable to parse jail ID.: No such file or directory >> >>> >>> The symptom in jexec can be fixed by this little patch: >>> >>> Index: usr.sbin/jexec/jexec.c >>> =================================================================== >>> --- usr.sbin/jexec/jexec.c (revision 195879) >>> +++ usr.sbin/jexec/jexec.c (working copy) >>> @@ -248,6 +248,7 @@ >>> if (argc < 2) >>> usage(); >>> if (strlen(argv[0]) > 0) { >>> + errno = 0; >>> jid = (int)strtol(argv[0], NULL, 10); >>> if (errno) >>> err(1, "Unable to parse jail ID."); >> >> Thanks - this certainly cures the effect. >> >>> But the broader problem is malloc. It's leaving errno set to >>> ENOENT when /etc/malloc.conf doesn't exist. This seems like >>> wrong behavior to me. >> >> Seems like a POLA violation to me, > > No, this is how errno generally work, it is not changed if no error > happens. I haven't really understood which part, when and why would set the errno in first place so that it would still be there? Is it something in jexec that gets the errno in first place or is it something internal to malloc that sets it returns successfully and doesn't clear it? -- Bjoern A. Zeeb The greatest risk is not taking one.