Date: Sat, 30 Jan 2010 18:11:41 +0000 (UTC) From: Robert Watson <rwatson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r203204 - in projects/capabilities8: lib/libc/gen lib/libcapability libexec/rtld-elf libexec/rtld-elf-cap Message-ID: <201001301811.o0UIBfhQ067967@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rwatson Date: Sat Jan 30 18:11:41 2010 New Revision: 203204 URL: http://svn.freebsd.org/changeset/base/203204 Log: Merge c169400 from the p4 TrustedBSD Capabilities branch to capabilities8: Rename many references to caplibinde to libcache, as that's a more accurate name for the functionality. This changes the host<->sandbox ABI so requires recompiling/reinstalling rtld/libcapability. Sponsored by: Google, Inc. Modified: projects/capabilities8/lib/libc/gen/Symbol.map projects/capabilities8/lib/libc/gen/ld_libcache.c projects/capabilities8/lib/libcapability/libcapability.h projects/capabilities8/lib/libcapability/libcapability_host.c projects/capabilities8/libexec/rtld-elf-cap/Symbol.map projects/capabilities8/libexec/rtld-elf-cap/rtld-elf-cap.1 projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.c projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.h projects/capabilities8/libexec/rtld-elf/rtld.c Modified: projects/capabilities8/lib/libc/gen/Symbol.map ============================================================================== --- projects/capabilities8/lib/libc/gen/Symbol.map Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/lib/libc/gen/Symbol.map Sat Jan 30 18:11:41 2010 (r203204) @@ -340,7 +340,7 @@ FBSD_1.1 { fts_read; fts_set; fts_set_clientptr; - ld_caplibindex_lookup; + ld_libcache_lookup; ld_insandbox; posix_spawn; posix_spawn_file_actions_addclose; Modified: projects/capabilities8/lib/libc/gen/ld_libcache.c ============================================================================== --- projects/capabilities8/lib/libc/gen/ld_libcache.c Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/lib/libc/gen/ld_libcache.c Sat Jan 30 18:11:41 2010 (r203204) @@ -33,9 +33,9 @@ #include <errno.h> -#pragma weak ld_caplibindex_lookup +#pragma weak ld_libcache_lookup int -ld_caplibindex_lookup(const char *libname, int *fdp) +ld_libcache_lookup(const char *libname, int *fdp) { errno = EOPNOTSUPP; Modified: projects/capabilities8/lib/libcapability/libcapability.h ============================================================================== --- projects/capabilities8/lib/libcapability/libcapability.h Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/lib/libcapability/libcapability.h Sat Jan 30 18:11:41 2010 (r203204) @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#24 $ + * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#25 $ */ #ifndef _LIBCAPABILITY_H_ @@ -148,7 +148,7 @@ int lcs_sendrpc_rights(struct lc_host *l * Actually an rtld-elf-cap symbol, but declared here so it is available to * applications. */ -int ld_caplibindex_lookup(const char *libname, int *fdp); +int ld_libcache_lookup(const char *libname, int *fdp); int ld_insandbox(void); /* Modified: projects/capabilities8/lib/libcapability/libcapability_host.c ============================================================================== --- projects/capabilities8/lib/libcapability/libcapability_host.c Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/lib/libcapability/libcapability_host.c Sat Jan 30 18:11:41 2010 (r203204) @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability_host.c#22 $ + * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability_host.c#23 $ */ #include <sys/param.h> @@ -214,7 +214,7 @@ lch_sandbox(int fd_sock, int fd_sandbox, sbuf_finish(sbufp); if (sbuf_overflowed(sbufp)) return; - if (setenv("LD_CAPLIBINDEX", sbuf_data(sbufp), 1) == -1) + if (setenv("LD_LIBCACHE", sbuf_data(sbufp), 1) == -1) return; sbuf_delete(sbufp); @@ -255,16 +255,16 @@ lch_startfd_libs(int fd_sandbox, const c bzero(lcsp, sizeof(*lcsp)); if (ld_insandbox()) { - if (ld_caplibindex_lookup(LD_ELF_CAP_SO, &fd_ldso) < 0) + if (ld_libcache_lookup(LD_ELF_CAP_SO, &fd_ldso) < 0) goto out_error; - if (ld_caplibindex_lookup(LIBC_SO, &fd_libc) < 0) + if (ld_libcache_lookup(LIBC_SO, &fd_libc) < 0) goto out_error; - if (ld_caplibindex_lookup(LIBCAPABILITY_SO, + if (ld_libcache_lookup(LIBCAPABILITY_SO, &fd_libcapability) < 0) goto out_error; - if (ld_caplibindex_lookup(LIBSBUF_SO, &fd_libsbuf) < 0) + if (ld_libcache_lookup(LIBSBUF_SO, &fd_libsbuf) < 0) goto out_error; - if (ld_caplibindex_lookup(_PATH_DEVNULL, &fd_devnull) < 0) + if (ld_libcache_lookup(_PATH_DEVNULL, &fd_devnull) < 0) goto out_error; } else { fd_ldso = open(PATH_LD_ELF_CAP_SO "/" LD_ELF_CAP_SO, Modified: projects/capabilities8/libexec/rtld-elf-cap/Symbol.map ============================================================================== --- projects/capabilities8/libexec/rtld-elf-cap/Symbol.map Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/libexec/rtld-elf-cap/Symbol.map Sat Jan 30 18:11:41 2010 (r203204) @@ -3,6 +3,6 @@ */ FBSD_1.1 { - ld_caplibindex_lookup; + ld_libcache_lookup; ld_insandbox; }; Modified: projects/capabilities8/libexec/rtld-elf-cap/rtld-elf-cap.1 ============================================================================== --- projects/capabilities8/libexec/rtld-elf-cap/rtld-elf-cap.1 Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/libexec/rtld-elf-cap/rtld-elf-cap.1 Sat Jan 30 18:11:41 2010 (r203204) @@ -68,7 +68,7 @@ the different environments. Interprets the .Dv LD_CAPLIBINDEX environmental variable set by sandbox start routines, and implements -.Fn ld_caplibindex_lookup , +.Fn ld_libcache_lookup , allowing file descriptors for binaries and libraries passed across .Xr fexecve 2 to be used by Modified: projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.c ============================================================================== --- projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.c Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.c Sat Jan 30 18:11:41 2010 (r203204) @@ -55,21 +55,21 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include "rtld.h" -#include "rtld_caplibindex.h" +#include "rtld_libcache.h" -struct libindex_entry { +struct libcache_entry { char *lie_name; int lie_fd; - TAILQ_ENTRY(libindex_entry) lie_list; + TAILQ_ENTRY(libcache_entry) lie_list; }; -static TAILQ_HEAD(, libindex_entry) ld_caplibindex_list = - TAILQ_HEAD_INITIALIZER(ld_caplibindex_list); +static TAILQ_HEAD(, libcache_entry) ld_libcache_list = + TAILQ_HEAD_INITIALIZER(ld_libcache_list); static void -ld_caplibindex_add(const char *name, const char *fdnumber) +ld_libcache_add(const char *name, const char *fdnumber) { - struct libindex_entry *liep; + struct libcache_entry *liep; long long l; char *endp; @@ -83,15 +83,15 @@ ld_caplibindex_add(const char *name, con liep = xmalloc(sizeof(*liep)); liep->lie_name = xstrdup(name); liep->lie_fd = l; - TAILQ_INSERT_TAIL(&ld_caplibindex_list, liep, lie_list); + TAILQ_INSERT_TAIL(&ld_libcache_list, liep, lie_list); } int -ld_caplibindex_lookup(const char *libname, int *fdp) +ld_libcache_lookup(const char *libname, int *fdp) { - struct libindex_entry *liep; + struct libcache_entry *liep; - TAILQ_FOREACH(liep, &ld_caplibindex_list, lie_list) { + TAILQ_FOREACH(liep, &ld_libcache_list, lie_list) { if (strcmp(liep->lie_name, libname) == 0) { *fdp = liep->lie_fd; return (0); @@ -101,17 +101,17 @@ ld_caplibindex_lookup(const char *libnam } void -ld_caplibindex_init(const char *caplibindex) +ld_libcache_init(const char *libcache) { - char *caplibindex_copy, *caplibindex_tofree; + char *libcache_copy, *libcache_tofree; char *entry, *fdnumber; - caplibindex_copy = caplibindex_tofree = xstrdup(caplibindex); - while ((entry = strsep(&caplibindex_copy, ",")) != NULL) { + libcache_copy = libcache_tofree = xstrdup(libcache); + while ((entry = strsep(&libcache_copy, ",")) != NULL) { fdnumber = strsep(&entry, ":"); if (fdnumber == NULL) continue; - ld_caplibindex_add(entry, fdnumber); + ld_libcache_add(entry, fdnumber); } - free(caplibindex_tofree); + free(libcache_tofree); } Modified: projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.h ============================================================================== --- projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.h Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/libexec/rtld-elf-cap/rtld_libcache.h Sat Jan 30 18:11:41 2010 (r203204) @@ -34,7 +34,7 @@ #ifndef RTLD_CAPLIBINDEX_H #define RTLD_CAPLIBINDEX_H -int ld_caplibindex_lookup(const char *libname, int *fdp); -void ld_caplibindex_init(const char *caplibindex); +int ld_libcache_lookup(const char *libname, int *fdp); +void ld_libcache_init(const char *libcache); #endif /* !RTLD_CAPLIBINDEX_H */ Modified: projects/capabilities8/libexec/rtld-elf/rtld.c ============================================================================== --- projects/capabilities8/libexec/rtld-elf/rtld.c Sat Jan 30 18:05:18 2010 (r203203) +++ projects/capabilities8/libexec/rtld-elf/rtld.c Sat Jan 30 18:11:41 2010 (r203204) @@ -60,7 +60,7 @@ #include "rtld_tls.h" #ifdef IN_RTLD_CAP -#include "rtld_caplibindex.h" +#include "rtld_libcache.h" #include "rtld_sandbox.h" #endif @@ -192,7 +192,7 @@ static char *ld_elf_hints_path; /* Envir static char *ld_tracing; /* Called from ldd to print libs */ static char *ld_utrace; /* Use utrace() to log events. */ #ifdef IN_RTLD_CAP -static char *ld_caplibindex; +static char *ld_libcache; #endif static Obj_Entry *obj_list; /* Head of linked list of shared objects */ static Obj_Entry **obj_tail; /* Link field of last object in list */ @@ -245,7 +245,7 @@ static func_ptr_type exports[] = { (func_ptr_type) &_rtld_atfork_pre, (func_ptr_type) &_rtld_atfork_post, #ifdef IN_RTLD_CAP - (func_ptr_type) &ld_caplibindex_lookup, + (func_ptr_type) &ld_libcache_lookup, (func_ptr_type) &ld_insandbox, #endif NULL @@ -439,7 +439,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ } ld_debug = getenv(LD_ "DEBUG"); #ifdef IN_RTLD_CAP - ld_caplibindex = getenv(LD_ "CAPLIBINDEX"); + ld_libcache = getenv(LD_ "LIBCACHE"); #else libmap_disable = getenv(LD_ "LIBMAP_DISABLE") != NULL; libmap_override = getenv(LD_ "LIBMAP"); @@ -554,8 +554,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ sym_zero.st_value = -(uintptr_t)obj_main->relocbase; #ifdef IN_RTLD_CAP - if (ld_caplibindex != NULL) - ld_caplibindex_init(ld_caplibindex); + if (ld_libcache != NULL) + ld_libcache_init(ld_libcache); #endif #ifndef IN_RTLD_CAP @@ -1632,8 +1632,8 @@ load_object(const char *name, const Obj_ return NULL; } path = xstrdup(name); - if (ld_caplibindex_lookup(path, &fd) < 0) { - _rtld_error("Unable to find \"%s\" in LD_CAPLIBINDEX", path); + if (ld_libcache_lookup(path, &fd) < 0) { + _rtld_error("Unable to find \"%s\" in LD_LIBCACHE", path); return NULL; } #else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001301811.o0UIBfhQ067967>