From owner-p4-projects@FreeBSD.ORG Tue Jan 9 21:12:28 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 75E6C16A492; Tue, 9 Jan 2007 21:12:28 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C12B116A415; Tue, 9 Jan 2007 21:12:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 47E9213C455; Tue, 9 Jan 2007 21:12:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id l09LCOD8078595; Tue, 9 Jan 2007 16:12:25 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Divacky Roman Date: Tue, 9 Jan 2007 16:07:21 -0500 User-Agent: KMail/1.9.1 References: <200701050802.l0582Gnq067583@repoman.freebsd.org> <200701091317.06685.jhb@freebsd.org> <20070109203308.GA32081@stud.fit.vutbr.cz> In-Reply-To: <20070109203308.GA32081@stud.fit.vutbr.cz> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701091607.22013.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 09 Jan 2007 16:12:25 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2430/Tue Jan 9 12:35:51 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Roman Divacky , Perforce Change Reviews Subject: Re: PERFORCE change 112535 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2007 21:12:28 -0000 On Tuesday 09 January 2007 15:33, Divacky Roman wrote: > On Tue, Jan 09, 2007 at 01:17:06PM -0500, John Baldwin wrote: > > > > > @@ -237,12 +237,10 @@ > > > > > > > > > > pr = td->td_ucred->cr_prison; > > > > > if (pr != NULL) { > > > > > - mtx_lock(&pr->pr_mtx); > > > > > if (pr->pr_linux != NULL) { > > > > > lpr = (struct linux_prison *)pr->pr_linux; > > > > > use26 = lpr->pr_use_linux26; > > > > > } > > > > > - mtx_unlock(&pr->pr_mtx); > > > > > } else > > > > > use26 = linux_use_linux26; > > > > > > > > > > > > > > > > > > Hmm, what is use26 set to if pr != NULL but pr->pr_linux == NULL? > > > > > > to the default value of 0 > > > > Shouldn't it be set to linux_use_26 in that case? > > as I understand the code such condition should not happen under > normal condition and is a sign of something bad's going on. No, it is quite normal. By default linux processes in a jail use the base system's settings. When you go to change a setting via sysctl inside a jail, then that jail grows its own linux prison "on demand" to hold those settings and not change the settings in the base system. The case you are ignoring here is that the sysadmin has set the Linux OS version for the base system to be "2.6.12". By default all jails should be inheriting that. In fact, linux_get_osname() will return "2.6.12", so glibc inside the jail will think it is on a 2.6.x system, as will 'uname'. However, the linux compat layer will incorrectly think it isn't and apps will probably break. Look at linux_get_osname()'s logic for example: void linux_get_osname(struct thread *td, char *dst) { register struct prison *pr; register struct linux_prison *lpr; pr = td->td_ucred->cr_prison; if (pr != NULL) { mtx_lock(&pr->pr_mtx); if (pr->pr_linux != NULL) { lpr = (struct linux_prison *)pr->pr_linux; if (lpr->pr_osname[0]) { bcopy(lpr->pr_osname, dst, LINUX_MAX_UTSNAME); mtx_unlock(&pr->pr_mtx); return; } } mtx_unlock(&pr->pr_mtx); } mtx_lock(&osname_lock); bcopy(linux_osname, dst, LINUX_MAX_UTSNAME); mtx_unlock(&osname_lock); } -- John Baldwin