Date: Tue, 20 Jun 2006 11:18:07 +0200 From: Divacky Roman <xdivac02@stud.fit.vutbr.cz> To: John Baldwin <jhb@freebsd.org> Cc: Roman Divacky <rdivacky@freebsd.org>, Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 99406 for review Message-ID: <20060620091807.GA99542@stud.fit.vutbr.cz> In-Reply-To: <200606191002.26358.jhb@freebsd.org> References: <200606170857.k5H8vYVk017130@repoman.freebsd.org> <200606191002.26358.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060620091807.GA99542>