summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Stewart2017-09-12 21:24:14 +0100
committerPatrick Stewart2017-09-12 21:24:14 +0100
commitc2192374d6d4aba0c10a6351be8a410e94d2d095 (patch)
tree501c0cd8c06a4a8c7198775662d6cba3a833be01
parent4063c9486439ef8352123d6b0326dd521b253296 (diff)
downloadaur-c2192374d6d4aba0c10a6351be8a410e94d2d095.tar.gz
Update to 2.26-3
-rw-r--r--.SRCINFO15
-rw-r--r--0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch110
-rw-r--r--0001-Revert-linux-spawni.c-simplify-error-reporting-to-pa.patch188
-rw-r--r--PKGBUILD104
4 files changed, 366 insertions, 51 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d992eb91d4e4..c0fb1e8f215c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = glibc-wsl
pkgdesc = GNU C Library
- pkgver = 2.25
- pkgrel = 2
+ pkgver = 2.26
+ pkgrel = 3
url = http://www.gnu.org/software/libc
install = glibc.install
arch = i686
@@ -9,24 +9,29 @@ pkgbase = glibc-wsl
groups = base
license = GPL
license = LGPL
- makedepends = gcc>=6
makedepends = git
+ makedepends = gd
depends = linux-api-headers>=4.10
depends = tzdata
depends = filesystem
- provides = glibc=2.25-2
+ optdepends = gd: for memusagestat
+ provides = glibc=2.26-3
conflicts = glibc
options = !strip
options = staticlibs
backup = etc/gai.conf
backup = etc/locale.gen
backup = etc/nscd.conf
- source = git+https://sourceware.org/git/glibc.git#commit=ccb4fd7a657b0fbc4890c98f4586d58a135fc583
+ source = glibc::git+https://sourceware.org/git/glibc.git#commit=58270c0049404ef2f878fdd45df55f17f0b8c1f7
source = locale.gen.txt
source = locale-gen
+ source = 0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch
+ source = 0001-Revert-linux-spawni.c-simplify-error-reporting-to-pa.patch
md5sums = SKIP
md5sums = 07ac979b6ab5eeb778d55f041529d623
md5sums = 476e9113489f93b348b21e144b6a8fcf
+ md5sums = cbc073315c00b03898b7fc614274d6b3
+ md5sums = a987eab514bee92cc627453c777896e8
pkgname = glibc-wsl
diff --git a/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch b/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch
new file mode 100644
index 000000000000..5bd40130dee2
--- /dev/null
+++ b/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch
@@ -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
+
diff --git a/0001-Revert-linux-spawni.c-simplify-error-reporting-to-pa.patch b/0001-Revert-linux-spawni.c-simplify-error-reporting-to-pa.patch
new file mode 100644
index 000000000000..6a897db659f5
--- /dev/null
+++ b/0001-Revert-linux-spawni.c-simplify-error-reporting-to-pa.patch
@@ -0,0 +1,188 @@
+From ac8a2ae80345fbd494b3e459014da3099d0af678 Mon Sep 17 00:00:00 2001
+From: Patrick Stewart <patrick@rfcreations.com>
+Date: Tue, 12 Sep 2017 20:35:51 +0100
+Subject: [PATCH] Revert "linux: spawni.c: simplify error reporting to parent"
+
+This reverts commit 4b4d4056bb154603f36c6f8845757c1012758158.
+---
+ sysdeps/unix/sysv/linux/spawni.c | 72 ++++++++++++++++++++++++++--------------
+ 1 file changed, 47 insertions(+), 25 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
+index c56f894a82..29083e0998 100644
+--- a/sysdeps/unix/sysv/linux/spawni.c
++++ b/sysdeps/unix/sysv/linux/spawni.c
+@@ -17,7 +17,6 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #include <spawn.h>
+-#include <assert.h>
+ #include <fcntl.h>
+ #include <paths.h>
+ #include <string.h>
+@@ -45,12 +44,11 @@
+ 3. Child must synchronize with parent to enforce 2. and to possible
+ return execv issues.
+
+- The first issue is solved by blocking all signals in child, even
+- the NPTL-internal ones (SIGCANCEL and SIGSETXID). The second and
+- third issue is done by a stack allocation in parent, and by using a
+- field in struct spawn_args where the child can write an error
+- code. CLONE_VFORK ensures that the parent does not run until the
+- child has either exec'ed successfully or exited. */
++ The first issue is solved by blocking all signals in child, even the
++ NPTL-internal ones (SIGCANCEL and SIGSETXID). The second and third issue
++ is done by a stack allocation in parent and a synchronization with using
++ a pipe or waitpid (in case or error). The pipe has the advantage of
++ allowing the child the communicate an exec error. */
+
+
+ /* The Unix standard contains a long explanation of the way to signal
+@@ -78,6 +76,7 @@
+
+ struct posix_spawn_args
+ {
++ int pipe[2];
+ sigset_t oldmask;
+ const char *file;
+ int (*exec) (const char *, char *const *, char *const *);
+@@ -87,7 +86,6 @@ struct posix_spawn_args
+ ptrdiff_t argc;
+ char *const *envp;
+ int xflags;
+- int err;
+ };
+
+ /* Older version requires that shell script without shebang definition
+@@ -124,6 +122,10 @@ __spawni_child (void *arguments)
+ struct posix_spawn_args *args = arguments;
+ const posix_spawnattr_t *restrict attr = args->attr;
+ const posix_spawn_file_actions_t *file_actions = args->fa;
++ int p = args->pipe[1];
++ int ret;
++
++ close_not_cancel (args->pipe[0]);
+
+ /* The child must ensure that no signal handler are enabled because it shared
+ memory with parent, so the signal disposition must be either SIG_DFL or
+@@ -202,6 +204,17 @@ __spawni_child (void *arguments)
+ {
+ struct __spawn_action *action = &file_actions->__actions[cnt];
+
++ /* Dup the pipe fd onto an unoccupied one to avoid any file
++ operation to clobber it. */
++ if ((action->action.close_action.fd == p)
++ || (action->action.open_action.fd == p)
++ || (action->action.dup2_action.fd == p))
++ {
++ if ((ret = __dup (p)) < 0)
++ goto fail;
++ p = ret;
++ }
++
+ switch (action->tag)
+ {
+ case spawn_do_close:
+@@ -268,7 +281,6 @@ __spawni_child (void *arguments)
+ __sigprocmask (SIG_SETMASK, (attr->__flags & POSIX_SPAWN_SETSIGMASK)
+ ? &attr->__ss : &args->oldmask, 0);
+
+- args->err = 0;
+ args->exec (args->file, args->argv, args->envp);
+
+ /* This is compatibility function required to enable posix_spawn run
+@@ -276,13 +288,14 @@ __spawni_child (void *arguments)
+ (2.15). */
+ maybe_script_execute (args);
+
++ ret = -errno;
++
+ fail:
+- /* errno should have an appropriate non-zero value; otherwise,
+- there's a bug in glibc or the kernel. For lack of an error code
+- (EINTERNALBUG) describing that, use ECHILD. Another option would
+- be to set args->err to some negative sentinel and have the parent
+- abort(), but that seems needlessly harsh. */
+- args->err = errno ? : ECHILD;
++ /* Since sizeof errno < PIPE_BUF, the write is atomic. */
++ ret = -ret;
++ if (ret)
++ while (write_not_cancel (p, &ret, sizeof ret) < 0)
++ continue;
+ _exit (SPAWN_ERROR);
+ }
+
+@@ -299,6 +312,9 @@ __spawnix (pid_t * pid, const char *file,
+ struct posix_spawn_args args;
+ int ec;
+
++ if (__pipe2 (args.pipe, O_CLOEXEC))
++ return errno;
++
+ /* To avoid imposing hard limits on posix_spawn{p} the total number of
+ arguments is first calculated to allocate a mmap to hold all possible
+ values. */
+@@ -330,16 +346,17 @@ __spawnix (pid_t * pid, const char *file,
+ void *stack = __mmap (NULL, stack_size, prot,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
+ if (__glibc_unlikely (stack == MAP_FAILED))
+- return errno;
++ {
++ close_not_cancel (args.pipe[0]);
++ close_not_cancel (args.pipe[1]);
++ return errno;
++ }
+
+ /* Disable asynchronous cancellation. */
+ int state;
+ __libc_ptf_call (__pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state), 0);
+
+- /* Child must set args.err to something non-negative - we rely on
+- the parent and child sharing VM. */
+- args.err = -1;
+ args.file = file;
+ args.exec = exec;
+ args.fa = file_actions;
+@@ -353,8 +370,9 @@ __spawnix (pid_t * pid, const char *file,
+
+ /* The clone flags used will create a new child that will run in the same
+ memory space (CLONE_VM) and the execution of calling thread will be
+- suspend until the child calls execve or _exit.
+-
++ suspend until the child calls execve or _exit. These condition as
++ signal below either by pipe write (_exit with SPAWN_ERROR) or
++ a successful execve.
+ Also since the calling thread execution will be suspend, there is not
+ need for CLONE_SETTLS. Although parent and child share the same TLS
+ namespace, there will be no concurrent access for TLS variables (errno
+@@ -362,18 +380,22 @@ __spawnix (pid_t * pid, const char *file,
+ new_pid = CLONE (__spawni_child, STACK (stack, stack_size), stack_size,
+ CLONE_VM | CLONE_VFORK | SIGCHLD, &args);
+
++ close_not_cancel (args.pipe[1]);
++
+ if (new_pid > 0)
+ {
+- ec = args.err;
+- assert (ec >= 0);
+- if (ec != 0)
+- __waitpid (new_pid, NULL, 0);
++ if (__read (args.pipe[0], &ec, sizeof ec) != sizeof ec)
++ ec = 0;
++ else
++ __waitpid (new_pid, NULL, 0);
+ }
+ else
+ ec = -new_pid;
+
+ __munmap (stack, stack_size);
+
++ close_not_cancel (args.pipe[0]);
++
+ if ((ec == 0) && (pid != NULL))
+ *pid = new_pid;
+
+--
+2.14.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 62e78f524488..351f7ba57e08 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,36 +1,51 @@
# Maintainer: Patrick Stewart <patstew@gmail.com>
+# Contributor: Bartlomiej 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
-_pkgname=glibc
pkgname=glibc-wsl
-pkgver=2.25
-pkgrel=2
-_commit=ccb4fd7a657b0fbc4890c98f4586d58a135fc583
-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')
-provides=("${_pkgname}=${pkgver}-${pkgrel}")
-conflicts=("${_pkgname}")
+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=(git gd)
+optdepends=('gd: for memusagestat')
+provides=(glibc=${pkgver}-${pkgrel})
+conflicts=(glibc)
backup=(etc/gai.conf
etc/locale.gen
etc/nscd.conf)
-options=('!strip' 'staticlibs')
+options=(!strip staticlibs)
install=glibc.install
-source=(git+https://sourceware.org/git/glibc.git#commit=${_commit}
+_commit=58270c0049404ef2f878fdd45df55f17f0b8c1f7
+source=(glibc::git+https://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
+ 0001-Revert-linux-spawni.c-simplify-error-reporting-to-pa.patch)
md5sums=('SKIP'
'07ac979b6ab5eeb778d55f041529d623'
- '476e9113489f93b348b21e144b6a8fcf')
+ '476e9113489f93b348b21e144b6a8fcf'
+ 'cbc073315c00b03898b7fc614274d6b3'
+ 'a987eab514bee92cc627453c777896e8')
+
+# pkgver() {
+# cd glibc
+# git describe --tags | sed 's/^glibc-//;s/-/+/g'
+# }
prepare() {
mkdir -p glibc-build
- git -C ${srcdir}/glibc revert 4b4d4056bb15 && exit 0
- git -C ${srcdir}/glibc reset -- ChangeLog
- git -C ${srcdir}/glibc commit -m "Revert spawn changes for WSL"
+
+ cd glibc
+ patch -p1 -i "$srcdir/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch"
+ patch -p1 -i "$srcdir/0001-Revert-linux-spawni.c-simplify-error-reporting-to-pa.patch"
}
build() {
@@ -38,7 +53,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
echo "slibdir=/usr/lib" >> configparms
@@ -49,21 +64,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://bugs.archlinux.org/ \
--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 \
--enable-multi-arch \
+ --enable-obsolete-nsl \
+ --enable-obsolete-rpc \
+ --enable-stack-protector=strong \
+ --enable-stackguard-randomization \
+ --disable-profile \
--disable-werror
# build libraries with fortify disabled
@@ -89,29 +104,28 @@ check() {
}
package() {
- cd glibc-build
-
- install -dm755 ${pkgdir}/etc
- touch ${pkgdir}/etc/ld.so.conf
-
- make install_root=${pkgdir} install
+ install -dm755 "$pkgdir/etc"
+ touch "$pkgdir/etc/ld.so.conf"
- rm -f ${pkgdir}/etc/ld.so.{cache,conf}
+ make -C glibc-build install_root="$pkgdir" install
+ rm -f "$pkgdir"/etc/ld.so.{cache,conf}
- install -dm755 ${pkgdir}/usr/lib/{locale,systemd/system,tmpfiles.d}
+ cd glibc
- 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 -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 -m644 ${srcdir}/${_pkgname}/posix/gai.conf ${pkgdir}/etc/gai.conf
+ install -m644 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"
# Do not strip the following files for improved debugging support
# ("improved" as in not breaking gdb and valgrind...):
@@ -120,14 +134,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 \
@@ -145,6 +156,7 @@ package() {
fi
if [[ $CARCH = "i686" ]]; then
+ strip $STRIP_BINARIES usr/bin/lddlibc4
strip $STRIP_STATIC usr/lib/libm.a
fi
}