Date: Tue, 9 Jan 2007 16:07:21 -0500 From: John Baldwin <jhb@freebsd.org> To: Divacky Roman <xdivac02@stud.fit.vutbr.cz> Cc: Roman Divacky <rdivacky@freebsd.org>, Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 112535 for review Message-ID: <200701091607.22013.jhb@freebsd.org> In-Reply-To: <20070109203308.GA32081@stud.fit.vutbr.cz> References: <200701050802.l0582Gnq067583@repoman.freebsd.org> <200701091317.06685.jhb@freebsd.org> <20070109203308.GA32081@stud.fit.vutbr.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701091607.22013.jhb>