Author: aurel32
Date: 2013-11-30 22:20:35 +0000 (Sat, 30 Nov 2013)
New Revision: 5841

Added:
   
glibc-package/branches/eglibc-2.18/debian/patches/any/cvs-DL_CALL_DT_INIT_FINI.diff
   
glibc-package/branches/eglibc-2.18/debian/patches/hppa/cvs-hppa-DL_CALL_DT_INIT_FINI.diff
   
glibc-package/branches/eglibc-2.18/debian/patches/ia64/cvs-ia64-DL_CALL_DT_INIT_FINI.diff
Modified:
   glibc-package/branches/eglibc-2.18/debian/changelog
   glibc-package/branches/eglibc-2.18/debian/patches/series
Log:
patches/any/cvs-DL_CALL_DT_INIT_FINI.diff, 
patches/hppa/cvs-hppa-DL_CALL_DT_INIT_FINI.diff,
patches/ia64/cvs-ia64-DL_CALL_DT_INIT_FINI.diff: new patches from upstream
to fix a segmentation fault in ld.so on hppa and ia64.



Modified: glibc-package/branches/eglibc-2.18/debian/changelog
===================================================================
--- glibc-package/branches/eglibc-2.18/debian/changelog 2013-11-30 22:02:28 UTC 
(rev 5840)
+++ glibc-package/branches/eglibc-2.18/debian/changelog 2013-11-30 22:20:35 UTC 
(rev 5841)
@@ -159,6 +159,10 @@
   * testsuite-checking/expected-results-arm-linux-gnueabihf-libc: cleanup.
   * testsuite-checking/expected-results-arm-linux-gnueabi-libc: cleanup.
   * testsuite-checking/expected-results-*86-linux-gnu*: cleanup.
+  * patches/any/cvs-DL_CALL_DT_INIT_FINI.diff, 
+    patches/hppa/cvs-hppa-DL_CALL_DT_INIT_FINI.diff,
+    patches/ia64/cvs-ia64-DL_CALL_DT_INIT_FINI.diff: new patches from upstream
+    to fix a segmentation fault in ld.so on hppa and ia64.
 
  -- Adam Conrad <[email protected]>  Sat, 09 Nov 2013 12:48:20 +0100
 

Added: 
glibc-package/branches/eglibc-2.18/debian/patches/any/cvs-DL_CALL_DT_INIT_FINI.diff
===================================================================
--- 
glibc-package/branches/eglibc-2.18/debian/patches/any/cvs-DL_CALL_DT_INIT_FINI.diff
                         (rev 0)
+++ 
glibc-package/branches/eglibc-2.18/debian/patches/any/cvs-DL_CALL_DT_INIT_FINI.diff
 2013-11-30 22:20:35 UTC (rev 5841)
