PERFORCE change 105655 for review

Paolo Pisati piso at FreeBSD.org
Mon Sep 4 20:10:25 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=105655

Change 105655 by piso at piso_newluxor on 2006/09/04 20:09:45

	IFC

Affected files ...

.. //depot/projects/soc2005/libalias/UPDATING#5 integrate
.. //depot/projects/soc2005/libalias/contrib/openbsm/FREEBSD-upgrade#4 integrate
.. //depot/projects/soc2005/libalias/contrib/openbsm/HISTORY#4 integrate
.. //depot/projects/soc2005/libalias/contrib/openbsm/bin/auditd/auditd.c#3 integrate
.. //depot/projects/soc2005/libalias/contrib/openbsm/configure#4 integrate
.. //depot/projects/soc2005/libalias/contrib/openbsm/configure.ac#4 integrate
.. //depot/projects/soc2005/libalias/contrib/openbsm/libbsm/bsm_token.c#5 integrate
.. //depot/projects/soc2005/libalias/etc/mtree/BSD.usr.dist#4 integrate
.. //depot/projects/soc2005/libalias/etc/rc.initdiskless#3 integrate
.. //depot/projects/soc2005/libalias/lib/libc/gen/tls.c#3 integrate
.. //depot/projects/soc2005/libalias/lib/libc/powerpc/gen/_set_tp.c#3 integrate
.. //depot/projects/soc2005/libalias/lib/libc/stdlib/malloc.c#6 integrate
.. //depot/projects/soc2005/libalias/lib/libpthread/arch/ia64/ia64/pthread_md.c#2 integrate
.. //depot/projects/soc2005/libalias/lib/libpthread/arch/ia64/include/pthread_md.h#2 integrate
.. //depot/projects/soc2005/libalias/lib/libpthread/arch/powerpc/include/pthread_md.h#2 integrate
.. //depot/projects/soc2005/libalias/lib/libpthread/arch/powerpc/powerpc/pthread_md.c#2 integrate
.. //depot/projects/soc2005/libalias/lib/libthr/arch/ia64/ia64/pthread_md.c#3 integrate
.. //depot/projects/soc2005/libalias/lib/libthr/arch/ia64/include/pthread_md.h#3 integrate
.. //depot/projects/soc2005/libalias/lib/libthr/arch/powerpc/include/pthread_md.h#3 integrate
.. //depot/projects/soc2005/libalias/lib/libthr/arch/powerpc/powerpc/pthread_md.c#3 integrate
.. //depot/projects/soc2005/libalias/lib/libutil/pw_util.c#2 integrate
.. //depot/projects/soc2005/libalias/libexec/rtld-elf/ia64/reloc.c#3 integrate
.. //depot/projects/soc2005/libalias/libexec/rtld-elf/powerpc/reloc.c#2 integrate
.. //depot/projects/soc2005/libalias/libexec/rtld-elf/rtld.c#3 integrate
.. //depot/projects/soc2005/libalias/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#8 integrate
.. //depot/projects/soc2005/libalias/sbin/sysctl/sysctl.c#4 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/ata.4#4 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/audit.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/gem.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/ipfirewall.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/le.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/man4.sparc64/ebus.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/man4.sparc64/machfb.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/man4.sparc64/openfirm.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man4/man4.sparc64/sbus.4#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man5/periodic.conf.5#3 integrate
.. //depot/projects/soc2005/libalias/share/man/man8/picobsd.8#2 integrate
.. //depot/projects/soc2005/libalias/share/man/man9/bus_dma.9#3 integrate
.. //depot/projects/soc2005/libalias/sys/bsm/audit_internal.h#3 integrate
.. //depot/projects/soc2005/libalias/sys/compat/freebsd32/freebsd32_proto.h#5 integrate
.. //depot/projects/soc2005/libalias/sys/compat/freebsd32/freebsd32_syscall.h#5 integrate
.. //depot/projects/soc2005/libalias/sys/compat/freebsd32/freebsd32_syscalls.c#5 integrate
.. //depot/projects/soc2005/libalias/sys/compat/freebsd32/freebsd32_sysent.c#5 integrate
.. //depot/projects/soc2005/libalias/sys/compat/freebsd32/syscalls.master#5 integrate
.. //depot/projects/soc2005/libalias/sys/compat/svr4/svr4_stat.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/acpica/acpi_thermal.c#3 integrate
.. //depot/projects/soc2005/libalias/sys/dev/aic7xxx/ahc_eisa.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/aic7xxx/ahc_isa.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/aic7xxx/ahc_pci.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/aic7xxx/ahd_pci.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/ata/ata-chipset.c#6 integrate
.. //depot/projects/soc2005/libalias/sys/dev/ata/ata-dma.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/ata/ata-pci.h#4 integrate
.. //depot/projects/soc2005/libalias/sys/dev/atkbdc/atkbdc.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/bge/if_bge.c#6 integrate
.. //depot/projects/soc2005/libalias/sys/dev/bge/if_bgereg.h#5 integrate
.. //depot/projects/soc2005/libalias/sys/dev/em/if_em.c#7 integrate
.. //depot/projects/soc2005/libalias/sys/dev/gem/if_gem.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/isp/isp_pci.c#6 integrate
.. //depot/projects/soc2005/libalias/sys/dev/mk48txx/mk48txx.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/ofw/openfirmio.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/puc/pucdata.c#3 integrate
.. //depot/projects/soc2005/libalias/sys/dev/usb/ohci_pci.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/dev/vge/if_vge.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/kern/bus_if.m#3 integrate
.. //depot/projects/soc2005/libalias/sys/kern/init_sysent.c#6 integrate
.. //depot/projects/soc2005/libalias/sys/kern/kern_umtx.c#4 integrate
.. //depot/projects/soc2005/libalias/sys/kern/subr_bus.c#4 integrate
.. //depot/projects/soc2005/libalias/sys/kern/syscalls.c#6 integrate
.. //depot/projects/soc2005/libalias/sys/kern/syscalls.master#7 integrate
.. //depot/projects/soc2005/libalias/sys/kern/systrace_args.c#3 integrate
.. //depot/projects/soc2005/libalias/sys/modules/sound/sound/Makefile#3 integrate
.. //depot/projects/soc2005/libalias/sys/net/bpf.h#2 integrate
.. //depot/projects/soc2005/libalias/sys/netinet/udp_usrreq.c#3 integrate
.. //depot/projects/soc2005/libalias/sys/security/audit/audit.h#4 integrate
.. //depot/projects/soc2005/libalias/sys/sparc64/sparc64/mp_machdep.c#2 integrate
.. //depot/projects/soc2005/libalias/sys/sys/_bus_dma.h#1 branch
.. //depot/projects/soc2005/libalias/sys/sys/bus.h#3 integrate
.. //depot/projects/soc2005/libalias/sys/sys/bus_dma.h#2 integrate
.. //depot/projects/soc2005/libalias/sys/sys/msgbuf.h#2 integrate
.. //depot/projects/soc2005/libalias/sys/sys/param.h#5 integrate
.. //depot/projects/soc2005/libalias/sys/sys/syscall.h#6 integrate
.. //depot/projects/soc2005/libalias/sys/sys/syscall.mk#6 integrate
.. //depot/projects/soc2005/libalias/sys/sys/sysproto.h#6 integrate
.. //depot/projects/soc2005/libalias/sys/vm/vm_contig.c#3 integrate
.. //depot/projects/soc2005/libalias/sys/vm/vm_page.h#4 integrate
.. //depot/projects/soc2005/libalias/tools/tools/netrate/http/http.c#2 integrate
.. //depot/projects/soc2005/libalias/usr.bin/su/Makefile#2 integrate
.. //depot/projects/soc2005/libalias/usr.bin/su/su.c#2 integrate
.. //depot/projects/soc2005/libalias/usr.bin/tip/tip/Makefile#3 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/cron/crontab/crontab.c#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/eeprom/eeprom.8#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/eeprom/ofw_options.c#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/freebsd-update/Makefile#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/freebsd-update/freebsd-update.sh#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/ipfwpcap/ipfwpcap.c#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/lmcconfig/Makefile#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/portsnap/portsnap/Makefile#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/sysinstall/devices.c#4 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/watchdogd/watchdog.8#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/watchdogd/watchdogd.8#2 integrate
.. //depot/projects/soc2005/libalias/usr.sbin/wpa/hostapd/hostapd.conf.5#2 integrate

