From owner-p4-projects@FreeBSD.ORG Tue Jun 20 09:18:16 2006 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 D21A616A47E; Tue, 20 Jun 2006 09:18:15 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AAC0E16A474; Tue, 20 Jun 2006 09:18:15 +0000 (UTC) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4A5D43D45; Tue, 20 Jun 2006 09:18:13 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.7/8.13.7) with ESMTP id k5K9I83R099633 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 20 Jun 2006 11:18:08 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.7/8.13.3/Submit) id k5K9I70S099632; Tue, 20 Jun 2006 11:18:07 +0200 (CEST) Date: Tue, 20 Jun 2006 11:18:07 +0200 From: Divacky Roman To: John Baldwin Message-ID: <20060620091807.GA99542@stud.fit.vutbr.cz> References: <200606170857.k5H8vYVk017130@repoman.freebsd.org> <200606191002.26358.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200606191002.26358.jhb@freebsd.org> User-Agent: Mutt/1.4.2i X-Scanned-By: MIMEDefang 2.54 on 147.229.10.14 Cc: Roman Divacky , Perforce Change Reviews Subject: Re: PERFORCE change 99406 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, 20 Jun 2006 09:18:16 -0000 On Mon, Jun 19, 2006 at 10:02:25AM -0400, John Baldwin wrote: > On Saturday 17 June 2006 04:57, Roman Divacky wrote: > > http://perforce.freebsd.org/chv.cgi?CH=99406 > > > > Change 99406 by rdivacky@rdivacky_witten on 2006/06/17 08:56:59 > > > > Change the emulpath sysctl to be per-prison. > > > > ==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_mib.c#3 (text+ko) ==== > > > > @@ -90,7 +90,7 @@ > > static int > > linux_sysctl_linux_emul_path(SYSCTL_HANDLER_ARGS) > > { > > - char emul_path[LINUX_NAME_MAX]; > > + static char emul_path[LINUX_NAME_MAX]; > > int error; > > Elf32_Brandinfo **brandinfo; > > > > @@ -99,10 +99,39 @@ > > if (error || req->newptr == NULL) > > return (error); > > error = linux_set_emul_path(req->td, emul_path); > > - for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; > > - ++brandinfo) > > - if (elf32_insert_brand_entry(*brandinfo) < 0) > > - error = EINVAL; > > + { > > + static Elf32_Brandinfo linux_brand = { > > + ELFOSABI_LINUX, > > + EM_386, > > + "Linux", > > + emul_path, > > + "/lib/ld-linux.so.1", > > + &elf_linux_sysvec, > > + NULL, > > + BI_CAN_EXEC_DYN, > > + }; > > + static Elf32_Brandinfo linux_glibc2brand = { > > + ELFOSABI_LINUX, > > + EM_386, > > + "Linux", > > + emul_path, > > + "/lib/ld-linux.so.2", > > + &elf_linux_sysvec, > > + NULL, > > + BI_CAN_EXEC_DYN, > > + }; > > + > > + Elf32_Brandinfo *local_linux_brandlist[] = { > > + &linux_brand, > > + &linux_glibc2brand, > > + NULL > > + }; > > + > > + for (brandinfo = &local_linux_brandlist[0]; *brandinfo != NULL; > > + ++brandinfo) > > + if (elf32_insert_brand_entry(*brandinfo) < 0) > > + error = EINVAL; > > + } > > return (error); > > } > > I don't think this is going to work because the brand lists aren't > per-prison, they are one shared list. That is, once you create a > jail and try to change the path, the insert's will add new entries > to the end of the list, but an earlier entry for another jail > might handle the binary instead. Also, elf32_insert_brand_entry() hm... so there's no (easy) way to do it per-prison, right? > saves the pointer you pass to it, and your pointers are for variables > that are on the stack which will become garbage when this function > returns. the variable is declared static so it should work