From owner-p4-projects@FreeBSD.ORG Mon Jun 19 14:12:48 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 BC2D116A60F; Mon, 19 Jun 2006 14:12:48 +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 7BD0716A60D; Mon, 19 Jun 2006 14:12:48 +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 EF07D43D48; Mon, 19 Jun 2006 14:12:46 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k5JECVEQ016579; Mon, 19 Jun 2006 10:12:45 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Roman Divacky Date: Mon, 19 Jun 2006 10:02:25 -0400 User-Agent: KMail/1.9.1 References: <200606170857.k5H8vYVk017130@repoman.freebsd.org> In-Reply-To: <200606170857.k5H8vYVk017130@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200606191002.26358.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Mon, 19 Jun 2006 10:12:45 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1549/Sat Jun 17 18:20:39 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: 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: Mon, 19 Jun 2006 14:12:49 -0000 On Saturday 17 June 2006 04:57, Roman Divacky wrote: > http://perforce.freebsd.org/chv.cgi?CH=3D99406 >=20 > Change 99406 by rdivacky@rdivacky_witten on 2006/06/17 08:56:59 >=20 > Change the emulpath sysctl to be per-prison. >=20 > =3D=3D=3D=3D //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/l= inux_mib.c#3 (text+ko) =3D=3D=3D=3D >=20 > @@ -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; > =20 > @@ -99,10 +99,39 @@ > if (error || req->newptr =3D=3D NULL) > return (error); > error =3D linux_set_emul_path(req->td, emul_path); > - for (brandinfo =3D &linux_brandlist[0]; *brandinfo !=3D NULL; > - ++brandinfo) > - if (elf32_insert_brand_entry(*brandinfo) < 0) > - error =3D EINVAL; =20 > + { > + static Elf32_Brandinfo linux_brand =3D { > + 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 =3D { > + ELFOSABI_LINUX, > + EM_386, > + "Linux", > + emul_path, > + "/lib/ld-linux.so.2", > + &elf_linux_sysvec, > + NULL, > + BI_CAN_EXEC_DYN, > + }; > + =09 > + Elf32_Brandinfo *local_linux_brandlist[] =3D { > + &linux_brand, > + &linux_glibc2brand, > + NULL > + }; > + > + for (brandinfo =3D &local_linux_brandlist[0]; *brandinfo !=3D NU= LL; > + ++brandinfo) > + if (elf32_insert_brand_entry(*brandinfo) < 0) > + error =3D EINVAL; =20 > + } > 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() 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. =2D-=20 John Baldwin =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org