Hello community, here is the log from the commit of package libhugetlbfs checked in at Sun Oct 29 11:26:42 CET 2006. -------- --- libhugetlbfs/libhugetlbfs.changes 2006-10-05 13:40:28.000000000 +0200 +++ /mounts/work_src_done/STABLE/libhugetlbfs/libhugetlbfs.changes 2006-10-29 11:26:31.000000000 +0100 @@ -1,0 +2,9 @@ +Sun Oct 29 10:02:15 CET 2006 - olh@suse.de + +- update to bugfix release 1.0.1 (214426) + * Always install linker scripts for all targets + * Error message updates + * Add documentation on HUGETLB_DEBUG + * Testcase updates + +------------------------------------------------------------------- Old: ---- libhugetlbfs-1.0.tar.gz New: ---- libhugetlbfs-1.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libhugetlbfs.spec ++++++ --- /var/tmp/diff_new_pack.HnuyVr/_old 2006-10-29 11:26:37.000000000 +0100 +++ /var/tmp/diff_new_pack.HnuyVr/_new 2006-10-29 11:26:37.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package libhugetlbfs (Version 1.0) +# spec file for package libhugetlbfs (Version 1.0.1) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -12,14 +12,14 @@ Name: libhugetlbfs BuildRequires: doxygen -License: LGPL +License: GNU Library General Public License v. 2.0 and 2.1 (LGPL) Group: Development/Libraries/Other Summary: hugetlbfs helper library -Version: 1.0 -Release: 24 +Version: 1.0.1 +Release: 1 URL: http://libhugetlbfs.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: libhugetlbfs-1.0.tar.gz +Source0: libhugetlbfs-%{version}.tar.gz Patch0: libhugetlbfs.install.patch Patch1: libhugetlbfs.ldscript-path.patch @@ -36,8 +36,6 @@ %prep %setup -q -%patch0 -p1 -%patch1 -p1 %build make V=1 CFLAGS="$RPM_OPT_FLAGS -fPIC" CC32=gcc CC64= PREFIX=/usr libs @@ -70,12 +68,18 @@ %files %defattr(-, root, root) -%doc LGPL-2.1 HOWTO +%doc LGPL-2.1 HOWTO README NEWS /usr/include/* %attr(755,root,root) /usr/bin/* %{_libdir}/lib* %changelog -n libhugetlbfs +* Sun Oct 29 2006 - olh@suse.de +- update to bugfix release 1.0.1 (214426) + * Always install linker scripts for all targets + * Error message updates + * Add documentation on HUGETLB_DEBUG + * Testcase updates * Thu Oct 05 2006 - olh@suse.de - update to final 1.0 * Tue Sep 19 2006 - olh@suse.de ++++++ libhugetlbfs-1.0.tar.gz -> libhugetlbfs-1.0.1.tar.gz ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/.gitHEAD new/libhugetlbfs-1.0.1/.gitHEAD --- old/libhugetlbfs-1.0/.gitHEAD 2006-10-04 17:16:17.000000000 +0200 +++ new/libhugetlbfs-1.0.1/.gitHEAD 2006-10-27 19:12:37.000000000 +0200 @@ -1 +1 @@ -e64c667c3f04c3039f8b7b1e0f28c48171285773 +1b69112150cb7729f090df05755c9abf9d996de4 diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/HOWTO new/libhugetlbfs-1.0.1/HOWTO --- old/libhugetlbfs-1.0/HOWTO 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/HOWTO 2006-10-27 19:12:32.000000000 +0200 @@ -319,6 +319,9 @@ Specify the path to the hugetlbfs mount point HUGETLB_SHARE Explained in "Sharing remapped segments" + HUGETLB_DEBUG + Set to 1 if an application segfaults. Gives very detailed output + and runs extra diagnostics. Sharing remapped segments: -------------------------- @@ -403,6 +406,10 @@ happen if something goes wrong in the middle of unmapping and remapping segments for the text/data/bss feature. +If an application fails to run, set the environment variable HUGETLB_DEBUG +to 1. This causes additional diagnostics to be run. This information should +be included when sending bug reports to the libhugetlbfs team. + Trademarks ========== diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/Makefile new/libhugetlbfs-1.0.1/Makefile --- old/libhugetlbfs-1.0/Makefile 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/Makefile 2006-10-27 19:12:32.000000000 +0200 @@ -5,6 +5,7 @@ SBINOBJS = hugetlbd INSTALL_OBJ_LIBS = libhugetlbfs.so libhugetlbfs.a LDSCRIPT_TYPES = B BDT +LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64 INSTALL_OBJSCRIPT = ld.hugetlbfs VERSION=version.h SOURCE = $(shell find . -maxdepth 1 ! -name version.h -a -name '*.[h]') @@ -60,25 +61,19 @@ OBJDIRS += obj64 endif -LIBDIR32 = $(DESTDIR)$(PREFIX)/$(LIB32) -LIBDIR64 = $(DESTDIR)$(PREFIX)/$(LIB64) +LIBDIR32 = $(PREFIX)/$(LIB32) +LIBDIR64 = $(PREFIX)/$(LIB64) LDSCRIPTDIR = $(PREFIX)/share/libhugetlbfs/ldscripts -BINDIR = $(DESTDIR)$(PREFIX)/share/libhugetlbfs -SBINDIR = $(DESTDIR)$(PREFIX)/sbin -DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/libhugetlbfs +BINDIR = $(PREFIX)/share/libhugetlbfs +SBINDIR = $(PREFIX)/sbin +DOCDIR = $(PREFIX)/share/doc/libhugetlbfs EXTRA_DIST = \ README \ HOWTO \ LGPL-2.1 -ifdef CC32 -INSTALL_LDSCRIPTS = $(foreach type,$(LDSCRIPT_TYPES),$(ELF32).x$(type)) -endif -ifdef CC64 -INSTALL_LDSCRIPTS += $(foreach type,$(LDSCRIPT_TYPES),$(ELF64).x$(type)) -endif - +INSTALL_LDSCRIPTS = $(foreach type,$(LDSCRIPT_TYPES),$(LDSCRIPT_DIST_ELF:%=%.x$(type))) ifdef V VECHO = : @@ -202,17 +197,17 @@ obj32/install: @$(VECHO) INSTALL32 $(LIBDIR32) - $(INSTALL) -d $(LIBDIR32) - $(INSTALL) $(INSTALL_OBJ_LIBS:%=obj32/%) $(LIBDIR32) - $(INSTALL) -d $(SBINDIR) - for x in $(SBINOBJS); do $(INSTALL) obj32/$$x $(SBINDIR)/$$x; done + $(INSTALL) -d $(DESTDIR)$(LIBDIR32) + $(INSTALL) $(INSTALL_OBJ_LIBS:%=obj32/%) $(DESTDIR)$(LIBDIR32) + $(INSTALL) -d $(DESTDIR)$(SBINDIR) + for x in $(SBINOBJS); do $(INSTALL) obj32/$$x $(DESTDIR)$(SBINDIR)/$$x; done obj64/install: @$(VECHO) INSTALL64 $(LIBDIR64) - $(INSTALL) -d $(LIBDIR64) - $(INSTALL) $(INSTALL_OBJ_LIBS:%=obj64/%) $(LIBDIR64) - $(INSTALL) -d $(SBINDIR) - for x in $(SBINOBJS); do $(INSTALL) obj64/$$x $(SBINDIR)/$$x; done + $(INSTALL) -d $(DESTDIR)$(LIBDIR64) + $(INSTALL) $(INSTALL_OBJ_LIBS:%=obj64/%) $(DESTDIR)$(LIBDIR64) + $(INSTALL) -d $(DESTDIR)$(SBINDIR) + for x in $(SBINOBJS); do $(INSTALL) obj64/$$x $(DESTDIR)$(SBINDIR)/$$x; done objscript.%: % @$(VECHO) OBJSCRIPT $* @@ -222,14 +217,14 @@ @$(VECHO) INSTALL $(INSTALL) -d $(DESTDIR)$(LDSCRIPTDIR) $(INSTALL) -m 644 $(INSTALL_LDSCRIPTS:%=ldscripts/%) $(DESTDIR)$(LDSCRIPTDIR) - $(INSTALL) -d $(BINDIR) + $(INSTALL) -d $(DESTDIR)$(BINDIR) for x in $(INSTALL_OBJSCRIPT); do \ - $(INSTALL) -m 755 objscript.$$x $(BINDIR)/$$x; done - cd $(BINDIR) && ln -sf ld.hugetlbfs ld + $(INSTALL) -m 755 objscript.$$x $(DESTDIR)$(BINDIR)/$$x; done + cd $(DESTDIR)$(BINDIR) && ln -sf ld.hugetlbfs ld install-docs: - $(INSTALL) -d $(DOCDIR) - for x in $(EXTRA_DIST); do $(INSTALL) -m 755 $$x $(DOCDIR)/$$x; done + $(INSTALL) -d $(DESTDIR)$(DOCDIR) + for x in $(EXTRA_DIST); do $(INSTALL) -m 755 $$x $(DESTDIR)$(DOCDIR)/$$x; done install-tests: install # Force make to install the library first ${MAKE} -C tests install DESTDIR=$(DESTDIR) OBJDIRS="$(OBJDIRS)" LIB32=$(LIB32) LIB64=$(LIB64) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/NEWS new/libhugetlbfs-1.0.1/NEWS --- old/libhugetlbfs-1.0/NEWS 1970-01-01 01:00:00.000000000 +0100 +++ new/libhugetlbfs-1.0.1/NEWS 2006-10-27 19:12:32.000000000 +0200 @@ -0,0 +1,29 @@ +libhugetlbfs 1.0.1 "Spicy Garlic" +====================================================================== + +This small maintenance release brings a security fix, a few minor bug +fixes, plus some documentation and error message updates. + +Security + +* A section on security has been added to the README file +* The hugetlbd daemon socket has been moved from /tmp to /var/run. + This will require the daemon to be run as root, which was previously + just a recommendation. + +Bug fixes + +* Reduce reserved huge pages needed for application start-up +* PPC linker script fixes + +Trivial but notable changes + +* Always install linker scripts for all targets +* Error message updates +* Add documentation on HUGETLB_DEBUG +* Testcase updates + +libhugetlbfs 1.0 +====================================================================== + +* First stable release diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/README new/libhugetlbfs-1.0.1/README --- old/libhugetlbfs-1.0/README 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/README 2006-10-27 19:12:32.000000000 +0200 @@ -40,3 +40,14 @@ libhugetlbfs-devel@lists.sourceforge.net and we'll help out as much as we can. We will probably ask you to collect things like: straces, /proc/pid/maps and gdb back traces. + +Security Considerations +----------------------------------------------------------------------------- +When using the segment sharing feature, you must take extra steps to avoid +exposing an application to rogue code insertion. We recommend creating your +hugetlbfs mount point with restricted permissions that allow only a specific +user or group to access the files on the mount point. Specifically, you should +restrict directory access (x) permissions for the mount point to the selected +user or group only. The need to perform this manual lock-down will be +unnecessary in a future release, though you may wish to continue the practice +to restrict huge pages to certain users and/or processes. diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/debug.d new/libhugetlbfs-1.0.1/debug.d --- old/libhugetlbfs-1.0/debug.d 2006-10-04 17:16:17.000000000 +0200 +++ new/libhugetlbfs-1.0.1/debug.d 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -obj32/debug.o debug.d: debug.c hugetlbfs.h libhugetlbfs_internal.h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/elflink.c new/libhugetlbfs-1.0.1/elflink.c --- old/libhugetlbfs-1.0/elflink.c 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/elflink.c 2006-10-27 19:12:32.000000000 +0200 @@ -185,6 +185,11 @@ int __debug = 0; static Elf_Ehdr *ehdr; +/* + * Parse an ELF header and record segment information for any segments + * which contain hugetlb information. + */ + static void parse_phdrs(Elf_Ehdr *ehdr) { Elf_Phdr *phdr = (Elf_Phdr *)((char *)ehdr + ehdr->e_phoff); @@ -230,6 +235,10 @@ } } +/* + * Look for non-zero BSS data inside a range and print out any matches + */ + static void check_bss(unsigned long *start, unsigned long *end) { unsigned long *addr; @@ -240,14 +249,15 @@ } } -/* Subtle: Since libhugetlbfs depends on glibc, we allow it +/* + * Subtle: Since libhugetlbfs depends on glibc, we allow it * it to be loaded before us. As part of its init functions, it * initializes stdin, stdout, and stderr in the bss. We need to * include these initialized variables in our copy. */ -static void get_extracopy(struct seg_info *seg, void *p, - void **extra_start, void **extra_end) +static void get_extracopy(struct seg_info *seg, void **extra_start, + void **extra_end) { Elf_Dyn *dyntab; /* dynamic segment table */ Elf_Phdr *phdr; /* program header table */ @@ -262,9 +272,9 @@ end_orig = seg->vaddr + seg->memsz; start_orig = seg->vaddr + seg->filesz; if (seg->filesz == seg->memsz) - goto bail; + goto bail2; if (!minimal_copy) - goto bail; + goto bail2; /* Find dynamic section */ i = 1; @@ -298,7 +308,8 @@ goto bail; } - /* WARNING - The symbol table size calculation does not follow the ELF + /* + * WARNING - The symbol table size calculation does not follow the ELF * standard, but rather exploits an assumption we enforce in * our linker scripts that the string table follows * immediately after the symbol table. The linker scripts @@ -310,12 +321,15 @@ } numsyms = ((void *)strtab - (void *)symtab) / sizeof(Elf_Sym); - /* We must ensure any returns done hereafter have sane start and end - values, as the criss-cross apple sauce algorithm is beginning */ + /* + * We must ensure any returns done hereafter have sane start and end + * values, as the criss-cross apple sauce algorithm is beginning + */ start = end_orig; end = start_orig; - /* To reduce the size of the extra copy window, we can eliminate certain + /* + * To reduce the size of the extra copy window, we can eliminate certain * symbols based on information in the dynamic section. The following * characteristics apply to symbols which may require copying: * - Within the BSS @@ -356,31 +370,40 @@ /* No need to copy anything */ *extra_start = start_orig; *extra_end = start_orig; - goto bail2; + goto bail3; } bail: + DEBUG("Unable to perform minimal copy\n"); +bail2: *extra_start = start_orig; *extra_end = end_orig; -bail2: - DEBUG("Minimal copy was not performed\n"); +bail3: return; } +/* + * Copy a program segment into a huge page. If possible, try to copy the + * smallest amount of data possible, unless the user disables this + * optimization via the HUGETLB_ELFMAP environment variable. + */ + static int prepare_segment(struct seg_info *seg) { int hpage_size = gethugepagesize(); void *p, *extra_start, *extra_end; unsigned long gap; - unsigned long size = ALIGN(seg->memsz, hpage_size); - - /* Prepare the hugetlbfs file */ + unsigned long size; - /* Subtle, copying only filesz bytes of the segment - * allows for much better performance than copying all of - * memsz but it requires that all data (such as the plt) - * be contained in the filesz portion of the segment. + /* + * Calculate the BSS size that we must copy in order to minimize + * the size of the shared mapping. */ + get_extracopy(seg, &extra_start, &extra_end); + size = ALIGN((unsigned long)extra_end - (unsigned long)seg->vaddr, + hpage_size); + + /* Prepare the hugetlbfs file */ p = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, seg->fd, 0); if (p == MAP_FAILED) { @@ -389,12 +412,18 @@ return -1; } + /* + * Subtle, copying only filesz bytes of the segment + * allows for much better performance than copying all of + * memsz but it requires that all data (such as the plt) + * be contained in the filesz portion of the segment. + */ + DEBUG("Mapped hugeseg at %p. Copying %#0lx bytes from %p...\n", p, seg->filesz, seg->vaddr); memcpy(p, seg->vaddr, seg->filesz); DEBUG_CONT("done\n"); - get_extracopy(seg, p, &extra_start, &extra_end); if (extra_end > extra_start) { DEBUG("Copying extra %#0lx bytes from %p...\n", (unsigned long)(extra_end - extra_start), extra_start); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/elflink.d new/libhugetlbfs-1.0.1/elflink.d --- old/libhugetlbfs-1.0/elflink.d 2006-10-04 17:16:17.000000000 +0200 +++ new/libhugetlbfs-1.0.1/elflink.d 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -obj32/elflink.o elflink.d: elflink.c hugetlbfs.h libhugetlbfs_internal.h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/hugetlbd.c new/libhugetlbfs-1.0.1/hugetlbd.c --- old/libhugetlbfs-1.0/hugetlbd.c 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/hugetlbd.c 2006-10-27 19:12:32.000000000 +0200 @@ -846,15 +846,15 @@ sun.sun_family = AF_UNIX; /* clear out any previous socket */ - unlink("/tmp/libhugetlbfs-sock"); - strcpy(sun.sun_path, "/tmp/libhugetlbfs-sock"); + unlink(SOCKFILE); + strcpy(sun.sun_path, SOCKFILE); ret = bind(sock, (struct sockaddr *)(&sun), sizeof(sun)); if (ret < 0) { ERROR("bind() failed: %s\n", strerror(errno)); goto die; } - chmod("/tmp/libhugetlbfs-sock", 0666); + chmod(SOCKFILE, 0666); ret = listen(sock, QUEUE_LENGTH); if (ret < 0) { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/hugetlbd.h new/libhugetlbfs-1.0.1/hugetlbd.h --- old/libhugetlbfs-1.0/hugetlbd.h 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/hugetlbd.h 2006-10-27 19:12:32.000000000 +0200 @@ -26,6 +26,7 @@ #define ID_KEY 0x56 #define LOGFILE "/tmp/hugetlbd.log" +#define SOCKFILE "/var/run/libhugetlbfs-sock" /* * Ideally, would like to deal with this better, so that a 32-bit daemon diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/hugeutils.c new/libhugetlbfs-1.0.1/hugeutils.c --- old/libhugetlbfs-1.0/hugeutils.c 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/hugeutils.c 2006-10-27 19:12:32.000000000 +0200 @@ -213,8 +213,9 @@ tmp++; } - ERROR("Could not find hugetlbfs mount point in /proc/mounts. " - "Is it mounted?\n"); + WARNING("Could not find hugetlbfs mount point in /proc/mounts. " + "Is it mounted?\n"); + return NULL; } @@ -319,7 +320,7 @@ } sun.sun_family = AF_UNIX; - strcpy(sun.sun_path, "/tmp/libhugetlbfs-sock"); + strcpy(sun.sun_path, SOCKFILE); ret = connect(sock, &sun, sizeof(sun)); if (ret < 0) { ERROR("connect() failed: %s\n", strerror(errno)); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/hugeutils.d new/libhugetlbfs-1.0.1/hugeutils.d --- old/libhugetlbfs-1.0/hugeutils.d 2006-10-04 17:16:17.000000000 +0200 +++ new/libhugetlbfs-1.0.1/hugeutils.d 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -obj32/hugeutils.o hugeutils.d: hugeutils.c libhugetlbfs_internal.h \ - hugetlbfs.h hugetlbd.h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/ldscripts/elf32ppclinux.xB new/libhugetlbfs-1.0.1/ldscripts/elf32ppclinux.xB --- old/libhugetlbfs-1.0/ldscripts/elf32ppclinux.xB 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/ldscripts/elf32ppclinux.xB 2006-10-27 19:12:32.000000000 +0200 @@ -199,6 +199,7 @@ .bss : { *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) /* * Align here to ensure that the .bss section occupies space up to diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/morecore.d new/libhugetlbfs-1.0.1/morecore.d --- old/libhugetlbfs-1.0/morecore.d 2006-10-04 17:16:17.000000000 +0200 +++ new/libhugetlbfs-1.0.1/morecore.d 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -obj32/morecore.o morecore.d: morecore.c hugetlbfs.h \ - libhugetlbfs_internal.h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/tests/Makefile new/libhugetlbfs-1.0.1/tests/Makefile --- old/libhugetlbfs-1.0/tests/Makefile 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/tests/Makefile 2006-10-27 19:12:32.000000000 +0200 @@ -28,8 +28,8 @@ SCRIPTS32 = $(SCRIPTS)/$(ELF32) SCRIPTS64 = $(SCRIPTS)/$(ELF64) HUGETLBFS_LD=../ld.hugetlbfs -LIBDIR32 = $(DESTDIR)$(PREFIX)/$(LIB32) -LIBDIR64 = $(DESTDIR)$(PREFIX)/$(LIB64) +LIBDIR32 = $(PREFIX)/$(LIB32) +LIBDIR64 = $(PREFIX)/$(LIB64) INST_TESTSDIR32 = $(LIBDIR32)/libhugetlbfs/tests INST_TESTSDIR64 = $(LIBDIR64)/libhugetlbfs/tests @@ -137,17 +137,17 @@ obj32/install: @$(VECHO) INSTALL32 $(INST_TESTSDIR32) - $(INSTALL) -d $(INST_TESTSDIR32) - $(INSTALL) -d $(INST_TESTSDIR32)/obj32 - $(INSTALL) -m 755 $(TESTS:%=obj32/%) $(INST_TESTSDIR32)/obj32 - $(INSTALL) -m 755 run_tests.sh $(INST_TESTSDIR32) + $(INSTALL) -d $(DESTDIR)$(INST_TESTSDIR32) + $(INSTALL) -d $(DESTDIR)$(INST_TESTSDIR32)/obj32 + $(INSTALL) -m 755 $(TESTS:%=obj32/%) $(DESTDIR)$(INST_TESTSDIR32)/obj32 + $(INSTALL) -m 755 run_tests.sh $(DESTDIR)$(INST_TESTSDIR32) obj64/install: @$(VECHO) INSTALL64 $(INST_TESTSDIR64) - $(INSTALL) -d $(INST_TESTSDIR64) - $(INSTALL) -d $(INST_TESTSDIR64)/obj64 - $(INSTALL) -m 755 $(TESTS:%=obj64/%) $(INST_TESTSDIR64)/obj64 - $(INSTALL) -m 755 $(TESTS_64:%=obj64/%) $(INST_TESTSDIR64)/obj64 - $(INSTALL) -m 755 run_tests.sh $(INST_TESTSDIR64) + $(INSTALL) -d $(DESTDIR)$(INST_TESTSDIR64) + $(INSTALL) -d $(DESTDIR)$(INST_TESTSDIR64)/obj64 + $(INSTALL) -m 755 $(TESTS:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 + $(INSTALL) -m 755 $(TESTS_64:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 + $(INSTALL) -m 755 run_tests.sh $(DESTDIR)$(INST_TESTSDIR64) install: $(OBJDIRS:%=%/install) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/tests/linkshare.c new/libhugetlbfs-1.0.1/tests/linkshare.c --- old/libhugetlbfs-1.0/tests/linkshare.c 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/tests/linkshare.c 2006-10-27 19:12:32.000000000 +0200 @@ -168,7 +168,10 @@ num_sharings = atoi(argv[1]); if (num_sharings > 99999) - FAIL("Too many sharings requested (max = 99999)"); + CONFIG("Too many sharings requested (max = 99999)"); + if (num_sharings <= 0) + CONFIG("Number of sharings requested must be greater " + "than or equal to 0"); children = (pid_t *)malloc(num_sharings * sizeof(pid_t)); if (!children) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/tests/mlock.c new/libhugetlbfs-1.0.1/tests/mlock.c --- old/libhugetlbfs-1.0/tests/mlock.c 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/tests/mlock.c 2006-10-27 19:12:32.000000000 +0200 @@ -29,46 +29,36 @@ #include <hugetlbfs.h> #include "hugetests.h" -static void test_simple_mlock(unsigned long size, unsigned long map_flags) +static void test_simple_mlock(int flags) { - char *a; - int ret; int fd = hugetlbfs_unlinked_fd(); + void *p; + int ret; - a = mmap(0, size, PROT_READ|PROT_WRITE, map_flags, fd, 0); - if (a == MAP_FAILED) - FAIL("mmap() failed: %s", strerror(errno)); - - if (map_flags & MAP_LOCKED) { - ret = mlock(a, size); - if (ret) - FAIL("mlock() failed: %s", strerror(errno)); - - ret = munlock(a, size); - if (ret) - FAIL("munlock() failed: %s", strerror(errno)); - } + p = mmap(0, gethugepagesize(), PROT_READ|PROT_WRITE, flags, fd, 0); + if (p == MAP_FAILED) + FAIL("mmap() failed (flags=%x): %s", flags, strerror(errno)); - ret = munmap(a, size); + ret = mlock(p, gethugepagesize()); if (ret) - FAIL("munmap() failed: %s", strerror(errno)); + FAIL("mlock() failed (flags=%x): %s", flags, strerror(errno)); + + ret = munlock(p, gethugepagesize()); + if (ret) + FAIL("munlock() failed (flags=%x): %s", flags, strerror(errno)); + + ret = munmap(p, gethugepagesize()); + if (ret) + FAIL("munmap() failed (flags=%x): %s", flags, strerror(errno)); close(fd); } int main(int argc, char *argv[]) { - unsigned long tot_pages, size; - - if (argc != 2) - CONFIG("Usage: mlock <# total available hugepages>"); - - tot_pages = atoi(argv[1]); - size = tot_pages * gethugepagesize(); - - test_simple_mlock(size, MAP_PRIVATE); - test_simple_mlock(size, MAP_SHARED); - test_simple_mlock(size, MAP_PRIVATE|MAP_LOCKED); - test_simple_mlock(size, MAP_SHARED|MAP_LOCKED); + test_simple_mlock(MAP_PRIVATE); + test_simple_mlock(MAP_SHARED); + test_simple_mlock(MAP_PRIVATE|MAP_LOCKED); + test_simple_mlock(MAP_SHARED|MAP_LOCKED); PASS(); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/tests/run_tests.sh new/libhugetlbfs-1.0.1/tests/run_tests.sh --- old/libhugetlbfs-1.0/tests/run_tests.sh 2006-10-04 17:16:15.000000000 +0200 +++ new/libhugetlbfs-1.0.1/tests/run_tests.sh 2006-10-27 19:12:32.000000000 +0200 @@ -30,7 +30,7 @@ } run_test () { - for bits in 32 64; do + for bits in $WORDSIZES; do run_test_bits $bits "$@" done } @@ -64,14 +64,15 @@ baseprog="${args[$N]}" unset args[$N] set -- "${args[@]}" + NUM_THREADS=$((`free_hpages` / 15 - 1)) killall -HUP hugetlbd - run_test HUGETLB_SHARE=2 "$@" "xB.$baseprog" 10 + run_test HUGETLB_SHARE=2 "$@" "xB.$baseprog" $NUM_THREADS killall -HUP hugetlbd - run_test HUGETLB_SHARE=1 "$@" "xB.$baseprog" 10 + run_test HUGETLB_SHARE=1 "$@" "xB.$baseprog" $NUM_THREADS killall -HUP hugetlbd - run_test HUGETLB_SHARE=2 "$@" "xBDT.$baseprog" 10 + run_test HUGETLB_SHARE=2 "$@" "xBDT.$baseprog" $NUM_THREADS killall -HUP hugetlbd - run_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog" 10 + run_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog" $NUM_THREADS } setup_shm_sysctl() { @@ -99,7 +100,7 @@ # Library tests requiring kernel hugepage support run_test gethugepagesize - run_test empty_mounts + run_test HUGETLB_VERBOSE=1 empty_mounts # Tests requiring an active and usable hugepage mount run_test find_path @@ -108,7 +109,7 @@ run_test truncate run_test shared run_test mprotect - run_test mlock `free_hpages` + run_test mlock # Specific kernel bug tests run_test ptrace-write-hugepage @@ -174,10 +175,10 @@ restore_shm_sysctl } -while getopts "vVdt:" ARG ; do +while getopts "vVdt:b:" ARG ; do case $ARG in "v") - unset QUIET_TEST=1 + unset QUIET_TEST ;; "V") export HUGETLB_VERBOSE=99 @@ -185,6 +186,9 @@ "t") TESTSETS=$OPTARG ;; + "b") + WORDSIZES=$OPTARG + ;; esac done @@ -192,6 +196,10 @@ TESTSETS="func stress" fi +if [ -z "$WORDSIZES" ]; then + WORDSIZES="32 64" +fi + for set in $TESTSETS; do case $set in "func") diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/version new/libhugetlbfs-1.0.1/version --- old/libhugetlbfs-1.0/version 2006-10-04 16:56:21.000000000 +0200 +++ new/libhugetlbfs-1.0.1/version 2006-10-27 19:12:35.000000000 +0200 @@ -1 +1 @@ -1.0 +1.0.1 diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/version.d new/libhugetlbfs-1.0.1/version.d --- old/libhugetlbfs-1.0/version.d 2006-10-04 17:16:17.000000000 +0200 +++ new/libhugetlbfs-1.0.1/version.d 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -obj32/version.o version.d: version.c version.h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libhugetlbfs-1.0/version.h new/libhugetlbfs-1.0.1/version.h --- old/libhugetlbfs-1.0/version.h 2006-10-04 16:56:21.000000000 +0200 +++ new/libhugetlbfs-1.0.1/version.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -// 1.0 -#define VERSION "1.0" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@suse.de