Differences ...

==== //depot/projects/soc2005/libalias/UPDATING#5 (text+ko) ====

@@ -44,6 +44,13 @@
 	the nve(4) driver. Please update your configuration
 	accordingly.
 
+20060514:
+	The i386-only lnc(4) driver for the AMD Am7900 LANCE and Am79C9xx
+	PCnet family of NICs has been removed. The new le(4) driver serves
+	as an equivalent but cross-platform replacement with the pcn(4)
+	driver still providing performance-optimized support for the subset
+	of AMD Am79C971 PCnet-FAST and greater chips as before.
+
 20060511:
 	The machdep.* sysctls and the adjkerntz utility have been
 	modified a bit.  The new adjkerntz utility uses the new
@@ -603,4 +610,4 @@
 Contact Warner Losh if you have any questions about your use of
 this document.
 
-$FreeBSD: src/UPDATING,v 1.453 2006/08/17 00:41:05 julian Exp $
+$FreeBSD: src/UPDATING,v 1.454 2006/09/02 22:17:15 marius Exp $

==== //depot/projects/soc2005/libalias/contrib/openbsm/FREEBSD-upgrade#4 (text) ====

@@ -27,7 +27,15 @@
 - Update any library, tool, or etc BSD Makefiles to add new files,
   defines, or other generally useful or necessary things.
 
