[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[glibc] 01/02: hurd: fix unregistering atfork handlers at library unload.



This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch sid
in repository glibc.

commit 3702fb1de6c7642b21d4af21e131c2143aa7af9d
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Tue Oct 18 00:18:27 2016 +0000

    hurd: fix unregistering atfork handlers at library unload.
    
    hurd-i386/cvs-pthread-atfork.diff: New patch.
    Closes: #841068.
---
 debian/changelog                                 |   2 +
 debian/patches/hurd-i386/cvs-pthread-atfork.diff | 133 +++++++++++++++++++++++
 debian/patches/series                            |   1 +
 3 files changed, 136 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index a6a5d33..24d89bb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ glibc (2.24-5) UNRELEASED; urgency=medium
   [ Samuel Thibault ]
   * hurd-i386/cvs-libpthread-static-weak.diff: New patch to fix weak
     references when linking in libpthread statically.
+  * hurd-i386/cvs-pthread-atfork.diff: New patch to fix unregistering atfork
+    handlers at library unload. Closes: #841068.
 
  -- Aurelien Jarno <aurel32@debian.org>  Sun, 16 Oct 2016 13:08:40 +0200
 
diff --git a/debian/patches/hurd-i386/cvs-pthread-atfork.diff b/debian/patches/hurd-i386/cvs-pthread-atfork.diff
new file mode 100644
index 0000000..57887e1
--- /dev/null
+++ b/debian/patches/hurd-i386/cvs-pthread-atfork.diff
@@ -0,0 +1,133 @@
+commit 05babf965ec39be7e1c8a7306ec1c60b1e614654
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date:   Tue Oct 18 02:10:41 2016 +0200
+
+    Fix unregistering atfork handlers on library unload
+    
+    * sysdeps/generic/old_pt-atfork.c: New file.
+    * Makefile (libpthread-routines): Add old_pt-atfork.
+    (libpthread-static-only-routines): Add pt-atfork.
+    [build-shared=yes] (install): Explicit $(inst_libdir)/libpthread.so
+    [build-shared=yes] $(inst_libdir)/libpthread.so: Replace with script to
+    link libpthread_nonshared.a in.
+    [build-shared=yes] (tests): Link libpthread_nonshared.a in addition to
+    libpthread.so.
+    (generated): Add libpthread_nonshared.a.
+
+Index: glibc-2.24/libpthread/Makefile
+===================================================================
+--- glibc-2.24.orig/libpthread/Makefile
++++ glibc-2.24/libpthread/Makefile
+@@ -139,6 +139,7 @@ libpthread-routines := pt-attr pt-attr-d
+ 	pt-sigstate							    \
+ 									    \
+ 	pt-atfork							    \
++	old_pt-atfork							    \
+ 	pt-kill								    \
+ 	pt-getcpuclockid						    \
+ 									    \
+@@ -154,6 +155,8 @@ libpthread-routines := pt-attr pt-attr-d
+ 	cthreads-compat							    \
+ 	$(SYSDEPS)
+ 
++libpthread-static-only-routines = pt-atfork
++
+ ifeq ($(IN_GLIBC),no)
+ SRCS := $(addsuffix .c,$(libpthread-routines))
+ OBJS = $(addsuffix .o,$(basename $(notdir $(SRCS))))
+@@ -281,6 +284,39 @@ extra-B-pthread.so = -B$(common-objpfx)l
+ 
+ include ../Rules
+ 
++ifeq (yes,$(build-shared))
++# What we install as libpthread.so for programs to link against is in fact a
++# link script.  It contains references for the various libraries we need.
++# The libpthread.so object is not complete since some functions are only
++# defined in libpthread_nonshared.a.
++# We need to use absolute paths since otherwise local copies (if they exist)
++# of the files are taken by the linker.
++install: $(inst_libdir)/libpthread.so
++
++$(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \
++			      $(objpfx)libpthread.so$(libpthread.so-version) \
++			      $(inst_libdir)/$(patsubst %,$(libtype.oS),\
++							$(libprefix)pthread) \
++			      $(+force)
++	(echo '/* GNU ld script';\
++	 echo '   Use the shared library, but some functions are only in';\
++	 echo '   the static library, so try that secondarily.  */';\
++	 cat $<; \
++	 echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \
++	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\
++	      ')' \
++	) > $@.new
++	mv -f $@.new $@
++
++$(addprefix $(objpfx), \
++  $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
++    $(tests-nolibpthread), \
++    $(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \
++				       $(objpfx)libpthread_nonshared.a
++endif
++
++generated += libpthread_nonshared.a
++
+ # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
+ # This ensures they will load libc.so for needed symbols if loaded by
+ # a statically-linked program that hasn't already loaded it.
+Index: glibc-2.24/libpthread/sysdeps/generic/old_pt-atfork.c
+===================================================================
+--- /dev/null
++++ glibc-2.24/libpthread/sysdeps/generic/old_pt-atfork.c
+@@ -0,0 +1,27 @@
++/* Register fork handlers.  Generic version.
++   Copyright (C) 2002 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Library General Public License as
++   published by the Free Software Foundation; either version 2 of the
++   License, or (at your option) any later version.
++
++   The GNU C 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
++   Library General Public License for more details.
++
++   You should have received a copy of the GNU Library General Public
++   License along with the GNU C Library; see the file COPYING.LIB.  If not,
++   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++   Boston, MA 02111-1307, USA.  */
++
++#include <shlib-compat.h>
++
++#if SHLIB_COMPAT(libpthread, GLIBC_2_12, GLIBC_2_23)
++# define pthread_atfork __dyn_pthread_atfork
++# include "pt-atfork.c"
++# undef pthread_atfork
++compat_symbol (libpthread, __dyn_pthread_atfork, pthread_atfork, GLIBC_2_12);
++#endif
+Index: glibc-2.24/libpthread/sysdeps/generic/pt-atfork.c
+===================================================================
+--- glibc-2.24.orig/libpthread/sysdeps/generic/pt-atfork.c
++++ glibc-2.24/libpthread/sysdeps/generic/pt-atfork.c
+@@ -19,6 +19,7 @@
+ 
+ #include <pthread.h>
+ #include <pt-internal.h>
++#include <fork.h>
+ 
+ /* This is defined by newer gcc version unique for each module.  */
+ extern void *__dso_handle __attribute__ ((__weak__,
+--- glibc-2.24.orig/libpthread/Makeconfig.original	2016-10-17 21:53:34.000000000 +0000
++++ glibc-2.24/libpthread/Makeconfig	2016-10-17 21:54:00.000000000 +0000
+@@ -3,7 +3,8 @@
+ 
+ have-thread-library = yes
+ 
+-shared-thread-library = $(common-objpfx)libpthread/libpthread.so
++shared-thread-library = $(common-objpfx)libpthread/libpthread_nonshared.a \
++			$(common-objpfx)libpthread/libpthread.so
+ static-thread-library = $(common-objpfx)libpthread/libpthread.a
+ bounded-thread-library = $(static-thread-library)
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 7486fb8..ba5be6b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -134,6 +134,7 @@ hurd-i386/tg-pthread_deps.diff
 hurd-i386/cvs-mallocfork.diff
 hurd-i386/cvs-setcancelstate.diff
 hurd-i386/cvs-libpthread-static-weak.diff
+hurd-i386/cvs-pthread-atfork.diff
 
 i386/local-biarch.diff
 i386/local-cmov.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-glibc/glibc.git


Reply to: