This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2 2/2] [BZ #18479] nptl: restore .interp section in libpthread.so


From: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>

In commit 02657da2cf4457804ed938ee08b8316249126444, .interp section
was removed from libpthread.so.  This led to an error:

  $ /lib64/libpthread.so.0
  Native POSIX Threads Library by Ulrich Drepper et al
  Copyright (C) 2015 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.
  Forced unwind support included.
  Segmentation fault

  (gdb) bt
  #0  0x00000000000055a6 in _exit@plt ()

Unfortunately, there is no way to add a regression test for the bug
because .interp specifies the path to dynamic linker of the target
system.

[BZ #18479]
* nptl/pt-interp.c: New file.
* nptl/Makefile (libpthread-routines, libpthread-shared-only-routines):
Add pt-interp.
[$(build-shared) = yes] ($(objpfx)pt-interp.os): Depend on
$(common-objpfx)runtime-linker.h.
---
 ChangeLog        | 9 +++++++++
 NEWS             | 2 +-
 nptl/Makefile    | 7 +++++--
 nptl/pt-interp.c | 1 +
 4 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 nptl/pt-interp.c

diff --git a/nptl/Makefile b/nptl/Makefile
index d58324d..530d14b 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -33,7 +33,7 @@ routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
 	   register-atfork unregister-atfork
 shared-only-routines = forward
 
-libpthread-routines = nptl-init vars events version \
+libpthread-routines = nptl-init vars events version pt-interp \
 		      pthread_create pthread_exit pthread_detach \
 		      pthread_join pthread_tryjoin pthread_timedjoin \
 		      pthread_self pthread_equal pthread_yield \
@@ -138,7 +138,8 @@ libpthread-routines = nptl-init vars events version \
 #		      pthread_setgid pthread_setegid pthread_setregid \
 #		      pthread_setresgid
 
-libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
+libpthread-shared-only-routines = version pt-interp pt-allocrtsig \
+				  unwind-forcedunwind
 libpthread-static-only-routines = pthread_atfork
 
 # Since cancellation handling is in large parts handled using exceptions
@@ -608,6 +609,8 @@ $(objpfx)banner.h: Banner
 generated += banner.h
 # Give libpthread.so an entry point and make it directly runnable itself.
 LDFLAGS-pthread.so += -e __nptl_main
+# pt-interp.c exists just to get the runtime linker path into libpthread.so.
+$(objpfx)pt-interp.os: $(common-objpfx)runtime-linker.h
 endif
 
 ifeq ($(run-built-tests),yes)
diff --git a/nptl/pt-interp.c b/nptl/pt-interp.c
new file mode 100644
index 0000000..ecf1fe7
--- /dev/null
+++ b/nptl/pt-interp.c
@@ -0,0 +1 @@
+#include <elf/interp.c>

-- 
ldv


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]