Date: Wed, 10 Sep 2008 16:59:57 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 149539 for review Message-ID: <200809101659.m8AGxvMA048878@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149539 Change 149539 by sam@sam_ebb on 2008/09/10 16:59:37 IFC @ 149537 Affected files ... .. //depot/projects/vap/bin/cp/utils.c#5 integrate .. //depot/projects/vap/contrib/gcc/config/arm/arm.h#3 integrate .. //depot/projects/vap/contrib/ntp/libparse/clk_rawdcf.c#4 integrate .. //depot/projects/vap/etc/rc.initdiskless#4 integrate .. //depot/projects/vap/include/rpc/svc_auth.h#3 integrate .. //depot/projects/vap/lib/libarchive/archive_write_disk.c#14 integrate .. //depot/projects/vap/lib/libarchive/test/Makefile#12 integrate .. //depot/projects/vap/lib/libarchive/test/test_read_format_gtar_sparse.c#6 integrate .. //depot/projects/vap/lib/libarchive/test/test_write_disk_secure.c#5 integrate .. //depot/projects/vap/lib/libc/gen/arc4random.c#5 integrate .. //depot/projects/vap/lib/libc/rpc/svc.c#4 integrate .. //depot/projects/vap/lib/libc/rpc/svc_auth.c#4 integrate .. //depot/projects/vap/lib/libc/stdlib/malloc.c#16 integrate .. //depot/projects/vap/lib/libgeom/geom_util.c#4 integrate .. //depot/projects/vap/lib/libgeom/libgeom.3#5 integrate .. //depot/projects/vap/lib/libgeom/libgeom.h#3 integrate .. //depot/projects/vap/lib/libthr/thread/thr_exit.c#10 integrate .. //depot/projects/vap/release/doc/en_US.ISO8859-1/relnotes/article.sgml#13 integrate .. //depot/projects/vap/sbin/fdisk/fdisk.c#4 integrate .. //depot/projects/vap/sbin/md5/md5.1#3 integrate .. //depot/projects/vap/share/man/man4/if_bridge.4#4 integrate .. //depot/projects/vap/share/man/man4/tap.4#3 integrate .. //depot/projects/vap/sys/amd64/amd64/cpu_switch.S#8 integrate .. //depot/projects/vap/sys/amd64/amd64/genassym.c#8 integrate .. //depot/projects/vap/sys/amd64/amd64/machdep.c#14 integrate .. //depot/projects/vap/sys/amd64/amd64/mp_machdep.c#10 integrate .. //depot/projects/vap/sys/amd64/amd64/trap.c#10 integrate .. //depot/projects/vap/sys/amd64/include/pcb.h#7 integrate .. //depot/projects/vap/sys/amd64/include/pcpu.h#8 integrate .. //depot/projects/vap/sys/amd64/include/segments.h#5 integrate .. //depot/projects/vap/sys/amd64/linux32/linux32_genassym.c#3 integrate .. //depot/projects/vap/sys/amd64/linux32/linux32_locore.s#5 integrate .. //depot/projects/vap/sys/amd64/linux32/linux32_machdep.c#8 integrate .. //depot/projects/vap/sys/arm/conf/KB920X#9 integrate .. //depot/projects/vap/sys/arm/conf/NSLU#2 integrate .. //depot/projects/vap/sys/boot/sparc64/loader/main.c#9 integrate .. //depot/projects/vap/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#5 integrate .. //depot/projects/vap/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#6 integrate .. //depot/projects/vap/sys/compat/linux/linux_file.c#12 integrate .. //depot/projects/vap/sys/compat/linux/linux_socket.c#7 integrate .. //depot/projects/vap/sys/conf/NOTES#27 integrate .. //depot/projects/vap/sys/dev/acpi_support/acpi_fujitsu.c#5 integrate .. //depot/projects/vap/sys/dev/asmc/asmc.c#5 integrate .. //depot/projects/vap/sys/dev/asmc/asmcvar.h#5 integrate .. //depot/projects/vap/sys/dev/bge/if_bge.c#16 integrate .. //depot/projects/vap/sys/dev/cxgb/cxgb_adapter.h#9 integrate .. //depot/projects/vap/sys/dev/cxgb/cxgb_main.c#13 integrate .. //depot/projects/vap/sys/dev/cxgb/cxgb_sge.c#11 integrate .. //depot/projects/vap/sys/dev/drm/ati_pcigart.c#6 integrate .. //depot/projects/vap/sys/dev/drm/drm_bufs.c#6 integrate .. //depot/projects/vap/sys/dev/drm/drm_pci.c#6 integrate .. //depot/projects/vap/sys/dev/drm/i915_dma.c#7 integrate .. //depot/projects/vap/sys/dev/drm/mach64_dma.c#6 integrate .. //depot/projects/vap/sys/dev/esp/esp_sbus.c#7 integrate .. //depot/projects/vap/sys/dev/esp/ncr53c9x.c#7 integrate .. //depot/projects/vap/sys/dev/esp/ncr53c9xreg.h#6 integrate .. //depot/projects/vap/sys/dev/esp/ncr53c9xvar.h#7 integrate .. //depot/projects/vap/sys/dev/ic/i8251.h#3 integrate .. //depot/projects/vap/sys/dev/ic/i8255.h#1 branch .. //depot/projects/vap/sys/dev/iicbus/ds133x.c#2 integrate .. //depot/projects/vap/sys/dev/iicbus/ds1672.c#3 integrate .. //depot/projects/vap/sys/dev/jme/if_jme.c#3 integrate .. //depot/projects/vap/sys/dev/jme/if_jmereg.h#2 integrate .. //depot/projects/vap/sys/dev/le/if_le_ledma.c#3 integrate .. //depot/projects/vap/sys/dev/si/si.c#7 integrate .. //depot/projects/vap/sys/dev/sound/pci/hda/hdac.c#8 integrate .. //depot/projects/vap/sys/dev/uart/uart_cpu_pc98.c#6 integrate .. //depot/projects/vap/sys/dev/usb/if_zyd.c#27 integrate .. //depot/projects/vap/sys/dev/usb/if_zydreg.h#10 integrate .. //depot/projects/vap/sys/dev/usb/usb_quirks.c#7 integrate .. //depot/projects/vap/sys/dev/usb/usbdevs#28 integrate .. //depot/projects/vap/sys/geom/geom_dev.c#8 integrate .. //depot/projects/vap/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h#3 integrate .. //depot/projects/vap/sys/i386/conf/XEN#3 integrate .. //depot/projects/vap/sys/i386/i386/local_apic.c#9 integrate .. //depot/projects/vap/sys/i386/i386/machdep.c#12 integrate .. //depot/projects/vap/sys/i386/include/xen/xenpmap.h#4 integrate .. //depot/projects/vap/sys/i386/include/xen/xenvar.h#3 integrate .. //depot/projects/vap/sys/i386/isa/isa.c#5 integrate .. //depot/projects/vap/sys/i386/linux/linux_genassym.c#3 integrate .. //depot/projects/vap/sys/i386/linux/linux_locore.s#3 integrate .. //depot/projects/vap/sys/i386/xen/mp_machdep.c#1 branch .. //depot/projects/vap/sys/i386/xen/mptable.c#1 branch .. //depot/projects/vap/sys/i386/xen/pmap.c#4 integrate .. //depot/projects/vap/sys/i386/xen/xen_machdep.c#5 integrate .. //depot/projects/vap/sys/kern/kern_exec.c#15 integrate .. //depot/projects/vap/sys/kern/subr_sleepqueue.c#15 integrate .. //depot/projects/vap/sys/kern/subr_turnstile.c#8 integrate .. //depot/projects/vap/sys/kern/uipc_sockbuf.c#7 integrate .. //depot/projects/vap/sys/mips/adm5120/admpci.c#2 integrate .. //depot/projects/vap/sys/mips/adm5120/if_admsw.c#2 integrate .. //depot/projects/vap/sys/mips/adm5120/if_admswvar.h#2 integrate .. //depot/projects/vap/sys/mips/adm5120/obio.c#2 integrate .. //depot/projects/vap/sys/mips/adm5120/uart_bus_adm5120.c#2 integrate .. //depot/projects/vap/sys/mips/adm5120/uart_cpu_adm5120.c#2 integrate .. //depot/projects/vap/sys/mips/adm5120/uart_dev_adm5120.c#2 integrate .. //depot/projects/vap/sys/mips/idt/idtpci.c#2 integrate .. //depot/projects/vap/sys/mips/idt/if_kr.c#2 integrate .. //depot/projects/vap/sys/mips/idt/obio.c#2 integrate .. //depot/projects/vap/sys/mips/idt/uart_bus_rc32434.c#2 integrate .. //depot/projects/vap/sys/mips/malta/gt.c#2 integrate .. //depot/projects/vap/sys/mips/malta/gt_pci.c#2 integrate .. //depot/projects/vap/sys/mips/malta/malta_machdep.c#2 integrate .. //depot/projects/vap/sys/mips/malta/obio.c#2 integrate .. //depot/projects/vap/sys/mips/malta/uart_bus_maltausart.c#2 integrate .. //depot/projects/vap/sys/mips/malta/uart_cpu_maltausart.c#2 integrate .. //depot/projects/vap/sys/mips/malta/yamon.c#2 integrate .. //depot/projects/vap/sys/mips/sentry5/obio.c#2 integrate .. //depot/projects/vap/sys/mips/sentry5/s5_machdep.c#2 integrate .. //depot/projects/vap/sys/mips/sentry5/uart_bus_sbusart.c#2 integrate .. //depot/projects/vap/sys/mips/sentry5/uart_cpu_sbusart.c#2 integrate .. //depot/projects/vap/sys/modules/Makefile#39 integrate .. //depot/projects/vap/sys/net/if_bridge.c#8 integrate .. //depot/projects/vap/sys/net/if_mib.c#6 integrate .. //depot/projects/vap/sys/net/if_tap.c#9 integrate .. //depot/projects/vap/sys/net/if_tap.h#5 integrate .. //depot/projects/vap/sys/netinet/tcp_debug.c#5 integrate .. //depot/projects/vap/sys/netinet/tcp_input.c#12 integrate .. //depot/projects/vap/sys/netinet/tcp_output.c#13 integrate .. //depot/projects/vap/sys/netinet/tcp_subr.c#12 integrate .. //depot/projects/vap/sys/netinet/tcp_var.h#10 integrate .. //depot/projects/vap/sys/pc98/cbus/sio.c#6 integrate .. //depot/projects/vap/sys/pc98/include/bus.h#6 integrate .. //depot/projects/vap/sys/pc98/pc98/busiosubr.c#4 integrate .. //depot/projects/vap/sys/security/mac_bsdextended/mac_bsdextended.c#9 integrate .. //depot/projects/vap/sys/sparc64/include/asi.h#6 integrate .. //depot/projects/vap/sys/sparc64/include/tlb.h#4 integrate .. //depot/projects/vap/sys/sparc64/sbus/dma_sbus.c#4 integrate .. //depot/projects/vap/sys/sparc64/sbus/lsi64854.c#6 integrate .. //depot/projects/vap/sys/sparc64/sbus/lsi64854var.h#6 integrate .. //depot/projects/vap/sys/sparc64/sparc64/cheetah.c#7 integrate .. //depot/projects/vap/sys/sparc64/sparc64/exception.S#9 integrate .. //depot/projects/vap/sys/sparc64/sparc64/genassym.c#8 integrate .. //depot/projects/vap/sys/sparc64/sparc64/mp_exception.S#6 integrate .. //depot/projects/vap/sys/sparc64/sparc64/pmap.c#12 integrate .. //depot/projects/vap/sys/sparc64/sparc64/support.S#6 integrate .. //depot/projects/vap/sys/sparc64/sparc64/swtch.S#6 integrate .. //depot/projects/vap/sys/sparc64/sparc64/tlb.c#5 integrate .. //depot/projects/vap/sys/sys/disk.h#5 integrate .. //depot/projects/vap/sys/sys/param.h#29 integrate .. //depot/projects/vap/sys/sys/vnode.h#15 integrate .. //depot/projects/vap/tools/regression/sockets/sendfile/sendfile.c#3 integrate .. //depot/projects/vap/tools/tools/nanobsd/nanobsd.sh#8 integrate .. //depot/projects/vap/usr.sbin/boot0cfg/boot0cfg.c#3 integrate .. //depot/projects/vap/usr.sbin/cxgbtool/cxgbtool.c#4 integrate .. //depot/projects/vap/usr.sbin/setfib/setfib.c#4 integrate Differences ... ==== //depot/projects/vap/bin/cp/utils.c#5 (text+ko) ==== @@ -33,7 +33,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.54 2008/08/07 07:29:26 trasz Exp $"); +__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.55 2008/09/09 12:31:42 trasz Exp $"); #include <sys/types.h> #include <sys/acl.h> @@ -224,7 +224,6 @@ rval = 1; if (pflag && preserve_fd_acls(from_fd, to_fd) != 0) rval = 1; - (void)close(from_fd); if (close(to_fd)) { warn("%s", to.p_path); rval = 1; ==== //depot/projects/vap/contrib/gcc/config/arm/arm.h#3 (text+ko) ==== @@ -507,7 +507,7 @@ /* wchar_t is unsigned under the AAPCS. */ #ifndef WCHAR_TYPE #define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "int") - +#undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD #endif ==== //depot/projects/vap/contrib/ntp/libparse/clk_rawdcf.c#4 (text+ko) ==== @@ -229,7 +229,7 @@ unsigned char *c = dcfprm->zerobits; int i; - parseprintf(DD_RAWDCF,("parse: convert_rawdcf: \"%s\"\n", buffer)); + parseprintf(DD_RAWDCF,("parse: convert_rawdcf: \"%.*s\"\n", size, buffer)); if (size < 57) { @@ -320,7 +320,7 @@ * bad format - not for us */ #ifndef PARSEKERNEL - msyslog(LOG_ERR, "parse: convert_rawdcf: parity check FAILED for \"%s\"\n", buffer); + msyslog(LOG_ERR, "parse: convert_rawdcf: parity check FAILED for \"%.*s\"\n", size, buffer); #endif return CVT_FAIL|CVT_BADFMT; } ==== //depot/projects/vap/etc/rc.initdiskless#4 (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.53 2008/05/15 11:00:23 bms Exp $ +# $FreeBSD: src/etc/rc.initdiskless,v 1.54 2008/09/09 18:40:50 bms 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 @@ -73,6 +73,16 @@ # If this file exists, then failure to execute the mount # command contained in /conf/T/M/remount is non-fatal. # +# /conf/T/M/remount_subdir +# If this file exists, then the behaviour of /conf/T/M/remount +# changes as follows: +# 1. /conf/T/M/remount is invoked to mount the root of the +# filesystem where the configuration data exists on a +# temporary mountpoint. +# 2. /conf/T/M/remount_subdir is then invoked to mount a +# *subdirectory* of the filesystem mounted by +# /conf/T/M/remount on /conf/T/M/. +# # /conf/T/M/diskless_remount # The contents of the file points to an NFS filesystem, # possibly followed by mount_nfs options. If the server name @@ -296,10 +306,33 @@ # remount. Beware, the command is in the file itself! if [ -f $j/remount ]; then - nfspt=`/bin/cat $j/remount` - $nfspt $j - chkerr $? "$nfspt $j" - to_umount="$j ${to_umount}" # XXX hope it is really a mount! + if [ -f $j/remount_subdir ]; then + k="/conf.tmp/$i/$subdir" + [ -d $k ] || continue + + # Mount the filesystem root where the config data is + # on the temporary mount point. + nfspt=`/bin/cat $j/remount` + $nfspt $k + chkerr $? "$nfspt $k" + + # Now use a nullfs mount to get the data where we + # really want to see it. + remount_subdir=`/bin/cat $j/remount_subdir` + remount_subdir_cmd="mount -t nullfs $k/$remount_subdir" + + $remount_subdir_cmd $j + chkerr $? "$remount_subdir_cmd $j" + + # XXX check order -- we must force $k to be unmounted + # after j, as j depends on k. + to_umount="$j $k ${to_umount}" + else + nfspt=`/bin/cat $j/remount` + $nfspt $j + chkerr $? "$nfspt $j" + to_umount="$j ${to_umount}" # XXX hope it is really a mount! + fi fi # NFS remount ==== //depot/projects/vap/include/rpc/svc_auth.h#3 (text+ko) ==== @@ -30,7 +30,7 @@ * * from: @(#)svc_auth.h 1.6 86/07/16 SMI * @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC - * $FreeBSD: src/include/rpc/svc_auth.h,v 1.14 2002/03/23 17:24:55 imp Exp $ + * $FreeBSD: src/include/rpc/svc_auth.h,v 1.15 2008/09/09 14:15:55 dfr Exp $ */ /* @@ -46,6 +46,8 @@ * Server side authenticator */ __BEGIN_DECLS +extern struct svc_auth_ops svc_auth_null_ops; + extern enum auth_stat _authenticate(struct svc_req *, struct rpc_msg *); extern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *, struct rpc_msg *)); ==== //depot/projects/vap/lib/libarchive/archive_write_disk.c#14 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.35 2008/09/05 06:13:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.36 2008/09/07 05:22:33 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -907,14 +907,26 @@ * We know something is in the way, but we don't know what; * we need to find out before we go any further. */ - if (lstat(a->name, &a->st) != 0) { + int r = 0; + /* + * The SECURE_SYMLINK logic has already removed a + * symlink to a dir if the client wants that. So + * follow the symlink if we're creating a dir. + */ + if (S_ISDIR(a->mode)) + r = stat(a->name, &a->st); + /* + * If it's not a dir (or it's a broken symlink), + * then don't follow it. + */ + if (r != 0 || !S_ISDIR(a->mode)) + r = lstat(a->name, &a->st); + if (r != 0) { archive_set_error(&a->archive, errno, "Can't stat existing object"); return (ARCHIVE_WARN); } - /* TODO: if it's a symlink... */ - /* * NO_OVERWRITE_NEWER doesn't apply to directories. */ ==== //depot/projects/vap/lib/libarchive/test/Makefile#12 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.24 2008/08/25 06:08:22 kientzle Exp $ +# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.25 2008/09/08 00:58:12 kientzle Exp $ # Where to find the libarchive sources LA_SRCDIR=${.CURDIR}/.. @@ -89,7 +89,7 @@ # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC -#WARNS=6 +WARNS=6 # Build libarchive_test and run it. check test: libarchive_test ==== //depot/projects/vap/lib/libarchive/test/test_read_format_gtar_sparse.c#6 (text+ko) ==== @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.9 2008/09/01 05:38:33 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.10 2008/09/08 00:58:12 kientzle Exp $"); struct contents { @@ -187,6 +187,7 @@ struct contents expect; /* data, size, offset of block read from archive. */ struct contents actual; + const void *p; struct archive *a; extract_reference_file(name); @@ -206,10 +207,10 @@ expect = *cts++; while (0 == (err = archive_read_data_block(a, - (const void **)&actual.d, - &actual.s, &actual.o))) { + &p, &actual.s, &actual.o))) { + actual.d = p; while (actual.s > 0) { - char c = *(const char *)actual.d; + char c = *actual.d; if(actual.o < expect.o) { /* * Any byte before the expected ==== //depot/projects/vap/lib/libarchive/test/test_write_disk_secure.c#5 (text+ko) ==== @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_secure.c,v 1.5 2008/09/01 05:38:33 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_secure.c,v 1.8 2008/09/07 23:59:27 kientzle Exp $"); #define UMASK 022 @@ -105,6 +105,80 @@ archive_entry_free(ae); assert(0 == archive_write_finish_entry(a)); + /* + * Without security checks, extracting a dir over a link to a + * dir should follow the link. + */ + /* Create a symlink to a dir. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "link_to_dir3"); + archive_entry_set_mode(ae, S_IFLNK | 0777); + archive_entry_set_symlink(ae, "dir"); + archive_write_disk_set_options(a, 0); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + /* Extract a dir whose name matches the symlink. */ + assert(archive_entry_clear(ae) != NULL); + archive_entry_copy_pathname(ae, "link_to_dir3"); + archive_entry_set_mode(ae, S_IFDIR | 0777); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + /* Verify link was followed. */ + assertEqualInt(0, lstat("link_to_dir3", &st)); + assert(S_ISLNK(st.st_mode)); + archive_entry_free(ae); + + /* + * As above, but a broken link, so the link should get replaced. + */ + /* Create a symlink to a dir. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "link_to_dir4"); + archive_entry_set_mode(ae, S_IFLNK | 0777); + archive_entry_set_symlink(ae, "nonexistent_dir"); + archive_write_disk_set_options(a, 0); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + /* Extract a dir whose name matches the symlink. */ + assert(archive_entry_clear(ae) != NULL); + archive_entry_copy_pathname(ae, "link_to_dir4"); + archive_entry_set_mode(ae, S_IFDIR | 0777); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + /* Verify link was replaced. */ + assertEqualInt(0, lstat("link_to_dir4", &st)); + assert(S_ISDIR(st.st_mode)); + archive_entry_free(ae); + + /* + * As above, but a link to a non-dir, so the link should get replaced. + */ + /* Create a regular file and a symlink to it */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "non_dir"); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_write_disk_set_options(a, 0); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + /* Create symlink to the file. */ + archive_entry_copy_pathname(ae, "link_to_dir5"); + archive_entry_set_mode(ae, S_IFLNK | 0777); + archive_entry_set_symlink(ae, "non_dir"); + archive_write_disk_set_options(a, 0); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + /* Extract a dir whose name matches the symlink. */ + assert(archive_entry_clear(ae) != NULL); + archive_entry_copy_pathname(ae, "link_to_dir5"); + archive_entry_set_mode(ae, S_IFDIR | 0777); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + /* Verify link was replaced. */ + assertEqualInt(0, lstat("link_to_dir5", &st)); + assert(S_ISDIR(st.st_mode)); + archive_entry_free(ae); + + #if ARCHIVE_VERSION_NUMBER < 2000000 archive_write_finish(a); #else ==== //depot/projects/vap/lib/libc/gen/arc4random.c#5 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.24 2008/08/03 20:15:22 ache Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.25 2008/09/09 09:46:36 ache Exp $"); #include "namespace.h" #include <sys/types.h> @@ -54,7 +54,7 @@ static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; -#define RANDOMDEV "/dev/urandom" +#define RANDOMDEV "/dev/random" #define KEYSIZE 128 #define THREAD_LOCK() \ do { \ @@ -193,6 +193,7 @@ THREAD_LOCK(); arc4_check_init(); arc4_stir(); + rs_stired = 1; THREAD_UNLOCK(); } ==== //depot/projects/vap/lib/libc/rpc/svc.c#4 (text+ko) ==== @@ -34,7 +34,7 @@ static char *sccsid = "@(#)svc.c 2.4 88/08/11 4.0 RPCSRC"; #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/rpc/svc.c,v 1.25 2008/08/06 14:02:05 dfr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/rpc/svc.c,v 1.26 2008/09/09 14:15:55 dfr Exp $"); /* * svc.c, Server-side remote procedure call interface. @@ -569,6 +569,7 @@ ext = mem_alloc(sizeof(SVCXPRT_EXT)); memset(ext, 0, sizeof(SVCXPRT_EXT)); xprt->xp_p3 = ext; + ext->xp_auth.svc_ah_ops = &svc_auth_null_ops; return (xprt); } ==== //depot/projects/vap/lib/libc/rpc/svc_auth.c#4 (text+ko) ==== @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)svc_auth.c 1.26 89/02/07 Copyr 1984 Sun Micro"; #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/rpc/svc_auth.c,v 1.14 2008/08/06 14:02:05 dfr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/rpc/svc_auth.c,v 1.15 2008/09/09 14:15:55 dfr Exp $"); /* * svc_auth.c, Server-side rpc authenticator interface. @@ -75,7 +75,7 @@ }; static struct authsvc *Auths = NULL; -static struct svc_auth_ops svc_auth_null_ops; +struct svc_auth_ops svc_auth_null_ops; /* * The call rpc message, msg has been obtained from the wire. The msg contains @@ -162,7 +162,7 @@ return (xdr_func(xdrs, xdr_ptr)); } -static struct svc_auth_ops svc_auth_null_ops = { +struct svc_auth_ops svc_auth_null_ops = { svcauth_null_wrap, svcauth_null_wrap, }; ==== //depot/projects/vap/lib/libc/stdlib/malloc.c#16 (text+ko) ==== @@ -156,7 +156,7 @@ #define MALLOC_DSS #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.178 2008/09/06 05:26:31 marcel Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.179 2008/09/10 14:27:34 jasone Exp $"); #include "libc_private.h" #ifdef MALLOC_DEBUG @@ -174,6 +174,7 @@ #include <sys/ktrace.h> /* Must come after several other sys/ includes. */ #include <machine/cpufunc.h> +#include <machine/param.h> #include <machine/vmparam.h> #include <errno.h> @@ -213,55 +214,43 @@ #define STRERROR_BUF 64 /* - * The const_size2bin table is sized according to PAGESIZE_2POW, but for - * correctness reasons, we never assume that - * (pagesize == (1U << * PAGESIZE_2POW)). - * * Minimum alignment of allocations is 2^QUANTUM_2POW bytes. */ #ifdef __i386__ -# define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 2 # define CPU_SPINWAIT __asm__ volatile("pause") #endif #ifdef __ia64__ -# define PAGESIZE_2POW 13 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 #endif #ifdef __alpha__ -# define PAGESIZE_2POW 13 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define NO_TLS #endif #ifdef __sparc64__ -# define PAGESIZE_2POW 13 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define NO_TLS #endif #ifdef __amd64__ -# define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define CPU_SPINWAIT __asm__ volatile("pause") #endif #ifdef __arm__ -# define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #ifdef __mips__ -# define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #ifdef __powerpc__ -# define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 2 #endif @@ -361,7 +350,7 @@ #define RUN_MAX_OVRHD_RELAX 0x00001800U /* Put a cap on small object run size. This overrides RUN_MAX_OVRHD. */ -#define RUN_MAX_SMALL (12 * pagesize) +#define RUN_MAX_SMALL (12 * PAGE_SIZE) /* * Hyper-threaded CPUs may need a special instruction inside spin loops in @@ -733,7 +722,8 @@ /* * bins is used to store rings of free regions of the following sizes, - * assuming a 16-byte quantum, 4kB pagesize, and default MALLOC_OPTIONS. + * assuming a 16-byte quantum, 4kB page size, and default + * MALLOC_OPTIONS. * * bins[i] | size | * --------+------+ @@ -794,11 +784,6 @@ /* Number of CPUs. */ static unsigned ncpus; -/* VM page size. */ -static size_t pagesize; -static size_t pagesize_mask; -static size_t pagesize_2pow; - /* Various bin-related settings. */ #ifdef MALLOC_TINY /* Number of (2^n)-spaced tiny bins. */ # define ntbins ((unsigned)(QUANTUM_2POW - TINY_MIN_2POW)) @@ -835,7 +820,7 @@ #define S2B_64(i) S2B_32(i) S2B_32(i) #define S2B_128(i) S2B_64(i) S2B_64(i) #define S2B_256(i) S2B_128(i) S2B_128(i) -static const uint8_t const_size2bin[(1U << PAGESIZE_2POW) - 255] = { +static const uint8_t const_size2bin[PAGE_SIZE - 255] = { S2B_1(0xffU) /* 0 */ #if (QUANTUM_2POW == 4) /* 64-bit system ************************/ @@ -906,7 +891,7 @@ S2B_256(S2B_SMIN + 10) /* 3328 */ S2B_256(S2B_SMIN + 11) /* 3584 */ S2B_256(S2B_SMIN + 12) /* 3840 */ -#if (PAGESIZE_2POW == 13) +#if (PAGE_SHIFT == 13) S2B_256(S2B_SMIN + 13) /* 4096 */ S2B_256(S2B_SMIN + 14) /* 4352 */ S2B_256(S2B_SMIN + 15) /* 4608 */ @@ -1345,9 +1330,9 @@ #define SUBPAGE_CEILING(s) \ (((s) + SUBPAGE_MASK) & ~SUBPAGE_MASK) -/* Return the smallest pagesize multiple that is >= s. */ +/* Return the smallest PAGE_SIZE multiple that is >= s. */ #define PAGE_CEILING(s) \ - (((s) + pagesize_mask) & ~pagesize_mask) + (((s) + PAGE_MASK) & ~PAGE_MASK) #ifdef MALLOC_TINY /* Compute the smallest power of 2 that is >= x. */ @@ -1693,7 +1678,7 @@ i < ntbins + nqbins + ncbins ? "C" : "S", arena->bins[i].reg_size, arena->bins[i].nregs, - arena->bins[i].run_size >> pagesize_2pow, + arena->bins[i].run_size >> PAGE_SHIFT, #ifdef MALLOC_MAG (__isthreaded && opt_mag) ? arena->bins[i].stats.nmags : @@ -2335,8 +2320,8 @@ arena_avail_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) { int ret; - size_t a_size = a->bits & ~pagesize_mask; - size_t b_size = b->bits & ~pagesize_mask; + size_t a_size = a->bits & ~PAGE_MASK; + size_t b_size = b->bits & ~PAGE_MASK; ret = (a_size > b_size) - (a_size < b_size); if (ret == 0) { @@ -2521,7 +2506,7 @@ SSIZE_INV(4), SSIZE_INV(5), SSIZE_INV(6), SSIZE_INV(7), SSIZE_INV(8), SSIZE_INV(9), SSIZE_INV(10), SSIZE_INV(11), SSIZE_INV(12), SSIZE_INV(13), SSIZE_INV(14), SSIZE_INV(15) -#if (PAGESIZE_2POW == 13) +#if (PAGE_SHIFT == 13) , SSIZE_INV(16), SSIZE_INV(17), SSIZE_INV(18), SSIZE_INV(19), SSIZE_INV(20), SSIZE_INV(21), SSIZE_INV(22), SSIZE_INV(23), @@ -2530,7 +2515,7 @@ #endif }; assert(SUBPAGE * (((sizeof(ssize_invs)) / sizeof(unsigned)) + 3) - >= (1U << PAGESIZE_2POW)); + >= PAGE_SIZE); if (size < (((sizeof(ssize_invs) / sizeof(unsigned)) + 2) << SUBPAGE_2POW)) { @@ -2562,10 +2547,10 @@ chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); old_ndirty = chunk->ndirty; run_ind = (unsigned)(((uintptr_t)run - (uintptr_t)chunk) - >> pagesize_2pow); - total_pages = (chunk->map[run_ind].bits & ~pagesize_mask) >> - pagesize_2pow; - need_pages = (size >> pagesize_2pow); + >> PAGE_SHIFT); + total_pages = (chunk->map[run_ind].bits & ~PAGE_MASK) >> + PAGE_SHIFT; + need_pages = (size >> PAGE_SHIFT); assert(need_pages > 0); assert(need_pages <= total_pages); rem_pages = total_pages - need_pages; @@ -2575,11 +2560,11 @@ /* Keep track of trailing unused pages for later use. */ if (rem_pages > 0) { chunk->map[run_ind+need_pages].bits = (rem_pages << - pagesize_2pow) | (chunk->map[run_ind+need_pages].bits & - pagesize_mask); + PAGE_SHIFT) | (chunk->map[run_ind+need_pages].bits & + PAGE_MASK); chunk->map[run_ind+total_pages-1].bits = (rem_pages << - pagesize_2pow) | (chunk->map[run_ind+total_pages-1].bits & - pagesize_mask); + PAGE_SHIFT) | (chunk->map[run_ind+total_pages-1].bits & + PAGE_MASK); arena_avail_tree_insert(&arena->runs_avail, &chunk->map[run_ind+need_pages]); } @@ -2590,7 +2575,7 @@ if ((chunk->map[run_ind + i].bits & CHUNK_MAP_ZEROED) == 0) { memset((void *)((uintptr_t)chunk + ((run_ind - + i) << pagesize_2pow)), 0, pagesize); + + i) << PAGE_SHIFT)), 0, PAGE_SIZE); /* CHUNK_MAP_ZEROED is cleared below. */ } } @@ -2706,7 +2691,7 @@ arena_chunk_map_t *mapelm, key; assert(size <= arena_maxclass); - assert((size & pagesize_mask) == 0); + assert((size & PAGE_MASK) == 0); /* Search the arena's chunks for the lowest best fit. */ key.bits = size | CHUNK_MAP_KEY; @@ -2717,7 +2702,7 @@ / sizeof(arena_chunk_map_t); run = (arena_run_t *)((uintptr_t)run_chunk + (pageind - << pagesize_2pow)); + << PAGE_SHIFT)); arena_run_split(arena, run, size, large, zero); return (run); } @@ -2729,7 +2714,7 @@ if (chunk == NULL) return (NULL); run = (arena_run_t *)((uintptr_t)chunk + (arena_chunk_header_npages << - pagesize_2pow)); + PAGE_SHIFT)); /* Update page map. */ arena_run_split(arena, run, size, large, zero); return (run); @@ -2781,7 +2766,7 @@ arena->ndirty -= npages; madvise((void *)((uintptr_t)chunk + (i << - pagesize_2pow)), (npages << pagesize_2pow), + PAGE_SHIFT)), (npages << PAGE_SHIFT), MADV_FREE); #ifdef MALLOC_STATS arena->stats.nmadvise++; @@ -2807,14 +2792,14 @@ chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) - >> pagesize_2pow); + >> PAGE_SHIFT); assert(run_ind >= arena_chunk_header_npages); assert(run_ind < chunk_npages); if ((chunk->map[run_ind].bits & CHUNK_MAP_LARGE) != 0) - size = chunk->map[run_ind].bits & ~pagesize_mask; + size = chunk->map[run_ind].bits & ~PAGE_MASK; else size = run->bin->run_size; - run_pages = (size >> pagesize_2pow); + run_pages = (size >> PAGE_SHIFT); /* Mark pages as unallocated in the chunk map. */ if (dirty) { @@ -2841,15 +2826,15 @@ } } chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & - pagesize_mask); + PAGE_MASK); chunk->map[run_ind+run_pages-1].bits = size | - (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); + (chunk->map[run_ind+run_pages-1].bits & PAGE_MASK); /* Try to coalesce forward. */ if (run_ind + run_pages < chunk_npages && (chunk->map[run_ind+run_pages].bits & CHUNK_MAP_ALLOCATED) == 0) { size_t nrun_size = chunk->map[run_ind+run_pages].bits & - ~pagesize_mask; + ~PAGE_MASK; /* * Remove successor from runs_avail; the coalesced run is @@ -2859,22 +2844,22 @@ &chunk->map[run_ind+run_pages]); size += nrun_size; - run_pages = size >> pagesize_2pow; + run_pages = size >> PAGE_SHIFT; - assert((chunk->map[run_ind+run_pages-1].bits & ~pagesize_mask) + assert((chunk->map[run_ind+run_pages-1].bits & ~PAGE_MASK) == nrun_size); chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & - pagesize_mask); + PAGE_MASK); chunk->map[run_ind+run_pages-1].bits = size | - (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); + (chunk->map[run_ind+run_pages-1].bits & PAGE_MASK); } /* Try to coalesce backward. */ if (run_ind > arena_chunk_header_npages && (chunk->map[run_ind-1].bits & CHUNK_MAP_ALLOCATED) == 0) { - size_t prun_size = chunk->map[run_ind-1].bits & ~pagesize_mask; + size_t prun_size = chunk->map[run_ind-1].bits & ~PAGE_MASK; - run_ind -= prun_size >> pagesize_2pow; + run_ind -= prun_size >> PAGE_SHIFT; /* * Remove predecessor from runs_avail; the coalesced run is @@ -2884,21 +2869,21 @@ &chunk->map[run_ind]); size += prun_size; - run_pages = size >> pagesize_2pow; + run_pages = size >> PAGE_SHIFT; - assert((chunk->map[run_ind].bits & ~pagesize_mask) == + assert((chunk->map[run_ind].bits & ~PAGE_MASK) == prun_size); chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & - pagesize_mask); + PAGE_MASK); chunk->map[run_ind+run_pages-1].bits = size | - (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); + (chunk->map[run_ind+run_pages-1].bits & PAGE_MASK); } /* Insert into runs_avail, now that coalescing is complete. */ arena_avail_tree_insert(&arena->runs_avail, &chunk->map[run_ind]); /* Deallocate chunk if it is now completely unused. */ - if ((chunk->map[arena_chunk_header_npages].bits & (~pagesize_mask | + if ((chunk->map[arena_chunk_header_npages].bits & (~PAGE_MASK | CHUNK_MAP_ALLOCATED)) == arena_maxclass) arena_chunk_dealloc(arena, chunk); @@ -2911,8 +2896,8 @@ arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize) { - size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow; - size_t head_npages = (oldsize - newsize) >> pagesize_2pow; + size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t head_npages = (oldsize - newsize) >> PAGE_SHIFT; assert(oldsize > newsize); @@ -2932,8 +2917,8 @@ arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize, bool dirty) { - size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow; - size_t npages = newsize >> pagesize_2pow; + size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t npages = newsize >> PAGE_SHIFT; assert(oldsize > newsize); @@ -2962,7 +2947,7 @@ if (mapelm != NULL) { /* run is guaranteed to have available space. */ arena_run_tree_remove(&bin->runs, mapelm); - run = (arena_run_t *)(mapelm->bits & ~pagesize_mask); + run = (arena_run_t *)(mapelm->bits & ~PAGE_MASK); #ifdef MALLOC_STATS bin->stats.reruns++; #endif @@ -3053,7 +3038,7 @@ unsigned good_nregs, good_mask_nelms, good_reg0_offset; unsigned try_nregs, try_mask_nelms, try_reg0_offset; - assert(min_run_size >= pagesize); + assert(min_run_size >= PAGE_SIZE); assert(min_run_size <= arena_maxclass); assert(min_run_size <= RUN_MAX_SMALL); @@ -3089,7 +3074,7 @@ good_reg0_offset = try_reg0_offset; /* Try more aggressive settings. */ - try_run_size += pagesize; + try_run_size += PAGE_SIZE; try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ do { @@ -3405,8 +3390,8 @@ size_t offset; arena_chunk_t *chunk; - assert((size & pagesize_mask) == 0); - assert((alignment & pagesize_mask) == 0); + assert((size & PAGE_MASK) == 0); + assert((alignment & PAGE_MASK) == 0); #ifdef MALLOC_BALANCE arena_lock_balance(arena); @@ -3422,7 +3407,7 @@ chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ret); offset = (uintptr_t)ret & (alignment - 1); - assert((offset & pagesize_mask) == 0); + assert((offset & PAGE_MASK) == 0); assert(offset < alloc_size); if (offset == 0) arena_run_trim_tail(arena, chunk, ret, alloc_size, size, false); @@ -3492,7 +3477,7 @@ return (NULL); } - if (ceil_size <= pagesize || (alignment <= pagesize + if (ceil_size <= PAGE_SIZE || (alignment <= PAGE_SIZE && ceil_size <= arena_maxclass)) ret = arena_malloc(choose_arena(), ceil_size, false); else { @@ -3506,7 +3491,7 @@ ceil_size = PAGE_CEILING(size); /* * (ceil_size < size) protects against very large sizes within - * pagesize of SIZE_T_MAX. + * PAGE_SIZE of SIZE_T_MAX. * * (ceil_size + alignment < ceil_size) protects against the * combination of maximal alignment and ceil_size large enough @@ -3526,18 +3511,18 @@ * would need to allocate in order to guarantee the alignment. */ if (ceil_size >= alignment) - run_size = ceil_size + alignment - pagesize; + run_size = ceil_size + alignment - PAGE_SIZE; else { /* >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809101659.m8AGxvMA048878>