wok diff glibc/stuff/glibc-2.14.1-fixes-1.patch @ rev 12269

Up: glibc (2.14.1)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 12 16:31:36 2012 +0200 (2012-04-12)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/glibc/stuff/glibc-2.14.1-fixes-1.patch	Thu Apr 12 16:31:36 2012 +0200
     1.3 @@ -0,0 +1,159 @@
     1.4 +Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
     1.5 +Date:                    2011-10-07
     1.6 +Initial Package Version: 2.14.1
     1.7 +Upstream Status:         From upstream
     1.8 +Origin:                  Matt Burgess
     1.9 +Description:             Fixes Firefox crashes and a bug when programs link to
    1.10 +                         SDL.
    1.11 +
    1.12 +diff -Naur glibc-2.14.1.orig/elf/dl-close.c glibc-2.14.1/elf/dl-close.c
    1.13 +--- glibc-2.14.1.orig/elf/dl-close.c	2011-10-07 09:48:55.000000000 +0000
    1.14 ++++ glibc-2.14.1/elf/dl-close.c	2011-10-07 19:43:10.346411120 +0000
    1.15 +@@ -119,17 +119,8 @@
    1.16 +   if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
    1.17 +       || dl_close_state != not_pending)
    1.18 +     {
    1.19 +-      if (map->l_direct_opencount == 0)
    1.20 +-	{
    1.21 +-	  if (map->l_type == lt_loaded)
    1.22 +-	    dl_close_state = rerun;
    1.23 +-	  else if (map->l_type == lt_library)
    1.24 +-	    {
    1.25 +-	      struct link_map **oldp = map->l_initfini;
    1.26 +-	      map->l_initfini = map->l_orig_initfini;
    1.27 +-	      _dl_scope_free (oldp);
    1.28 +-	    }
    1.29 +-	}
    1.30 ++      if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
    1.31 ++	dl_close_state = rerun;
    1.32 + 
    1.33 +       /* There are still references to this object.  Do nothing more.  */
    1.34 +       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
    1.35 +diff -Naur glibc-2.14.1.orig/elf/dl-deps.c glibc-2.14.1/elf/dl-deps.c
    1.36 +--- glibc-2.14.1.orig/elf/dl-deps.c	2011-10-07 09:48:55.000000000 +0000
    1.37 ++++ glibc-2.14.1/elf/dl-deps.c	2011-10-07 19:43:10.348432639 +0000
    1.38 +@@ -478,6 +478,7 @@
    1.39 + 		  nneeded * sizeof needed[0]);
    1.40 + 	  atomic_write_barrier ();
    1.41 + 	  l->l_initfini = l_initfini;
    1.42 ++	  l->l_free_initfini = 1;
    1.43 + 	}
    1.44 + 
    1.45 +       /* If we have no auxiliary objects just go on to the next map.  */
    1.46 +@@ -678,6 +679,7 @@
    1.47 +   l_initfini[nlist] = NULL;
    1.48 +   atomic_write_barrier ();
    1.49 +   map->l_initfini = l_initfini;
    1.50 ++  map->l_free_initfini = 1;
    1.51 +   if (l_reldeps != NULL)
    1.52 +     {
    1.53 +       atomic_write_barrier ();
    1.54 +@@ -686,7 +688,7 @@
    1.55 +       _dl_scope_free (old_l_reldeps);
    1.56 +     }
    1.57 +   if (old_l_initfini != NULL)
    1.58 +-      map->l_orig_initfini = old_l_initfini;
    1.59 ++    _dl_scope_free (old_l_initfini);
    1.60 + 
    1.61 +   if (errno_reason)
    1.62 +     _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
    1.63 +diff -Naur glibc-2.14.1.orig/elf/dl-libc.c glibc-2.14.1/elf/dl-libc.c
    1.64 +--- glibc-2.14.1.orig/elf/dl-libc.c	2011-10-07 09:48:55.000000000 +0000
    1.65 ++++ glibc-2.14.1/elf/dl-libc.c	2011-10-07 19:43:10.352411141 +0000
    1.66 +@@ -279,6 +279,10 @@
    1.67 + 	      if (! old->dont_free)
    1.68 + 		free (old);
    1.69 + 	    }
    1.70 ++
    1.71 ++	  /* Free the initfini dependency list.  */
    1.72 ++	  if (l->l_free_initfini)
    1.73 ++	    free (l->l_initfini);
    1.74 + 	}
    1.75 + 
    1.76 +       if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
    1.77 +diff -Naur glibc-2.14.1.orig/elf/rtld.c glibc-2.14.1/elf/rtld.c
    1.78 +--- glibc-2.14.1.orig/elf/rtld.c	2011-10-07 09:48:55.000000000 +0000
    1.79 ++++ glibc-2.14.1/elf/rtld.c	2011-10-07 19:43:10.355406263 +0000
    1.80 +@@ -2263,6 +2263,7 @@
    1.81 + 	      lnp->dont_free = 1;
    1.82 + 	      lnp = lnp->next;
    1.83 + 	    }
    1.84 ++	  l->l_free_initfini = 0;
    1.85 + 
    1.86 + 	  if (l != &GL(dl_rtld_map))
    1.87 + 	    _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
    1.88 +diff -Naur glibc-2.14.1.orig/include/link.h glibc-2.14.1/include/link.h
    1.89 +--- glibc-2.14.1.orig/include/link.h	2011-10-07 09:48:55.000000000 +0000
    1.90 ++++ glibc-2.14.1/include/link.h	2011-10-07 19:43:10.357462703 +0000
    1.91 +@@ -192,6 +192,9 @@
    1.92 + 						 during LD_TRACE_PRELINKING=1
    1.93 + 						 contains any DT_SYMBOLIC
    1.94 + 						 libraries.  */
    1.95 ++    unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
    1.96 ++				       freed, ie. not allocated with
    1.97 ++				       the dummy malloc in ld.so.  */
    1.98 + 
    1.99 +     /* Collected information about own RPATH directories.  */
   1.100 +     struct r_search_path_struct l_rpath_dirs;
   1.101 +@@ -240,9 +243,6 @@
   1.102 + 
   1.103 +     /* List of object in order of the init and fini calls.  */
   1.104 +     struct link_map **l_initfini;
   1.105 +-    /* The init and fini list generated at startup, saved when the
   1.106 +-       object is also loaded dynamically.  */
   1.107 +-    struct link_map **l_orig_initfini;
   1.108 + 
   1.109 +     /* List of the dependencies introduced through symbol binding.  */
   1.110 +     struct link_map_reldeps
   1.111 +diff -Naur glibc-2.14.1.orig/resolv/res_query.c glibc-2.14.1/resolv/res_query.c
   1.112 +--- glibc-2.14.1.orig/resolv/res_query.c	2011-10-07 09:48:55.000000000 +0000
   1.113 ++++ glibc-2.14.1/resolv/res_query.c	2011-10-07 19:43:10.361412711 +0000
   1.114 +@@ -122,6 +122,7 @@
   1.115 + 		  int *resplen2)
   1.116 + {
   1.117 + 	HEADER *hp = (HEADER *) answer;
   1.118 ++	HEADER *hp2;
   1.119 + 	int n, use_malloc = 0;
   1.120 + 	u_int oflags = statp->_flags;
   1.121 + 
   1.122 +@@ -239,26 +240,25 @@
   1.123 + 	  /* __libc_res_nsend might have reallocated the buffer.  */
   1.124 + 	  hp = (HEADER *) *answerp;
   1.125 + 
   1.126 +-	/* We simplify the following tests by assigning HP to HP2.  It
   1.127 +-	   is easy to verify that this is the same as ignoring all
   1.128 +-	   tests of HP2.  */
   1.129 +-	HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
   1.130 +-
   1.131 +-	if (n < (int) sizeof (HEADER) && answerp2 != NULL
   1.132 +-	    && *resplen2 > (int) sizeof (HEADER))
   1.133 ++	/* We simplify the following tests by assigning HP to HP2 or
   1.134 ++	   vice versa.  It is easy to verify that this is the same as
   1.135 ++	   ignoring all tests of HP or HP2.  */
   1.136 ++	if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
   1.137 + 	  {
   1.138 +-	    /* Special case of partial answer.  */
   1.139 +-	    assert (hp != hp2);
   1.140 +-	    hp = hp2;
   1.141 ++	    hp2 = hp;
   1.142 + 	  }
   1.143 +-	else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
   1.144 +-		 && n > (int) sizeof (HEADER))
   1.145 ++	else
   1.146 + 	  {
   1.147 +-	    /* Special case of partial answer.  */
   1.148 +-	    assert (hp != hp2);
   1.149 +-	    hp2 = hp;
   1.150 ++	    hp2 = (HEADER *) *answerp2;
   1.151 ++	    if (n < (int) sizeof (HEADER))
   1.152 ++	      {
   1.153 ++	        hp = hp2;
   1.154 ++	      }
   1.155 + 	  }
   1.156 + 
   1.157 ++	/* Make sure both hp and hp2 are defined */
   1.158 ++	assert((hp != NULL) && (hp2 != NULL));
   1.159 ++
   1.160 + 	if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
   1.161 + 	    && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
   1.162 + #ifdef DEBUG