From 226aa20fcb02ce536831fdd82ddd9d9284c6d627 Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Mar 03 2014 12:25:19 +0000 Subject: import libhugetlbfs-2.16-7.el7.src.rpm --- diff --git a/SOURCES/libhugetlbfs-2.16-makefile_cflags.patch b/SOURCES/libhugetlbfs-2.16-makefile_cflags.patch new file mode 100644 index 0000000..de95b12 --- /dev/null +++ b/SOURCES/libhugetlbfs-2.16-makefile_cflags.patch @@ -0,0 +1,12 @@ +diff -up libhugetlbfs-2.16/Makefile.orig libhugetlbfs-2.16/Makefile +--- libhugetlbfs-2.16/Makefile.orig 2014-03-03 12:50:43.408107252 +0100 ++++ libhugetlbfs-2.16/Makefile 2014-03-03 12:52:01.070230134 +0100 +@@ -29,7 +29,7 @@ INSTALL = install + + LDFLAGS += -Wl,-z,noexecstack -ldl + CFLAGS ?= -O2 -g +-CFLAGS += -Wall -fPIC ++CFLAGS += -Wall -fPIC -fstack-protector-strong + CPPFLAGS += -D__LIBHUGETLBFS__ -DFORTIFY_SOURCE + + ARCH = $(shell uname -m | sed -e s/i.86/i386/) diff --git a/SOURCES/libhugetlbfs-2.16-misalign_test.patch b/SOURCES/libhugetlbfs-2.16-misalign_test.patch new file mode 100644 index 0000000..a831955 --- /dev/null +++ b/SOURCES/libhugetlbfs-2.16-misalign_test.patch @@ -0,0 +1,96 @@ +commit fd430caf7126228cd7e208547ae83b335400e040 +Author: Jan Stancek +Date: Mon Feb 10 21:18:05 2014 -0500 + + [PATCH] misalign: misaligned length allowed on kernels >= 3.10-rc1 + + Startin with 3.10-rc1, length passed in mmap() doesn't need + to be aligned because commit af73e4d9506d3b797509f3c030e7dcd554f7d9c4 + added ALIGN() to kernel side, in mmap_pgoff(), when mapping huge + page files. + + This patch treats successful mmap() with misaligned length on + kernels >= 3.10 as PASS. + + See also: + Bug 56881 - MAP_HUGETLB mmap fails for certain sizes + https://bugzilla.kernel.org/show_bug.cgi?id=56881 + + Signed-off-by: Jan Stancek + Signed-off-by: Eric Munson + +diff --git a/tests/misalign.c b/tests/misalign.c +index de85be6..de1bf98 100644 +--- a/tests/misalign.c ++++ b/tests/misalign.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #include + +@@ -40,6 +41,11 @@ + * necessary checks for the hugepage paths. This testcase ensures + * that attempted hugepage mappings with parameters which are not + * correctly hugepage aligned are rejected. ++ * ++ * However starting with 3.10-rc1, length passed in mmap() doesn't need ++ * to be aligned because commit af73e4d9506d3b797509f3c030e7dcd554f7d9c4 ++ * added ALIGN() to kernel side, in mmap_pgoff(), when mapping huge page ++ * files. + */ + int main(int argc, char *argv[]) + { +@@ -47,9 +53,13 @@ int main(int argc, char *argv[]) + int fd; + void *p, *q; + int err; ++ struct utsname buf; + + test_init(argc, argv); + ++ if (uname(&buf) != 0) ++ FAIL("uname failed %s", strerror(errno)); ++ + page_size = getpagesize(); + hpage_size = check_hugepagesize(); + +@@ -92,16 +102,30 @@ int main(int argc, char *argv[]) + + /* 3) Try a misaligned length */ + q = mmap(NULL, page_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); +- if (q != MAP_FAILED) +- FAIL("mmap() with misaligned length 0x%lx succeeded", +- page_size); ++ ++ if (test_compare_kver(buf.release, "3.10.0") < 0) { ++ if (q != MAP_FAILED) ++ FAIL("mmap() with misaligned length 0x%lx succeeded", ++ page_size); ++ } else { ++ if (q == MAP_FAILED) ++ FAIL("mmap() with misaligned length 0x%lx failed", ++ page_size); ++ } + + /* 4) Try a misaligned length with MAP_FIXED */ + q = mmap(p, page_size, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_FIXED, fd, 0); +- if (q != MAP_FAILED) +- FAIL("mmap() MAP_FIXED with misaligned length 0x%lx succeeded", +- page_size); ++ ++ if (test_compare_kver(buf.release, "3.10.0") < 0) { ++ if (q != MAP_FAILED) ++ FAIL("mmap() MAP_FIXED with misaligned length 0x%lx " ++ "succeeded", page_size); ++ } else { ++ if (q == MAP_FAILED) ++ FAIL("mmap() MAP_FIXED with misaligned length 0x%lx " ++ "failed", page_size); ++ } + + /* 5) Try a misaligned offset */ + q = mmap(NULL, hpage_size, PROT_READ|PROT_WRITE, diff --git a/SOURCES/libhugetlbfs-2.17-aarch64.patch b/SOURCES/libhugetlbfs-2.17-aarch64.patch new file mode 100644 index 0000000..7d1db49 --- /dev/null +++ b/SOURCES/libhugetlbfs-2.17-aarch64.patch @@ -0,0 +1,157 @@ +diff --git a/Makefile b/Makefile +index 48205af..0e61701 100644 +--- a/Makefile ++++ b/Makefile +@@ -57,6 +57,12 @@ TMPLIB32 = lib + ELF32 += armelf_linux_eabi + CUSTOM_LDSCRIPTS = no + else ++ifeq ($(ARCH),aarch64) ++CC64 = gcc ++ELF64 = aarch64elf ++TMPLIB64 = lib64 ++CUSTOM_LDSCRIPTS = no ++else + ifeq ($(ARCH),i386) + CC32 = gcc + ELF32 = elf_i386 +@@ -100,6 +106,7 @@ endif + endif + endif + endif ++endif + + ifdef CC32 + OBJDIRS += obj32 +diff --git a/ld.hugetlbfs b/ld.hugetlbfs +index d6d12c4..ba9e00a 100755 +--- a/ld.hugetlbfs ++++ b/ld.hugetlbfs +@@ -79,11 +79,6 @@ if [ -n "$HTLB_LINK" ]; then + HTLB_ALIGN="" # --hugetlbfs-link overrides --hugetlbfs-align + LDSCRIPT="$EMU.x$HTLB_LINK" + HTLBOPTS="-T${HUGETLB_LDSCRIPT_PATH}/${LDSCRIPT}" +- +- if [ "$EMU" == "armelf_linux_eabi" ]; then +- echo "Please use --hugetlbfs-align when targeting ARM." +- exit -1 +- fi + fi + + MB=$((1024*1024)) +@@ -91,7 +86,7 @@ case "$EMU" in + elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;; + elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; + elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; +-armelf_linux_eabi) HPAGE_SIZE=$((2*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; ++armelf_linux_eabi|aarch64elf) HPAGE_SIZE=$((2*MB)) SLICE_SIZE=$HPAGE_SIZE ;; + esac + + if [ "$HTLB_ALIGN" == "slice" ]; then +diff --git a/sys-aarch64elf.S b/sys-aarch64elf.S +new file mode 100644 +index 0000000..54799d3 +--- /dev/null ++++ b/sys-aarch64elf.S +@@ -0,0 +1,34 @@ ++/* ++ * libhugetlbfs - Easy use of Linux hugepages ++ * Copyright (C) 2013 Linaro Ltd. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public License ++ * version 2.1 as published by the Free Software Foundation. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ .text ++ ++ .globl direct_syscall ++ ++ ++direct_syscall: ++ uxtw x8, w0 ++ mov x0, x1 ++ mov x1, x2 ++ mov x2, x3 ++ mov x3, x4 ++ mov x4, x5 ++ mov x5, x6 ++ mov x6, x7 ++ svc 0x0 ++ ret +diff --git a/tests/Makefile b/tests/Makefile +index 231e3b0..9140e72 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -54,7 +54,7 @@ ifeq ($(CUSTOM_LDSCRIPTS),yes) + TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) $(HUGELINK_TESTS:%=xB.%) \ + $(HUGELINK_TESTS:%=xBDT.%) + else +-TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) ++TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) $(HUGELINK_RW_TESTS) + endif + + endif +diff --git a/tests/icache-hygiene.c b/tests/icache-hygiene.c +index 51792b3..876ce10 100644 +--- a/tests/icache-hygiene.c ++++ b/tests/icache-hygiene.c +@@ -54,7 +54,7 @@ static void cacheflush(void *p) + { + #if defined(__powerpc__) + asm volatile("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r"(p)); +-#elif defined(__arm__) ++#elif defined(__arm__) || defined(__aarch64__) + __clear_cache(p, p + COPY_SIZE); + #endif + } +@@ -87,8 +87,9 @@ static void *sig_expected; + static void sig_handler(int signum, siginfo_t *si, void *uc) + { + #if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \ +- defined(__s390__) || defined(__s390x__) || defined(__sparc__) +- /* On powerpc and ia64 and s390, 0 bytes are an illegal ++ defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \ ++ defined(__aarch64__) ++ /* On powerpc, ia64, s390 and Aarch64, 0 bytes are an illegal + * instruction, so, if the icache is cleared properly, we SIGILL + * as soon as we jump into the cleared page */ + if (signum == SIGILL) { +diff --git a/tests/mprotect.c b/tests/mprotect.c +index aa4673e..db6a662 100644 +--- a/tests/mprotect.c ++++ b/tests/mprotect.c +@@ -213,5 +213,11 @@ int main(int argc, char *argv[]) + test_mprotect(fd, "RW->R 1/2", 2*hpage_size, PROT_READ|PROT_WRITE, + hpage_size, PROT_READ); + ++ /* PROT_NONE tests */ ++ test_mprotect(fd, "NONE->R", hpage_size, PROT_NONE, ++ hpage_size, PROT_READ); ++ test_mprotect(fd, "NONE->RW", hpage_size, PROT_NONE, ++ hpage_size, PROT_READ|PROT_WRITE); ++ + PASS(); + } +diff --git a/tests/mremap-expand-slice-collision.c b/tests/mremap-expand-slice-collision.c +index c25f4c6..853f3c3 100644 +--- a/tests/mremap-expand-slice-collision.c ++++ b/tests/mremap-expand-slice-collision.c +@@ -38,7 +38,7 @@ void init_slice_boundary(int fd) + unsigned long slice_size; + void *p1, *p2, *heap; + int slices_ok, i, rc; +-#ifdef __LP64__ ++#if defined(__LP64__) && !defined(__aarch64__) + /* powerpc: 1TB slices starting at 1 TB */ + slice_boundary = 0x10000000000; + slice_size = 0x10000000000; diff --git a/SPECS/libhugetlbfs.spec b/SPECS/libhugetlbfs.spec index f22ecf5..aa523b1 100644 --- a/SPECS/libhugetlbfs.spec +++ b/SPECS/libhugetlbfs.spec @@ -1,6 +1,6 @@ Name: libhugetlbfs Version: 2.16 -Release: 2%{?dist} +Release: 7%{?dist} Summary: A library which provides easy access to huge pages of memory Group: System Environment/Libraries License: LGPLv2+ @@ -8,6 +8,9 @@ URL: http://libhugetlbfs.sourceforge.net/ Source0: http://downloads.sourceforge.net/libhugetlbfs/%{name}-%{version}.tar.gz Patch0: libhugetlbfs-2.16-s390.patch Patch1: libhugetlbfs-2.15-fortify.patch +Patch2: libhugetlbfs-2.16-misalign_test.patch +Patch3: libhugetlbfs-2.17-aarch64.patch +Patch4: libhugetlbfs-2.16-makefile_cflags.patch BuildRequires: glibc-devel BuildRequires: glibc-static @@ -42,6 +45,9 @@ pool size control. pagesize lists page sizes available on the machine. %setup -q -n %{name}-%{version} %patch0 -p1 -b .s390 %patch1 -p1 -b .fortify +%patch2 -p1 -b .misalign_test +%patch3 -p1 -b .aarch64 +%patch4 -p1 -b .makefile_cflags %build # Parallel builds are not reliable @@ -103,6 +109,21 @@ rm -fr $RPM_BUILD_ROOT/%{_sbindir}/ %exclude /usr/lib/perl5/TLBC %changelog +* Mon Mar 03 2014 Petr Holasek - 2.16-7 +- Compiling with -fstack-protector-strong flag (#1070772) + +* Wed Feb 12 2014 Petr Holasek - 2.16-6 +- Backport patches from 2.17 for AArch64 support. + +* Tue Feb 11 2014 Petr Holasek - 2.16-5 +- Fix of misalign test (#1034549) + +* Fri Jan 24 2014 Daniel Mach - 2.16-4 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 2.16-3 +- Mass rebuild 2013-12-27 + * Sun May 12 2013 Anton Arapov - 2.16-2 - Fortify code - Fix s390 build issues (#960107)