@@ -0,0 +1,73 @@
+2013-11-21  Guy Martin  <[email protected]>
+
+       * sysdeps/generic/ldsodefs.h: Replace DL_DT_INIT_ADDRESS() and
+       DL_DT_FINI_ADDRESS() macro with DL_CALL_DT_INIT() and
+       DL_CALL_DT_FINI() that call the functions directly.
+       * elf/dl-init.c: Use the new DL_CALL_DT_INIT() macro.
+       * elf/dl-close.c: Use the new DL_CALL_DT_FINI() macro.
+       * elf/dl-fini.c: Likewise.
+
+diff --git a/elf/dl-close.c b/elf/dl-close.c
+index fe3014c..407926b 100644
+--- a/elf/dl-close.c
++++ b/elf/dl-close.c
+@@ -274,9 +274,8 @@ _dl_close_worker (struct link_map *map)
+ 
+             /* Next try the old-style destructor.  */
+             if (imap->l_info[DT_FINI] != NULL)
+-              (*(void (*) (void)) DL_DT_FINI_ADDRESS
+-               (imap, ((void *) imap->l_addr
+-                       + imap->l_info[DT_FINI]->d_un.d_ptr))) ();
++              DL_CALL_DT_FINI (imap, ((void *) imap->l_addr
++                       + imap->l_info[DT_FINI]->d_un.d_ptr));
+           }
+ 
+ #ifdef SHARED
+diff --git a/elf/dl-fini.c b/elf/dl-fini.c
+index 6b245f0..db5269c 100644
+--- a/elf/dl-fini.c
++++ b/elf/dl-fini.c
+@@ -254,7 +254,7 @@ _dl_fini (void)
+ 
+                 /* Next try the old-style destructor.  */
+                 if (l->l_info[DT_FINI] != NULL)
+-                  ((fini_t) DL_DT_FINI_ADDRESS (l, l->l_addr + 
l->l_info[DT_FINI]->d_un.d_ptr)) ();
++                   DL_CALL_DT_FINI(l, l->l_addr + 
l->l_info[DT_FINI]->d_un.d_ptr);
+               }
+ 
+ #ifdef SHARED
+diff --git a/elf/dl-init.c b/elf/dl-init.c
+index a657eb6..4078368 100644
+--- a/elf/dl-init.c
++++ b/elf/dl-init.c
+@@ -61,13 +61,7 @@ call_init (struct link_map *l, int argc, char **argv, char 
**env)
+      - the others in the DT_INIT_ARRAY.
+   */
+   if (l->l_info[DT_INIT] != NULL)
+-    {
+-      init_t init = (init_t) DL_DT_INIT_ADDRESS
+-      (l, l->l_addr + l->l_info[DT_INIT]->d_un.d_ptr);
+-
+-      /* Call the function.  */
+-      init (argc, argv, env);
+-    }
++    DL_CALL_DT_INIT(l, l->l_addr + l->l_info[DT_INIT]->d_un.d_ptr, argc, 
argv, env);
+ 
+   /* Next see whether there is an array with initialization functions.  */
+   ElfW(Dyn) *init_array = l->l_info[DT_INIT_ARRAY];
+diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
+index e7b0516..146aca4 100644
+--- a/sysdeps/generic/ldsodefs.h
++++ b/sysdeps/generic/ldsodefs.h
+@@ -76,8 +76,9 @@ typedef struct link_map *lookup_t;
+ # define DL_SYMBOL_ADDRESS(map, ref) \
+  (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value)
+ # define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))
+-# define DL_DT_INIT_ADDRESS(map, start) (start)
+-# define DL_DT_FINI_ADDRESS(map, start) (start)
++# define DL_CALL_DT_INIT(map, start, argc, argv, env) \
++ ((init_t) (start)) (argc, argv, env)
++# define DL_CALL_DT_FINI(map, start) ((fini_t) (start)) ()
+ #endif
+ 
+ /* On some architectures dladdr can't use st_size of all symbols this way.  */

Added: 
glibc-package/branches/eglibc-2.18/debian/patches/hppa/cvs-hppa-DL_CALL_DT_INIT_FINI.diff
===================================================================
--- 
glibc-package/branches/eglibc-2.18/debian/patches/hppa/cvs-hppa-DL_CALL_DT_INIT_FINI.diff
                           (rev 0)
+++ 
glibc-package/branches/eglibc-2.18/debian/patches/hppa/cvs-hppa-DL_CALL_DT_INIT_FINI.diff
   2013-11-30 22:20:35 UTC (rev 5841)
