core/glibc to 2.26-3

This commit is contained in:
Kevin Mihelich 2017-09-09 16:44:29 +00:00
parent 786e4839e5
commit 32c5f62036
2 changed files with 153 additions and 36 deletions

View file

@ -0,0 +1,110 @@
From fc5ad7024c620cdfe9b76e94638aac83b99c5bf8 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Tue, 8 Aug 2017 16:21:58 +0200
Subject: [PATCH] Don't use IFUNC resolver for longjmp or system in libpthread
(bug 21041)
Unlike the vfork forwarder and like the fork forwarder as in bug 19861,
there won't be a problem when the compiler does not turn this into a tail
call.
---
nptl/pt-longjmp.c | 31 ++++++++++---------------------
nptl/pt-system.c | 24 ++++++++----------------
3 files changed, 18 insertions(+), 37 deletions(-)
diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c
index 2ef757e687f..8f3c6b3a09f 100644
--- a/nptl/pt-longjmp.c
+++ b/nptl/pt-longjmp.c
@@ -25,21 +25,14 @@
symbol in libpthread, but the historical ABI requires it. For static
linking, there is no need to provide anything here--the libc version
will be linked in. For shared library ABI compatibility, there must be
- longjmp and siglongjmp symbols in libpthread.so; so we define them using
- IFUNC to redirect to the libc function. */
+ longjmp and siglongjmp symbols in libpthread.so.
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-# if HAVE_IFUNC
-
-# undef INIT_ARCH
-# define INIT_ARCH()
-# define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp)
-
-extern __typeof(longjmp) longjmp_ifunc;
-extern __typeof(siglongjmp) siglongjmp_ifunc;
+ With an IFUNC resolver, it would be possible to avoid the indirection,
+ but the IFUNC resolver might run before the __libc_longjmp symbol has
+ been relocated, in which case the IFUNC resolver would not be able to
+ provide the correct address. */
-# else /* !HAVE_IFUNC */
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
static void __attribute__ ((noreturn, used))
longjmp_compat (jmp_buf env, int val)
@@ -47,14 +40,10 @@ longjmp_compat (jmp_buf env, int val)
__libc_longjmp (env, val);
}
-# define DEFINE_LONGJMP(name) strong_alias (longjmp_compat, name)
-
-# endif /* HAVE_IFUNC */
-
-DEFINE_LONGJMP (longjmp_ifunc)
-compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0);
+strong_alias (longjmp_compat, longjmp_alias)
+compat_symbol (libpthread, longjmp_alias, longjmp, GLIBC_2_0);
-strong_alias (longjmp_ifunc, siglongjmp_ifunc)
-compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0);
+strong_alias (longjmp_alias, siglongjmp_alias)
+compat_symbol (libpthread, siglongjmp_alias, siglongjmp, GLIBC_2_0);
#endif
diff --git a/nptl/pt-system.c b/nptl/pt-system.c
index f8ca6ba0d94..b30ddf2b398 100644
--- a/nptl/pt-system.c
+++ b/nptl/pt-system.c
@@ -25,29 +25,21 @@
libpthread, but the historical ABI requires it. For static linking,
there is no need to provide anything here--the libc version will be
linked in. For shared library ABI compatibility, there must be a
- 'system' symbol in libpthread.so; so we define it using IFUNC to
- redirect to the libc function. */
+ 'system' symbol in libpthread.so.
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-# if HAVE_IFUNC
-
-extern __typeof(system) system_ifunc;
-# undef INIT_ARCH
-# define INIT_ARCH()
-libc_ifunc (system_ifunc, &__libc_system)
+ With an IFUNC resolver, it would be possible to avoid the indirection,
+ but the IFUNC resolver might run before the __libc_system symbol has
+ been relocated, in which case the IFUNC resolver would not be able to
+ provide the correct address. */
-# else /* !HAVE_IFUNC */
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
static int __attribute__ ((used))
system_compat (const char *line)
{
return __libc_system (line);
}
-strong_alias (system_compat, system_ifunc)
-
-# endif /* HAVE_IFUNC */
-
-compat_symbol (libpthread, system_ifunc, system, GLIBC_2_0);
+strong_alias (system_compat, system_alias)
+compat_symbol (libpthread, system_alias, system, GLIBC_2_0);
#endif
--
2.14.1

View file