-Normally, the CVS vendor import goes along the following lines:
+Certain files are present only in the vendor branch, and not in FreeBSD
+development branches:
+
+  contrib/openbsm/bsm  audit.h audit_internal.h audit_kevents.h 
+                       audit_record.h 
+
+This prevents confusion regarding whether the src/sys/bsm or contrib
+versions of the include files should be used in the build.  Normally, the
+CVS vendor import goes along the following lines:
 
   cd ~/p4/projects/trustedbsd/openbsm
   cvs -n -d rwatson at repoman.FreeBSD.org:/home/ncvs -q import \
@@ -45,4 +53,4 @@
 are necessary, and the commits to various parts of the system must be
 made in close succession.
 
-$FreeBSD: src/contrib/openbsm/FREEBSD-upgrade,v 1.6 2006/08/26 10:35:54 rwatson Exp $
+$FreeBSD: src/contrib/openbsm/FREEBSD-upgrade,v 1.7 2006/09/02 09:56:28 rwatson Exp $

==== //depot/projects/soc2005/libalias/contrib/openbsm/HISTORY#4 (text) ====

@@ -1,3 +1,9 @@
+OpenBSM 1.0 alpha 10
+
+- auditd now generates complete audit records for its events, as required for
+  application-submitted audit records in the the FreeBSD kernel audit
+  implementation.
+
 OpenBSM 1.0 alpha 9
 
 - Rename many OpenBSM-specific constants and API elements containing the
@@ -203,4 +209,4 @@
   to support reloading of kernel event table.
 - Allow comments in /etc/security configuration files.
 
-$P4: //depot/projects/trustedbsd/openbsm/HISTORY#25 $
+$P4: //depot/projects/trustedbsd/openbsm/HISTORY#26 $

==== //depot/projects/soc2005/libalias/contrib/openbsm/bin/auditd/auditd.c#3 (text) ====

@@ -30,7 +30,7 @@
  *
  * @APPLE_BSD_LICENSE_HEADER_END@
  *
- * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#17 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#18 $
  */
 
 #include <sys/types.h>
