Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jul 2008 11:20:55 +0200
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Alexander Leidinger <Alexander@Leidinger.net>
Cc:        freebsd-emulation@FreeBSD.org, "Sean C. Farley" <scf@FreeBSD.org>, Chagin Dmitry <chagin.dmitry@gmail.com>
Subject:   [PATCH]: Re: kern/122318 (CMake core dumping, chroot exiting)
Message-ID:  <20080727092055.GA64264@freebsd.org>
In-Reply-To: <20080727090309.GA63345@freebsd.org>
References:  <alpine.BSF.1.10.0807240016340.28898@ora.chd.net> <alpine.BSF.1.10.0807231616570.12600@thor.farley.org> <20080725082156.GA41887@freebsd.org> <20080725083122.GA42835@freebsd.org> <alpine.BSF.1.10.0807251233470.1710@ora.chd.net> <alpine.BSF.1.10.0807251231050.30805@thor.farley.org> <alpine.BSF.1.10.0807252318130.1162@ora.chd.net> <alpine.BSF.1.10.0807251511230.31063@thor.farley.org> <20080726083110.5d932695@deskjail> <20080727090309.GA63345@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 27, 2008 at 11:03:10AM +0200, Roman Divacky wrote:
> On Sat, Jul 26, 2008 at 08:31:10AM +0200, Alexander Leidinger wrote:
> > Quoting "Sean C. Farley" <scf@FreeBSD.org> (Fri, 25 Jul 2008 15:36:52
> > -0500 (CDT)):
> > 
> > > On Fri, 25 Jul 2008, Chagin Dmitry wrote:
> > 
> > > > uname must work on all supported linuxulators
> > > 
> > > I agree, and it does work until I start playing with the Linux version.
> > 
> > Don't play with the linux version while linux programs are running.
> > Changing the version from 2.4.x to 2.6.x and vice versa while a program
> > is running is not supported at all and known to cause havoc. Roman, do
> > we have the possibility to make an easy check in the sysctl handler if
> > a linux program is still running and return an error from the handler?
> > Did I forgot something which makes it impossible to switch when a
> > program was run under 2.6 and stopped?
> 
> I'll submit a patch that makes it impossible to switch the veresion when
> programs are running... it's not hard (elf{32}_brand_inuse() for every
> elf brand the linuxulator registered)

here it is:

Index: linux_mib.c
===================================================================
--- linux_mib.c	(revision 180831)
+++ linux_mib.c	(working copy)
@@ -251,8 +251,17 @@
 {
 	struct prison *pr;
 	struct linux_prison *lpr;
+	Elf32_Brandinfo **brandinfo;
 	int use26;
 
+	for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
+		++brandinfo)
+		if (elf32_brand_inuse(*brandinfo)) {
+		   printf("Cannot change osrelease while Linux binaries are running.\r\n");
+		   return (EBUSY);
+		}
+
+
 	use26 = (strlen(osrelease) >= 3 && osrelease[2] == '6');
 
 	pr = linux_get_prison(td);

it's a copy'n'paste from i386/linux/linux_sysvec.c so I didnt bother to test it ;) but I
guess it works :)

roman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080727092055.GA64264>