@ -1,5 +1,6 @@
# $Id$
# Maintainer: Allan McRae <allan@archlinux.org>
# Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: valgrind requires rebuilt with each major glibc version
@ -11,32 +12,41 @@
noautobuild=1
pkgname=glibc
pkgver=2.25
pkgrel=7
_commit=adc7e06fb412a2a1ee52f8cb788caf436335b9f3 # release/2.25/master
pkgver=2.26
pkgrel=3
pkgdesc='GNU C Library'
arch=(i686 x86_64)
url='http://www.gnu.org/software/libc'
license=(GPL LGPL)
groups=(base)
depends=('linux-api-headers>=4.10' tzdata filesystem)
makedepends=('gcc>=6' git gd)
makedepends=(git gd)
optdepends=('gd: for memusagestat')
backup=(etc/gai.conf
etc/locale.gen
etc/nscd.conf)
options=(!strip staticlibs !distcc)
install=glibc.install
_commit=58270c0049404ef2f878fdd45df55f17f0b8c1f7
source=(git://sourceware.org/git/glibc.git#commit=${_commit}
locale.gen.txt
locale-gen)
locale-gen
0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch)
md5sums=('SKIP'
'07ac979b6ab5eeb778d55f041529d623'
'476e9113489f93b348b21e144b6a8fcf')
'476e9113489f93b348b21e144b6a8fcf'
'cbc073315c00b03898b7fc614274d6b3')
# pkgver() {
# cd glibc
# git describe --tags | sed 's/^glibc-//;s/-/+/g'
# }
prepare() {
mkdir glibc-build
cd ${pkgname}
mkdir -p glibc-build
cd glibc
patch -p1 -i "$srcdir/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch"
}
build() {
@ -44,7 +54,7 @@ build() {
if [[ ${CARCH} = "i686" ]]; then
# Hack to fix NPTL issues with Xen, only required on 32bit platforms
export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
export CFLAGS="$CFLAGS -mno-tls-direct-seg-refs"
fi
# ALARM: Specify build host types
@ -61,21 +71,21 @@ build() {
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
../${pkgname}/configure \
"$srcdir/glibc/configure" \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--with-headers=/usr/include \
--with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues \
--enable-add-ons \
--enable-obsolete-rpc \
--enable-kernel=2.6.32 \
--enable-bind-now \
--disable-profile \
--enable-stackguard-randomization \
--enable-stack-protector=strong \
--enable-lock-elision \
--disable-multi-arch \
--enable-obsolete-nsl \
--enable-obsolete-rpc \
--enable-stack-protector=strong \
--enable-stackguard-randomization \
--disable-profile \
--disable-werror \
$CONFIGFLAG
@ -102,29 +112,28 @@ check() {
}
package() {
cd glibc-build
install -dm755 "$pkgdir/etc"
touch "$pkgdir/etc/ld.so.conf"
install -dm755 ${pkgdir}/etc
touch ${pkgdir}/etc/ld.so.conf
make -C glibc-build install_root="$pkgdir" install
rm -f "$pkgdir"/etc/ld.so.{cache,conf}
make install_root=${pkgdir} install
cd glibc
rm -f ${pkgdir}/etc/ld.so.{cache,conf}
install -dm755 "$pkgdir"/usr/lib/{locale,systemd/system,tmpfiles.d}
install -m644 nscd/nscd.conf "$pkgdir/etc/nscd.conf"
install -m644 nscd/nscd.service "$pkgdir/usr/lib/systemd/system"
install -m644 nscd/nscd.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/nscd.conf"
install -dm755 "$pkgdir/var/db/nscd"
install -dm755 ${pkgdir}/usr/lib/{locale,systemd/system,tmpfiles.d}
install -m644 posix/gai.conf "$pkgdir"/etc/gai.conf
install -m644 ${srcdir}/${pkgname}/nscd/nscd.conf ${pkgdir}/etc/nscd.conf
install -m644 ${srcdir}/${pkgname}/nscd/nscd.service ${pkgdir}/usr/lib/systemd/system
install -m644 ${srcdir}/${pkgname}/nscd/nscd.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/nscd.conf
install -m644 ${srcdir}/${pkgname}/posix/gai.conf ${pkgdir}/etc/gai.conf
install -m755 ${srcdir}/locale-gen ${pkgdir}/usr/bin
install -m755 "$srcdir/locale-gen" "$pkgdir/usr/bin"
# create /etc/locale.gen
install -m644 ${srcdir}/locale.gen.txt ${pkgdir}/etc/locale.gen
install -m644 "$srcdir/locale.gen.txt" "$pkgdir/etc/locale.gen"
sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \
${srcdir}/glibc/localedata/SUPPORTED >> ${pkgdir}/etc/locale.gen
"$srcdir/glibc/localedata/SUPPORTED" >> "$pkgdir/etc/locale.gen"
# ALARM: symlink ld-linux.so.3 for hard-float
[[ $CARCH == "armv6h" || $CARCH == "armv7h" ]] && ln -s /lib/ld-${pkgver}.so ${pkgdir}/usr/lib/ld-linux.so.3
@ -136,14 +145,11 @@ package() {
# libpthread-${pkgver}.so
# libthread_db-1.0.so
cd $pkgdir
cd "$pkgdir"
strip $STRIP_BINARIES usr/bin/{gencat,getconf,getent,iconv,iconvconfig} \
usr/bin/{ldconfig,locale,localedef,nscd,makedb} \
usr/bin/{pcprofiledump,pldd,rpcgen,sln,sprof} \
usr/lib/getconf/*
if [[ $CARCH = "i686" ]]; then
strip $STRIP_BINARIES usr/bin/lddlibc4
fi
strip $STRIP_STATIC usr/lib/lib{anl,BrokenLocale,c{,_nonshared},crypt}.a \
usr/lib/lib{dl,g,ieee,mcheck,nsl,pthread{,_nonshared}}.a \
@ -159,8 +165,9 @@ package() {
strip $STRIP_STATIC usr/lib/lib{m-${pkgver},mvec{,_nonshared}}.a
strip $STRIP_SHARED usr/lib/libmvec-*.so
fi
if [[ $CARCH = "i686" ]]; then
strip $STRIP_BINARIES usr/bin/lddlibc4
strip $STRIP_STATIC usr/lib/libm.a
fi
}