Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Oct 2009 15:52:41 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 169400 for review
Message-ID:  <200910111552.n9BFqff5041762@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=169400

Change 169400 by rwatson@rwatson_freebsd_capabilities on 2009/10/11 15:52:34

	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.

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/lib/libc/gen/Symbol.map#14 edit
.. //depot/projects/trustedbsd/capabilities/src/lib/libc/gen/ld_libcache.c#2 edit
.. //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#25 edit
.. //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability_host.c#23 edit
.. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/Symbol.map#5 edit
.. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld-elf-cap.1#9 edit
.. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld_libcache.c#2 edit
.. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld_libcache.h#2 edit
.. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/rtld.c#26 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/lib/libc/gen/Symbol.map#14 (text) ====

@@ -369,7 +369,7 @@
 FBSD_1.2 {
 	basename_r;
 	getpagesizes;
-	ld_caplibindex_lookup;
+	ld_libcache_lookup;
 	ld_insandbox;
 };
 

==== //depot/projects/trustedbsd/capabilities/src/lib/libc/gen/ld_libcache.c#2 (text+ko) ====

@@ -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;

==== //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#25 (text+ko) ====

@@ -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 @@
  * 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);
 
 /*

==== //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability_host.c#23 (text+ko) ====

@@ -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 @@
 	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 @@
 	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,

==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/Symbol.map#5 (text+ko) ====

@@ -3,6 +3,6 @@
  */
 
 FBSD_1.1 {
-    ld_caplibindex_lookup;
+    ld_libcache_lookup;
     ld_insandbox;
 };

==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld-elf-cap.1#9 (text+ko) ====

@@ -68,7 +68,7 @@
 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

==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld_libcache.c#2 (text+ko) ====

@@ -55,21 +55,21 @@
 #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 @@
 	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 @@
 }
 
 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);
 }

==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld_libcache.h#2 (text+ko) ====

@@ -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 */

==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/rtld.c#26 (text+ko) ====

@@ -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_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 @@
     (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
@@ -443,7 +443,7 @@
     }
     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");
@@ -557,8 +557,8 @@
     sym_zero.st_shndx = SHN_UNDEF;
 
 #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
@@ -1633,8 +1633,8 @@
 	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?200910111552.n9BFqff5041762>