@@ -0,0 +1,100 @@
+2013-11-21  Guy Martin  <[email protected]>
+
+       * sysdeps/hppa/dl-lookupcfg.h: Remove obsolete
+       DL_DT_INIT_ADDRESS() and DL_DT_FINI_ADDRESS() macro and implement
+       DL_CALL_DT_INIT() as well as DL_CALL_DT_FINI().
+       Define DL_DT_FUNCTION_ADDRESS().
+       * sysdeps/hppa/dl-machine.h: Update ELF_MACHINE_START_ADDRESS()
+       to use DL_DT_FUNCTION_ADDRESS().
+
+2013-08-21   Ondřej Bílka  <[email protected]>
+
+       * sysdeps/hppa/dl-lookupcfg.h: Fix typos.
+
+diff --git a/ports/sysdeps/hppa/dl-lookupcfg.h 
b/ports/sysdeps/hppa/dl-lookupcfg.h
+index f3125e5..feea320 100644
+--- a/ports/sysdeps/hppa/dl-lookupcfg.h
++++ b/ports/sysdeps/hppa/dl-lookupcfg.h
+@@ -38,32 +38,36 @@ void _dl_unmap (struct link_map *map);
+ 
+ #define DL_UNMAP(map) _dl_unmap (map)
+ 
+-#define DL_AUTO_FUNCTION_ADDRESS(map, addr)                           \
+-({                                                                    \
+-  unsigned int fptr[2];                                                       
\
+-  fptr[0] = (unsigned int) (addr);                                    \
+-  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;                     \
+-  /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */    \
+-  (ElfW(Addr))((unsigned int)fptr | 2);                                       
\
+-})
+-
+-#define DL_STATIC_FUNCTION_ADDRESS(map, addr)                         \
+-({                                                                    \
+-  static unsigned int fptr[2];                                                
\
+-  fptr[0] = (unsigned int) (addr);                                    \
+-  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;                     \
+-  /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */    \
+-  (ElfW(Addr))((unsigned int)fptr | 2);                                       
\
+-})
+-
+-
+-/* The test for "addr & 2" below is to accomodate old binaries which
+-   violated the ELF ABI by pointing DT_INIT and DT_FINI at a function
+-   descriptor.  */
+-#define DL_DT_INIT_ADDRESS(map, addr) \
+-  ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
+-#define DL_DT_FINI_ADDRESS(map, addr) \
+-  ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
++#define DL_DT_FUNCTION_ADDRESS(map, start, attr, addr)                        
\
++  attr volatile unsigned int fptr[2];                                 \
++ /* The test for "start & 2" below is to accommodate old binaries which       
\
++    violated the ELF ABI by pointing DT_INIT and DT_FINI at a function        
\
++    descriptor.  */                                                   \
++  if ((ElfW(Addr)) (start) & 2)                                               
\
++    addr = (ElfW(Addr)) start;                                                
\
++  else                                                                        
\
++    {                                                                 \
++      fptr[0] = (unsigned int) (start);                                       
\
++      fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;                 \
++      /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */        
\
++      addr = (ElfW(Addr))((unsigned int)fptr | 2);                    \
++    }                                                                 \
++
++#define DL_CALL_DT_INIT(map, start, argc, argv, env)  \
++{                                                     \
++  ElfW(Addr) addr;                                    \
++  DL_DT_FUNCTION_ADDRESS(map, start, , addr)          \
++  init_t init = (init_t) addr;                                \
++  init (argc, argv, env);                             \
++}
++
++#define DL_CALL_DT_FINI(map, start)           \
++{                                             \
++  ElfW(Addr) addr;                            \
++  DL_DT_FUNCTION_ADDRESS(map, start, , addr)  \
++  fini_t fini = (fini_t) addr;                        \
++  fini ();                                    \
++}
+ 
+ /* The type of the return value of fixup/profile_fixup */
+ #define DL_FIXUP_VALUE_TYPE struct fdesc
+diff --git a/ports/sysdeps/hppa/dl-machine.h b/ports/sysdeps/hppa/dl-machine.h
+index d2411a6..e47e947 100644
+--- a/ports/sysdeps/hppa/dl-machine.h
++++ b/ports/sysdeps/hppa/dl-machine.h
+@@ -490,8 +490,12 @@ asm (                                                     
                \
+ #define ELF_MACHINE_NO_REL 1
+ 
+ /* Return the address of the entry point. */
+-#define ELF_MACHINE_START_ADDRESS(map, start) \
+-  DL_STATIC_FUNCTION_ADDRESS (map, start)
++#define ELF_MACHINE_START_ADDRESS(map, start)                 \
++({                                                            \
++      ElfW(Addr) addr;                                        \
++      DL_DT_FUNCTION_ADDRESS(map, start, static, addr)        \
++      addr;                                                   \
++})
+ 
+ /* We define an initialization functions.  This is called very early in
+  *    _dl_sysdep_start.  */
+

Added: 
glibc-package/branches/eglibc-2.18/debian/patches/ia64/cvs-ia64-DL_CALL_DT_INIT_FINI.diff
===================================================================
--- 
glibc-package/branches/eglibc-2.18/debian/patches/ia64/cvs-ia64-DL_CALL_DT_INIT_FINI.diff
                           (rev 0)
+++ 
glibc-package/branches/eglibc-2.18/debian/patches/ia64/cvs-ia64-DL_CALL_DT_INIT_FINI.diff
   2013-11-30 22:20:35 UTC (rev 5841)
@@ -0,0 +1,80 @@
+2013-11-21  Guy Martin  <[email protected]>
+
+       * sysdeps/ia64/dl-lookupcfg.h: Remove obsolete
+       DL_DT_INIT_ADDRESS() and DL_DT_FINI_ADDRESS() macro and implement
+       DL_CALL_DT_INIT() as well as DL_CALL_DT_FINI().
+       Define DL_DT_FUNCTION_ADDRESS().
+       * sysdeps/ia64/dl-machine.h: Update ELF_MACHINE_START_ADDRESS()
+       to use DL_DT_FUNCTION_ADDRESS().
+
+diff --git a/ports/sysdeps/ia64/dl-lookupcfg.h 
b/ports/sysdeps/ia64/dl-lookupcfg.h
+index 4da1263..cfaa252 100644
+--- a/ports/sysdeps/ia64/dl-lookupcfg.h
++++ b/ports/sysdeps/ia64/dl-lookupcfg.h
+@@ -39,24 +39,28 @@ extern void _dl_unmap (struct link_map *map);
+ 
+ #define DL_UNMAP(map) _dl_unmap (map)
+ 
+-#define DL_AUTO_FUNCTION_ADDRESS(map, addr)           \
+-({                                                    \
+-  unsigned long int fptr[2];                          \
+-  fptr[0] = (unsigned long int) (addr);                       \
+-  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;     \
+-  (Elf64_Addr) fptr;                                  \
+-})
+-
+-#define DL_STATIC_FUNCTION_ADDRESS(map, addr)         \
+-({                                                    \
+-  static unsigned long int fptr[2];                   \
+-  fptr[0] = (unsigned long int) (addr);                       \
+-  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;     \
+-  (Elf64_Addr) fptr;                                  \
+-})
+-
+-#define DL_DT_INIT_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
+-#define DL_DT_FINI_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
++#define DL_DT_FUNCTION_ADDRESS(map, start, attr, addr)                        
\
++  attr volatile unsigned long int fptr[2];                                    
\
++  fptr[0] = (unsigned long int) (start);                                      
\
++  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;                     \
++  addr = (ElfW(Addr)) fptr;                                           \
++
++#define DL_CALL_DT_INIT(map, start, argc, argv, env)  \
++{                                                     \
++  ElfW(Addr) addr;                                    \
++  DL_DT_FUNCTION_ADDRESS(map, start, , addr)          \
++  init_t init = (init_t) addr;                                \
++  init (argc, argv, env);                             \
++}
++
++#define DL_CALL_DT_FINI(map, start)           \
++{                                             \
++  ElfW(Addr) addr;                            \
++  DL_DT_FUNCTION_ADDRESS(map, start, , addr)  \
++  fini_t fini = (fini_t) addr;                        \
++  fini ();                                    \
++}
++
+ /* The type of the return value of fixup/profile_fixup.  */
+ #define DL_FIXUP_VALUE_TYPE struct fdesc
+ /* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address
+diff --git a/ports/sysdeps/ia64/dl-machine.h b/ports/sysdeps/ia64/dl-machine.h
+index dd469d7..6123637 100644
+--- a/ports/sysdeps/ia64/dl-machine.h
++++ b/ports/sysdeps/ia64/dl-machine.h
+@@ -322,8 +322,12 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, 
int profile)
+ #define ELF_MACHINE_NO_REL 1
+ 
+ /* Return the address of the entry point. */
+-#define ELF_MACHINE_START_ADDRESS(map, start) \
+-  DL_STATIC_FUNCTION_ADDRESS (map, start)
++#define ELF_MACHINE_START_ADDRESS(map, start)                 \
++({                                                            \
++      ElfW(Addr) addr;                                        \
++      DL_DT_FUNCTION_ADDRESS(map, start, static, addr)        \
++      addr;                                                   \
++})
+ 
+ /* Fixup a PLT entry to bounce directly to the function at VALUE.  */
+ static inline struct fdesc __attribute__ ((always_inline))
+

Modified: glibc-package/branches/eglibc-2.18/debian/patches/series
===================================================================
--- glibc-package/branches/eglibc-2.18/debian/patches/series    2013-11-30 
22:02:28 UTC (rev 5840)
+++ glibc-package/branches/eglibc-2.18/debian/patches/series    2013-11-30 
22:20:35 UTC (rev 5841)
@@ -69,6 +69,7 @@
 hppa/local-longjmp-chk.diff
 hppa/local-lowlevellock.diff
 hppa/local-EAGAIN.diff
+hppa/cvs-hppa-DL_CALL_DT_INIT_FINI.diff
 
 hurd-i386/local-enable-ldconfig.diff
 hurd-i386/tg-context_functions.diff
@@ -153,6 +154,7 @@
 ia64/submitted-libm.diff
 ia64/submitted-fpu-ulps.diff
 ia64/submitted-remainder.diff
+ia64/cvs-ia64-DL_CALL_DT_INIT_FINI.diff
 
 kfreebsd/submitted-waitid.diff
 kfreebsd/submitted-auxv.diff
@@ -252,3 +254,4 @@
 any/unsubmitted-scanf-includes.diff
 any/cvs-strcasecmp-locales.diff
 any/cvs-CVE-2013-4458-getaddrinfo.diff
+any/cvs-DL_CALL_DT_INIT_FINI.diff


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to