@@ -366,6 +366,7 @@
 static int
 close_all(void)
 {
+	struct auditinfo ai;
 	int err_ret = 0;
 	char TS[POSTFIX_LEN];
 	int aufd;
@@ -378,6 +379,17 @@
 	else {
 		if ((tok = au_to_text("auditd::Audit shutdown")) != NULL)
 			au_write(aufd, tok);
+		/*
+		 * XXX we need to implement extended subject tokens so we can
+		 * effectively represent terminal lines with this token type.
+		 */
+		bzero(&ai, sizeof(ai));
+		if ((tok = au_to_subject32(getuid(), geteuid(), getegid(),
+		    getuid(), getgid(), getpid(), getpid(), &ai.ai_termid))
+		    != NULL)
+			au_write(aufd, tok);
+		if ((tok = au_to_return32(0, 0)) != NULL)
+			au_write(aufd, tok);
 		if (au_close(aufd, 1, AUE_audit_shutdown) == -1)
 			syslog(LOG_ERR,
 			    "Could not close audit shutdown event.");
@@ -745,6 +757,7 @@
 static void
 setup(void)
 {
+	struct auditinfo ai;
 	auditinfo_t auinfo;
 	int aufd;
 	token_t *tok;
@@ -781,8 +794,20 @@
 	if ((aufd = au_open()) == -1)
 		syslog(LOG_ERR, "Could not create audit startup event.");
 	else {
+		/*
+		 * XXXCSJP Perhaps we wan't more robust audit records for
+		 * audit start up and shutdown. This might include capturing
+		 * failures to initialize the audit subsystem?
+		 */
+		bzero(&ai, sizeof(ai));
+		if ((tok = au_to_subject32(getuid(), geteuid(), getegid(),
+		    getuid(), getgid(), getpid(), getpid(), &ai.ai_termid))
+		    != NULL)
+			au_write(aufd, tok);
 		if ((tok = au_to_text("auditd::Audit startup")) != NULL)
 			au_write(aufd, tok);
+		if ((tok = au_to_return32(0, 0)) != NULL)
+			au_write(aufd, tok);
 		if (au_close(aufd, 1, AUE_audit_startup) == -1)
 			syslog(LOG_ERR,
 			    "Could not close audit startup event.");

==== //depot/projects/soc2005/libalias/contrib/openbsm/configure#4 (text) ====

@@ -1,7 +1,7 @@
 #! /bin/sh
-# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#27 .
+# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#28 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for OpenBSM 1.0a9.
+# Generated by GNU Autoconf 2.59 for OpenBSM 1.0a10.
 #
 # Report bugs to <trustedbsd-audit at TrustesdBSD.org>.
 #
@@ -424,8 +424,8 @@
 # Identity of this package.
 PACKAGE_NAME='OpenBSM'
 PACKAGE_TARNAME='openbsm'
-PACKAGE_VERSION='1.0a9'
-PACKAGE_STRING='OpenBSM 1.0a9'
+PACKAGE_VERSION='1.0a10'
+PACKAGE_STRING='OpenBSM 1.0a10'
 PACKAGE_BUGREPORT='trustedbsd-audit at TrustesdBSD.org'
 
 ac_unique_file="bin/auditreduce/auditreduce.c"
@@ -955,7 +955,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures OpenBSM 1.0a9 to adapt to many kinds of systems.
+\`configure' configures OpenBSM 1.0a10 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1021,7 +1021,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of OpenBSM 1.0a9:";;
+     short | recursive ) echo "Configuration of OpenBSM 1.0a10:";;
    esac
   cat <<\_ACEOF
 
@@ -1162,7 +1162,7 @@
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-OpenBSM configure 1.0a9
+OpenBSM configure 1.0a10
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1176,7 +1176,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by OpenBSM $as_me 1.0a9, which was
+It was created by OpenBSM $as_me 1.0a10, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -19278,7 +19278,7 @@
 
 # Define the identity of the package.
  PACKAGE=OpenBSM
- VERSION=1.0a9
+ VERSION=1.0a10
 
 
 cat >>confdefs.h <<_ACEOF
@@ -23478,7 +23478,7 @@
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by OpenBSM $as_me 1.0a9, which was
+This file was extended by OpenBSM $as_me 1.0a10, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -23541,7 +23541,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-OpenBSM config.status 1.0a9
+OpenBSM config.status 1.0a10
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 

==== //depot/projects/soc2005/libalias/contrib/openbsm/configure.ac#4 (text) ====

@@ -2,8 +2,8 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([OpenBSM], [1.0a9], [trustedbsd-audit at TrustesdBSD.org],[openbsm])
-AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#28 $])
+AC_INIT([OpenBSM], [1.0a10], [trustedbsd-audit at TrustesdBSD.org],[openbsm])
+AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#29 $])
 AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADER([config/config.h])

==== //depot/projects/soc2005/libalias/contrib/openbsm/libbsm/bsm_token.c#5 (text) ====

@@ -1055,7 +1055,7 @@
  * text					count null-terminated strings
  */
 token_t *
-au_to_exec_args(const char **argv)
+au_to_exec_args(char **argv)
 {
 	token_t *t;
 	u_char *dptr = NULL;
@@ -1096,7 +1096,7 @@
  * text					count null-terminated strings
  */
 token_t *
-au_to_exec_env(const char **envp)
+au_to_exec_env(char **envp)
 {
 	token_t *t;
 	u_char *dptr = NULL;

==== //depot/projects/soc2005/libalias/etc/mtree/BSD.usr.dist#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.319 2006/08/03 05:44:51 jb Exp $
+# $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.320 2006/09/02 20:58:37 marcel Exp $
 #
 # Please see the file src/etc/mtree/README before making changes to this file.
 #
@@ -661,6 +661,8 @@
                 ..
                 i386
                 ..
+                powerpc
+                ..
                 sparc64
                 ..
             ..
@@ -694,6 +696,8 @@
                     ..
                     i386
                     ..
+                    powerpc
+                    ..
                     sparc64
                     ..
                 ..
@@ -766,6 +770,8 @@
                 ..
                 i386
                 ..
+                powerpc
+                ..
                 sparc64
                 ..
             ..

==== //depot/projects/soc2005/libalias/etc/rc.initdiskless#3 (text+ko) ====

@@ -24,7 +24,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.initdiskless,v 1.50 2006/08/22 16:21:16 ru Exp $
+# $FreeBSD: src/etc/rc.initdiskless,v 1.51 2006/09/01 16:33:15 brooks Exp $
 
 # On entry to this script the entire system consists of a read-only root
 # mounted via NFS. The kernel has run BOOTP and configured an interface
@@ -76,6 +76,9 @@
 #		If the file contains a pathname starting with "/", then
 #		the root path is prepended to it; this allows relocation of
 #		the root filesystem without changing configuration files.
+#		Because mount_nfs understands ".." in paths, it is
+#		possible to mount from locations above the NFS root with
+#		paths such as "/../../etc".
 #
 # /conf/T/M/md_size
 #		The contents of the file specifies the size of the memory
@@ -97,6 +100,12 @@
 #		The list of paths contained in the file are rm -rf'd
 #		relative to /SUBDIR.
 #
+# /conf/diskless_remount
+#		Similar to /conf/T/M/diskless_remount above, but allows
+#		all of /conf to be remounted.  This can be used to allow
+#		multiple roots to share the same /conf.
+#		
+#
 # You will almost universally want to create the following files under /conf
 #
 # File					Content
@@ -222,8 +231,7 @@
 # The list of filesystems to umount after the copy
 to_umount=""
 
-# If /conf/diskless_remount exists, remount all of /conf.  This allows
-# multiple roots to share the same conf files.
+# If /conf/diskless_remount exists, remount all of /conf.
 if [ -d /conf -a -f /conf/diskless_remount ]; then
     nfspt=`/bin/cat /conf/diskless_remount`
     if [ `expr "$nfspt" : '\(.\)'` = "/" ]; then
@@ -300,7 +308,7 @@
 	subdir=${j##*/}
 	if [ -d $j -a ! -f $j.cpio.gz  ]; then
 	    create_md $subdir
-	    cp -Rp $j/* /$subdir
+	    cp -Rp $j/ /$subdir
 	fi
     done
     for j in /conf/$i/*.cpio.gz ; do

==== //depot/projects/soc2005/libalias/lib/libc/gen/tls.c#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/lib/libc/gen/tls.c,v 1.10 2006/07/26 16:56:56 imp Exp $
+ *	$FreeBSD: src/lib/libc/gen/tls.c,v 1.12 2006/09/01 17:35:48 marcel Exp $
  */
 
 /*
@@ -58,7 +58,7 @@
 void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign);
 void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
 
-#if defined(__ia64__) || defined(__alpha__) || defined(__powerpc__)
+#if defined(__ia64__) || defined(__powerpc__)
 #define TLS_VARIANT_I
 #endif
 #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \
@@ -73,9 +73,6 @@
 
 static size_t tls_static_space;
 static size_t tls_init_size;
-#ifdef TLS_VARIANT_I
-static size_t tls_init_offset;
-#endif
 static void *tls_init;
 #endif
 
@@ -102,67 +99,69 @@
 
 #ifdef TLS_VARIANT_I
 
+#define	TLS_TCB_SIZE	(2 * sizeof(void *))
+
 /*
  * Free Static TLS using the Variant I method.
  */
 void
-__libc_free_tls(void *tls, size_t tcbsize __unused, size_t tcbalign __unused)
+__libc_free_tls(void *tcb, size_t tcbsize, size_t tcbalign __unused)
 {
-	Elf_Addr* dtv;
+	Elf_Addr *dtv;
+	Elf_Addr **tls;
 
-	dtv = ((Elf_Addr**)tls)[0];
-	free(tls);
+	tls = (Elf_Addr **)((Elf_Addr)tcb + tcbsize - TLS_TCB_SIZE);
+	dtv = tls[0];
 	free(dtv);
+	free(tcb);
 }
 
 /*
  * Allocate Static TLS using the Variant I method.
  */
 void *
-__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign __unused)
+__libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign __unused)
 {
-	size_t size;
-	char *tls;
 	Elf_Addr *dtv;
+	Elf_Addr **tls;
+	char *tcb;
 
-	size = tls_static_space;
-	if (size < tcbsize)
-		size = tcbsize;
+	if (oldtcb != NULL && tcbsize == TLS_TCB_SIZE)
+		return (oldtcb);
 
-	tls = calloc(1, size);
-	dtv = malloc(3 * sizeof(Elf_Addr));
+	tcb = calloc(1, tls_static_space + tcbsize);
+	tls = (Elf_Addr **)(tcb + tcbsize - TLS_TCB_SIZE);
 
-	*(Elf_Addr **) tls = dtv;
+	if (oldtcb != NULL) {
+		memcpy(tls, oldtcb, tls_static_space + TLS_TCB_SIZE);
+		free(oldtcb);
 
-	dtv[0] = 1;
-	dtv[1] = 1;
-	dtv[2] = (Elf_Addr)(tls + tls_init_offset);
-	if (oldtls) {
-		/*
-		 * Copy the static TLS block over whole.
-		 */
-		memcpy(tls + tls_init_offset,
-		    (char *)oldtls + tls_init_offset,
-		    tls_static_space - tls_init_offset);
+		/* Adjust the DTV. */
+		dtv = tls[0];
+		dtv[2] = (Elf_Addr)tls + TLS_TCB_SIZE;
+	} else {
+		dtv = malloc(3 * sizeof(Elf_Addr));
+		tls[0] = dtv;
+		dtv[0] = 1;
+		dtv[1] = 1;
+		dtv[2] = (Elf_Addr)tls + TLS_TCB_SIZE;
 
-		/*
-		 * We assume that this block was the one we created with
-		 * allocate_initial_tls().
-		 */
-		_rtld_free_tls(oldtls, 2 * sizeof(Elf_Addr), sizeof(Elf_Addr));
-	} else {
-		memcpy(tls + tls_init_offset, tls_init, tls_init_size);
-		memset(tls + tls_init_offset + tls_init_size,
-		    0, tls_static_space - tls_init_size);
+		if (tls_init_size > 0)
+			memcpy((void*)dtv[2], tls_init, tls_init_size);
+		if (tls_static_space > tls_init_size)
+			memset((void*)(dtv[2] + tls_init_size), 0,
+			    tls_static_space - tls_init_size);
 	}
 
-	return tls;
+	return(tcb); 
 }
 
 #endif
 
 #ifdef TLS_VARIANT_II
 
+#define	TLS_TCB_SIZE	(3 * sizeof(Elf_Addr))
+
 /*
  * Free Static TLS using the Variant II method.
  */
@@ -293,22 +292,14 @@
 
 	for (i = 0; (unsigned) i < phnum; i++) {
 		if (phdr[i].p_type == PT_TLS) {
-#ifdef TLS_VARIANT_I
-			tls_static_space = round(2*sizeof(Elf_Addr),
-			    phdr[i].p_align) + phdr[i].p_memsz;
-			tls_init_offset = round(2*sizeof(Elf_Addr),
-			    phdr[i].p_align);
-#else			    
 			tls_static_space = round(phdr[i].p_memsz,
 			    phdr[i].p_align);
-#endif
 			tls_init_size = phdr[i].p_filesz;
 			tls_init = (void*) phdr[i].p_vaddr;
 		}
 	}
 
-	tls = _rtld_allocate_tls(NULL, 3*sizeof(Elf_Addr),
-	    sizeof(Elf_Addr));
+	tls = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, 1);
 
 	_set_tp(tls);
 #endif

==== //depot/projects/soc2005/libalias/lib/libc/powerpc/gen/_set_tp.c#3 (text+ko) ====

@@ -23,13 +23,13 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/lib/libc/powerpc/gen/_set_tp.c,v 1.2 2006/08/30 00:57:35 marcel Exp $
+ *	$FreeBSD: src/lib/libc/powerpc/gen/_set_tp.c,v 1.3 2006/09/02 01:07:21 marcel Exp $
  */
 
 void
 _set_tp(void *tpval)
 {
-        register void *tp __asm__("r2");
+	register void *tp __asm__("r2");
 
 	__asm __volatile("mr %0,%1" : "=r"(tp) : "r"((char*)tpval + 0x7008));
 }

==== //depot/projects/soc2005/libalias/lib/libc/stdlib/malloc.c#6 (text+ko) ====

@@ -185,7 +185,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.134 2006/08/13 21:54:47 cperciva Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.136 2006/09/01 19:14:14 marcel Exp $");
 
 #include "libc_private.h"
 #ifdef MALLOC_DEBUG
@@ -253,7 +253,6 @@
 #ifdef __ia64__
 #  define QUANTUM_2POW_MIN	4
 #  define SIZEOF_PTR		8
-#  define NO_TLS
 #endif
 #ifdef __alpha__
 #  define QUANTUM_2POW_MIN	4
@@ -279,7 +278,6 @@
 #  define QUANTUM_2POW_MIN	4
 #  define SIZEOF_PTR		4
 #  define USE_BRK
-#  define NO_TLS
 #endif
 
 /* sizeof(int) == (1 << SIZEOF_INT_2POW). */

==== //depot/projects/soc2005/libalias/lib/libpthread/arch/ia64/ia64/pthread_md.c#2 (text+ko) ====

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2003 Daniel Eischen <deischen at freebsd.org>
+ * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,11 +24,13 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libpthread/arch/ia64/ia64/pthread_md.c,v 1.3 2004/08/15 16:28:05 dfr Exp $
+ * $FreeBSD: src/lib/libpthread/arch/ia64/ia64/pthread_md.c,v 1.5 2006/09/01 21:25:22 marcel Exp $
  */
 
 #include <stdlib.h>
 #include <strings.h>
+
+#include "rtld_tls.h"
 #include "pthread_md.h"
 
 /*
@@ -36,21 +39,22 @@
 struct tcb *
 _tcb_ctor(struct pthread *thread, int initial)
 {
+	register char *tp __asm("%r13");
 	struct tcb *tcb;
 
-	if ((tcb = malloc(sizeof(struct tcb))) != NULL) {
-		bzero(tcb, sizeof(struct tcb));
-		tcb->tcb_thread = thread;
-		/* Allocate TDV */
-	}
+	tcb = _rtld_allocate_tls((initial) ? tp : NULL,
+	    sizeof(struct tcb), 16);
+	if (tcb == NULL)
+		return (NULL);
+	tcb->tcb_thread = thread;
 	return (tcb);
 }
 
 void
 _tcb_dtor(struct tcb *tcb)
 {
-	/* Free TDV */
-	free(tcb);
+
+	_rtld_free_tls(tcb, sizeof(struct tcb), 16);
 }
 
 struct kcb *
@@ -58,13 +62,14 @@
 {
 	struct kcb *kcb;
 
-	if ((kcb = malloc(sizeof(struct kcb))) != NULL) {
-		bzero(kcb, sizeof(struct kcb));
-		kcb->kcb_faketcb.tcb_isfake = 1;
-		kcb->kcb_faketcb.tcb_tmbx.tm_flags = TMF_NOUPCALL;
-		kcb->kcb_curtcb = &kcb->kcb_faketcb;
-		kcb->kcb_kse = kse;
-	}
+	kcb = malloc(sizeof(struct kcb));
+	if (kcb == NULL)
+		return (NULL);
+	bzero(kcb, sizeof(struct kcb));
+	kcb->kcb_kse = kse;
+	kcb->kcb_faketcb.tcb_isfake = 1;
+	kcb->kcb_faketcb.tcb_tmbx.tm_flags = TMF_NOUPCALL;
+	kcb->kcb_curtcb = &kcb->kcb_faketcb;
 	return (kcb);
 }
 

==== //depot/projects/soc2005/libalias/lib/libpthread/arch/ia64/include/pthread_md.h#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 Marcel Moolenaar
+ * Copyright (c) 2003-2006 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libpthread/arch/ia64/include/pthread_md.h,v 1.16 2004/08/16 14:07:38 davidxu Exp $
+ * $FreeBSD: src/lib/libpthread/arch/ia64/include/pthread_md.h,v 1.18 2006/09/01 21:25:22 marcel Exp $
  */
 
 #ifndef _PTHREAD_MD_H_
@@ -34,7 +34,7 @@
 #include <ucontext.h>
 
 #define	KSE_STACKSIZE		16384
-#define	DTV_OFFSET		offsetof(struct tcb, tcb_tp.tp_tdv)
+#define	DTV_OFFSET		offsetof(struct tcb, tcb_tp.tp_dtv)
 
 #define	THR_GETCONTEXT(ucp)	_ia64_save_context(&(ucp)->uc_mcontext)
 #define	THR_SETCONTEXT(ucp)	PANIC("THR_SETCONTEXT() now in use!\n")
@@ -45,19 +45,16 @@
 struct kse;
 struct pthread;
 struct tcb;
-struct tdv;	/* We don't know what this is yet? */
 
 /*
- * tp points to one of these. We define the static TLS as an array
- * of long double to enforce 16-byte alignment of the TLS memory,
- * struct ia64_tp, struct tcb and also struct kcb. Both static and
- * dynamic allocation of any of these structures will result in a
- * valid, well-aligned thread pointer.
+ * tp points to one of these. We define the TLS structure as a union
+ * containing a long double to enforce 16-byte alignment. This makes
+ * sure that there will not be any padding in struct tcb after the
+ * TLS structure.
  */
-struct ia64_tp {
-	struct tdv		*tp_tdv;	/* dynamic TLS */
-	uint64_t		_reserved_;
-	long double		tp_tls[0];	/* static TLS */
+union ia64_tp {
+	void			*tp_dtv;
+	long double		_align_;
 };
 
 struct tcb {
@@ -65,19 +62,31 @@
 	struct pthread		*tcb_thread;
 	struct kcb		*tcb_curkcb;
 	long			tcb_isfake;
-	struct ia64_tp		tcb_tp;
+	union ia64_tp		tcb_tp;
 };
 
 struct kcb {
 	struct kse_mailbox	kcb_kmbx;
+	struct kse		*kcb_kse;
+	struct tcb		*kcb_curtcb;
 	struct tcb		kcb_faketcb;
-	struct tcb		*kcb_curtcb;
-	struct kse		*kcb_kse;
 };
 
-register struct ia64_tp *_tp __asm("%r13");
+static __inline struct tcb *
+ia64_get_tcb()
+{
+	register char *tp __asm("%r13");
+
+	return ((struct tcb *)(tp - offsetof(struct tcb, tcb_tp)));
+}
+
+static __inline void
+ia64_set_tcb(struct tcb *tcb)
+{
+	register char *tp __asm("%r13");
 
-#define	_tcb	((struct tcb*)((char*)(_tp) - offsetof(struct tcb, tcb_tp)))
+	__asm __volatile("mov %0 = %1;;" : "=r"(tp) : "r"(&tcb->tcb_tp));
+}
 
 /*
  * The kcb and tcb constructors.
@@ -92,7 +101,7 @@
 _kcb_set(struct kcb *kcb)
 {
 	/* There is no thread yet; use the fake tcb. */
-	_tp = &kcb->kcb_faketcb.tcb_tp;
+	ia64_set_tcb(&kcb->kcb_faketcb);
 }
 
 /*
@@ -104,7 +113,7 @@
 static __inline struct kcb *
 _kcb_get(void)
 {
-	return (_tcb->tcb_curkcb);
+	return (ia64_get_tcb()->tcb_curkcb);
 }
 
 /*
@@ -115,21 +124,23 @@
 static __inline struct kse_thr_mailbox *
 _kcb_critical_enter(void)
 {
+	struct tcb *tcb;
 	struct kse_thr_mailbox *crit;
 	uint32_t flags;
 
-	if (_tcb->tcb_isfake != 0) {
+	tcb = ia64_get_tcb();
+	if (tcb->tcb_isfake != 0) {
 		/*
 		 * We already are in a critical region since
 		 * there is no current thread.
 		 */
 		crit = NULL;
 	} else {
-		flags = _tcb->tcb_tmbx.tm_flags;
-		_tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
-		crit = _tcb->tcb_curkcb->kcb_kmbx.km_curthread;
-		_tcb->tcb_curkcb->kcb_kmbx.km_curthread = NULL;
-		_tcb->tcb_tmbx.tm_flags = flags;
+		flags = tcb->tcb_tmbx.tm_flags;
+		tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
+		crit = tcb->tcb_curkcb->kcb_kmbx.km_curthread;
+		tcb->tcb_curkcb->kcb_kmbx.km_curthread = NULL;
+		tcb->tcb_tmbx.tm_flags = flags;
 	}
 	return (crit);
 }
@@ -137,28 +148,33 @@
 static __inline void
 _kcb_critical_leave(struct kse_thr_mailbox *crit)
 {
+	struct tcb *tcb;
+
+	tcb = ia64_get_tcb();
 	/* No need to do anything if this is a fake tcb. */
-	if (_tcb->tcb_isfake == 0)
-		_tcb->tcb_curkcb->kcb_kmbx.km_curthread = crit;
+	if (tcb->tcb_isfake == 0)
+		tcb->tcb_curkcb->kcb_kmbx.km_curthread = crit;
 }
 
 static __inline int
 _kcb_in_critical(void)
 {
+	struct tcb *tcb;
 	uint32_t flags;
 	int ret;
 
-	if (_tcb->tcb_isfake != 0) {
+	tcb = ia64_get_tcb();
+	if (tcb->tcb_isfake != 0) {
 		/*
 		 * We are in a critical region since there is no
 		 * current thread.
 		 */
 		ret = 1;
 	} else {
-		flags = _tcb->tcb_tmbx.tm_flags;
-		_tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
-		ret = (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
-		_tcb->tcb_tmbx.tm_flags = flags;
+		flags = tcb->tcb_tmbx.tm_flags;
+		tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
+		ret = (tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
+		tcb->tcb_tmbx.tm_flags = flags;
 	}
 	return (ret);
 }
@@ -170,19 +186,19 @@
 		tcb = &kcb->kcb_faketcb;
 	kcb->kcb_curtcb = tcb;
 	tcb->tcb_curkcb = kcb;
-	_tp = &tcb->tcb_tp;
+	ia64_set_tcb(tcb);
 }
 
 static __inline struct tcb *
 _tcb_get(void)
 {
-	return (_tcb);
+	return (ia64_get_tcb());
 }
 
 static __inline struct pthread *
 _get_curthread(void)
 {
-	return (_tcb->tcb_thread);
+	return (ia64_get_tcb()->tcb_thread);
 }
 
 /*
@@ -193,7 +209,7 @@
 static __inline struct kse *
 _get_curkse(void)
 {
-	return (_tcb->tcb_curkcb->kcb_kse);
+	return (ia64_get_tcb()->tcb_curkcb->kcb_kse);
 }
 
 void _ia64_break_setcontext(mcontext_t *mc);
@@ -208,7 +224,7 @@
 	if (_ia64_save_context(&tcb->tcb_tmbx.tm_context.uc_mcontext) == 0) {
 		/* Make the fake tcb the current thread. */
 		kcb->kcb_curtcb = &kcb->kcb_faketcb;
-		_tp = &kcb->kcb_faketcb.tcb_tp;
+		ia64_set_tcb(&kcb->kcb_faketcb);
 		_ia64_enter_uts(kcb->kcb_kmbx.km_func, &kcb->kcb_kmbx,
 		    kcb->kcb_kmbx.km_stack.ss_sp,
 		    kcb->kcb_kmbx.km_stack.ss_size);

==== //depot/projects/soc2005/libalias/lib/libpthread/arch/powerpc/include/pthread_md.h#2 (text+ko) ====

@@ -1,5 +1,7 @@
 /*
- * Copyright 2004 by Peter Grehan. All rights reserved.
+ * Copyright 2004 by Peter Grehan.
+ * Copyright 2006 Marcel Moolenaar
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libpthread/arch/powerpc/include/pthread_md.h,v 1.3 2004/08/16 05:41:38 grehan Exp $
+ * $FreeBSD: src/lib/libpthread/arch/powerpc/include/pthread_md.h,v 1.6 2006/09/01 19:13:36 marcel Exp $
  */
 
 /*
@@ -42,7 +44,7 @@
 extern int  _ppc32_getcontext(mcontext_t *);
 
 #define	KSE_STACKSIZE		16384
-#define	DTV_OFFSET		offsetof(struct tcb, tcb_tp.tp_tdv)
+#define	DTV_OFFSET		offsetof(struct tcb, tcb_tp.tp_dtv)
 
 #define	THR_GETCONTEXT(ucp)	_ppc32_getcontext(&(ucp)->uc_mcontext)
 #define	THR_SETCONTEXT(ucp)	_ppc32_setcontext(&(ucp)->uc_mcontext, 0, NULL)
@@ -53,15 +55,14 @@
 struct kse;
 struct pthread;
 struct tcb;
-struct tdv;
 
 /*
- * %r2 points to a struct kcb.
+ * %r2 points to the following.

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list