[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#334120: Patch to include more files from the build tree in libc6-pic: allows Plash to build custom glibc



Package: glibc
Version: 2.3.5-6
Severity: wishlist
Tags: patch

This patch changes rules.d/debhelper.mk to copy various files from the
glibc build tree into the libc6-pic package.

This allows Plash to build its modified version of glibc from
libc6-pic.

Background: Plash is a secure, restricted execution environment that
provides functionality similar to chroot(), but more flexible and
lightweight.  It works partly by dynamically linking Linux executables
with a modified glibc.  This is not used for taking authority away
from a process, only for giving it back.  This approach is more
complete than using LD_PRELOADed libraries.  There's more information
on what Plash does at <http://plash.beasts.org>.

Once this patch is applied it should be possible to put Plash into
Debian.

I'm filing a second BTS entry for a patch to glibc itself for
preventing some system calls from being inlined, which Plash also
needs.

Mark
diff -ur glibc-2.3.5.orig/debian/rules.d/debhelper.mk glibc-2.3.5.orig/debian/rules.d/debhelper.mk
--- glibc-2.3.5.orig/debian/rules.d/debhelper.mk	Thu Sep 29 14:45:25 2005
+++ glibc-2.3.5.orig/debian/rules.d/debhelper.mk	Thu Sep 29 16:44:04 2005
@@ -2,6 +2,25 @@
 # renames.  There's very little we can do for now.  Maybe after
 # Sarge releases we can consider breaking packages, but certainly not now.
 
+
+# This is a list of files needed for building Plash's version of ld.so.
+# They are not built in the normal course of glibc's build process
+# because they are not normally linked into ld.so.
+PLASH_RTLD_EXTRA_OBJS = \
+	socket/rtld-recvmsg.os \
+        socket/rtld-sendmsg.os \
+        socket/rtld-send.os \
+        socket/rtld-cmsg_nxthdr.os \
+        io/rtld-fstat.os \
+	io/rtld-fxstat.os \
+        io/rtld-xstat64.os \
+	io/rtld-xstatconv.os \
+        io/rtld-dup.os \
+        stdlib/rtld-getenv.os \
+        string/rtld-strncmp.os \
+	string/rtld-strcpy.os
+
+
 $(stamp)binaryinst_$(libc)-pic:: $(stamp)debhelper
 	@echo Running special kludge for $(libc)-pic
 	dh_testroot
@@ -10,6 +29,21 @@
 	install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/libc.map debian/$(libc)-pic/usr/lib/libc_pic.map
 	install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/elf/soinit.os debian/$(libc)-pic/usr/lib/libc_pic/soinit.o
 	install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/elf/sofini.os debian/$(libc)-pic/usr/lib/libc_pic/sofini.o
+
+	for FILE in $(PLASH_RTLD_EXTRA_OBJS); do \
+	  $(MAKE) -C $(DEB_SRCDIR)/`dirname $$FILE` objdir=`pwd`/build-tree/$(DEB_HOST_ARCH)-libc -f Makefile -f ../elf/rtld-Rules rtld-all rtld-modules=`basename $$FILE`; \
+	done
+
+	# NB. Installs elf/so{init,fini}.os a second time, but this
+	# time under their full filename.
+	set -e; \
+        for F in `cat debian/plash-export-list`; do \
+	  install -D --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/$$F debian/$(libc)-pic/usr/lib/libc_pic/$$F; \
+	  strip --strip-debug debian/$(libc)-pic/usr/lib/libc_pic/$$F; \
+	done; \
+	for F in `cat debian/plash-export-list-nonobj`; do \
+	  install -D --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/$$F debian/$(libc)-pic/usr/lib/libc_pic/$$F; \
+	done
 
 	install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/math/libm_pic.a debian/$(libc)-pic/usr/lib/.
 	install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/libm.map debian/$(libc)-pic/usr/lib/libm_pic.map
diff -urN glibc-2.3.5.orig/debian/plash-export-list glibc-2.3.5.orig/debian/plash-export-list
--- glibc-2.3.5.orig/debian/plash-export-list	Wed Dec 31 19:00:00 1969
+++ glibc-2.3.5.orig/debian/plash-export-list	Thu Sep 29 16:49:18 2005
@@ -0,0 +1,71 @@
+csu/abi-note.o
+csu/rtld-check_fds.os
+csu/rtld-divdi3.os
+csu/rtld-errno-loc.os
+csu/rtld-errno.os
+elf/dl-allobjs.os
+elf/interp.os
+elf/sofini.os
+elf/soinit.os
+gmon/rtld-prof-freq.os
+gmon/rtld-profil.os
+io/close.os
+io/fstat.oS
+io/fxstat.os
+io/rtld-close.os
+io/rtld-dup.os
+io/rtld-fcntl.os
+io/rtld-fstat.os
+io/rtld-fxstat.os
+io/rtld-lseek.os
+io/rtld-read.os
+io/rtld-write.os
+io/rtld-xstat64.os
+io/rtld-xstatconv.os
+io/xstat64.os
+io/xstatconv.os
+linuxthreads/crti.o
+linuxthreads/crtn.o
+linuxthreads/libc-tsd.os
+linuxthreads/libpthread_pic.a
+linuxthreads/rtld-forward.os
+linuxthreads/rtld-libc-cancellation.os
+misc/rtld-getpagesize.os
+misc/rtld-mmap.os
+misc/rtld-mprotect.os
+misc/rtld-munmap.os
+posix/execve.os
+posix/fork.os
+posix/getegid.os
+posix/geteuid.os
+posix/getgid.os
+posix/getuid.os
+posix/rtld-_exit.os
+posix/rtld-environ.os
+posix/rtld-getpid.os
+posix/rtld-uname.os
+setjmp/rtld-__longjmp.os
+setjmp/rtld-bsd-_setjmp.os
+signal/rtld-sigaction.os
+socket/bind.os
+socket/connect.os
+socket/rtld-cmsg_nxthdr.os
+socket/rtld-recvmsg.os
+socket/rtld-send.os
+socket/rtld-sendmsg.os
+stdlib/rtld-cxa_atexit.os
+stdlib/rtld-exit.os
+stdlib/rtld-getenv.os
+string/rtld-memchr.os
+string/rtld-memcpy.os
+string/rtld-memmove.os
+string/rtld-mempcpy.os
+string/rtld-memset.os
+string/rtld-stpcpy.os
+string/rtld-strchr.os
+string/rtld-strcmp.os
+string/rtld-strcpy.os
+string/rtld-strlen.os
+string/rtld-strncmp.os
+string/rtld-strnlen.os
+time/rtld-setitimer.os
diff -urN glibc-2.3.5.orig/debian/plash-export-list-nonobj glibc-2.3.5.orig/debian/plash-export-list-nonobj
--- glibc-2.3.5.orig/debian/plash-export-list-nonobj	Wed Dec 31 19:00:00 1969
+++ glibc-2.3.5.orig/debian/plash-export-list-nonobj	Thu Sep 29 16:49:18 2005
@@ -0,0 +1,3 @@
+ld.map
+libpthread.map
+shlib.lds

Reply to: