View | Details | Raw Unified | Return to bug 13579
Collapse All | Expand All

(-)a/ChangeLog (-7 / +7 lines)
Lines 41-57 Link Here
41
	dependencies when there are none.
41
	dependencies when there are none.
42
42
43
2011-02-23  Andreas Schwab  <schwab@redhat.com>
43
2011-02-23  Andreas Schwab  <schwab@redhat.com>
44
	    Ulrich Drepper  <drepper@gmail.com>
45
44
46
	[BZ #12509]
45
	[BZ #12509]
47
	* include/link.h (struct link_map): Add l_orig_initfini.
48
	* elf/dl-load.c (_dl_map_object_from_fd): Free realname before
46
	* elf/dl-load.c (_dl_map_object_from_fd): Free realname before
49
	returning unsuccessfully.
47
	returning unsuccessfully.
50
	* elf/dl-close.c (_dl_close_worker): If this is the last explicit
51
	close of a file loaded at startup, restore the original l_initfini
52
	list.
53
	* elf/dl-deps.c (_dl_map_object_deps): Don't free old l_initfini
54
	list, store the pointer.
55
	* elf/Makefile ($(objpfx)noload-mem): New rule.
48
	* elf/Makefile ($(objpfx)noload-mem): New rule.
56
	(noload-ENV): Define.
49
	(noload-ENV): Define.
57
	(tests): Add $(objpfx)noload-mem.
50
	(tests): Add $(objpfx)noload-mem.
Lines 920-925 Link Here
920
913
921
2010-09-27  Andreas Schwab  <schwab@redhat.com>
914
2010-09-27  Andreas Schwab  <schwab@redhat.com>
922
915
916
	* include/link.h (struct link_map): Add l_free_initfini.
917
	* elf/dl-deps.c (_dl_map_object_deps): Set it when assigning
918
	l_initfini.
919
	* elf/rtld.c (dl_main): Clear it on all objects loaded on startup.
920
	* elf/dl-libc.c (free_mem): Free l_initfini if l_free_initfini is
921
	set.
922
923
	[BZ #11561]
923
	[BZ #11561]
924
	* posix/regcomp.c (parse_bracket_exp): When looking up collating
924
	* posix/regcomp.c (parse_bracket_exp): When looking up collating
925
	elements compare against the byte sequence of it, not its name.
925
	elements compare against the byte sequence of it, not its name.
(-)a/elf/dl-close.c (-12 / +3 lines)
Lines 1-5 Link Here
1
/* Close a shared object opened by `_dl_open'.
1
/* Close a shared object opened by `_dl_open'.
2
   Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
2
   Copyright (C) 1996-2007, 2009, 2010 Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
3
   This file is part of the GNU C Library.
4
4
5
   The GNU C Library is free software; you can redistribute it and/or
5
   The GNU C Library is free software; you can redistribute it and/or
Lines 119-135 _dl_close_worker (struct link_map *map) Link Here
119
  if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
119
  if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
120
      || dl_close_state != not_pending)
120
      || dl_close_state != not_pending)
121
    {
121
    {
122
      if (map->l_direct_opencount == 0)
122
      if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
123
	{
123
	dl_close_state = rerun;
124
	  if (map->l_type == lt_loaded)
125
	    dl_close_state = rerun;
126
	  else if (map->l_type == lt_library)
127
	    {
128
	      struct link_map **oldp = map->l_initfini;
129
	      map->l_initfini = map->l_orig_initfini;
130
	      _dl_scope_free (oldp);
131
	    }
132
	}
133
124
134
      /* There are still references to this object.  Do nothing more.  */
125
      /* There are still references to this object.  Do nothing more.  */
135
      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
126
      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
(-)a/elf/dl-deps.c (-1 / +3 lines)
Lines 478-483 _dl_map_object_deps (struct link_map *map, Link Here
478
		  nneeded * sizeof needed[0]);
478
		  nneeded * sizeof needed[0]);
479
	  atomic_write_barrier ();
479
	  atomic_write_barrier ();
480
	  l->l_initfini = l_initfini;
480
	  l->l_initfini = l_initfini;
481
	  l->l_free_initfini = 1;
481
	}
482
	}
482
483
483
      /* If we have no auxiliary objects just go on to the next map.  */
484
      /* If we have no auxiliary objects just go on to the next map.  */
Lines 681-686 Filters not supported with LD_TRACE_PRELINKING")); Link Here
681
  l_initfini[nlist] = NULL;
682
  l_initfini[nlist] = NULL;
682
  atomic_write_barrier ();
683
  atomic_write_barrier ();
683
  map->l_initfini = l_initfini;
684
  map->l_initfini = l_initfini;
685
  map->l_free_initfini = 1;
684
  if (l_reldeps != NULL)
686
  if (l_reldeps != NULL)
685
    {
687
    {
686
      atomic_write_barrier ();
688
      atomic_write_barrier ();
Lines 689-693 Filters not supported with LD_TRACE_PRELINKING")); Link Here
689
      _dl_scope_free (old_l_reldeps);
691
      _dl_scope_free (old_l_reldeps);
690
    }
692
    }
691
  if (old_l_initfini != NULL)
693
  if (old_l_initfini != NULL)
692
      map->l_orig_initfini = old_l_initfini;
694
    _dl_scope_free (old_l_initfini);
693
}
695
}
(-)a/elf/dl-libc.c (-1 / +5 lines)
Lines 265-277 libc_freeres_fn (free_mem) Link Here
265
265
266
  for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
266
  for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
267
    {
267
    {
268
      /* Remove all additional names added to the objects.  */
269
      for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
268
      for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
270
	{
269
	{
271
	  struct libname_list *lnp = l->l_libname->next;
270
	  struct libname_list *lnp = l->l_libname->next;
272
271
273
	  l->l_libname->next = NULL;
272
	  l->l_libname->next = NULL;
274
273
274
	  /* Remove all additional names added to the objects.  */
275
	  while (lnp != NULL)
275
	  while (lnp != NULL)
276
	    {
276
	    {
277
	      struct libname_list *old = lnp;
277
	      struct libname_list *old = lnp;
Lines 279-284 libc_freeres_fn (free_mem) Link Here
279
	      if (! old->dont_free)
279
	      if (! old->dont_free)
280
		free (old);
280
		free (old);
281
	    }
281
	    }
282
283
	  /* Free the initfini dependency list.  */
284
	  if (l->l_free_initfini)
285
	    free (l->l_initfini);
282
	}
286
	}
283
287
284
      if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
288
      if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
(-)a/elf/rtld.c (+1 lines)
Lines 2251-2256 ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", Link Here
2251
	      lnp->dont_free = 1;
2251
	      lnp->dont_free = 1;
2252
	      lnp = lnp->next;
2252
	      lnp = lnp->next;
2253
	    }
2253
	    }
2254
	  l->l_free_initfini = 0;
2254
2255
2255
	  if (l != &GL(dl_rtld_map))
2256
	  if (l != &GL(dl_rtld_map))
2256
	    _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
2257
	    _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
(-)a/include/link.h (-4 / +4 lines)
Lines 1-6 Link Here
1
/* Data structure for communication from the run-time dynamic linker for
1
/* Data structure for communication from the run-time dynamic linker for
2
   loaded ELF shared objects.
2
   loaded ELF shared objects.
3
   Copyright (C) 1995-2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
3
   Copyright (C) 1995-2006, 2007, 2009, 2010 Free Software Foundation, Inc.
4
   This file is part of the GNU C Library.
4
   This file is part of the GNU C Library.
5
5
6
   The GNU C Library is free software; you can redistribute it and/or
6
   The GNU C Library is free software; you can redistribute it and/or
Lines 192-197 struct link_map Link Here
192
						 during LD_TRACE_PRELINKING=1
192
						 during LD_TRACE_PRELINKING=1
193
						 contains any DT_SYMBOLIC
193
						 contains any DT_SYMBOLIC
194
						 libraries.  */
194
						 libraries.  */
195
    unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
196
				       freed, ie. not allocated with
197
				       the dummy malloc in ld.so.  */
195
198
196
    /* Collected information about own RPATH directories.  */
199
    /* Collected information about own RPATH directories.  */
197
    struct r_search_path_struct l_rpath_dirs;
200
    struct r_search_path_struct l_rpath_dirs;
Lines 240-248 struct link_map Link Here
240
243
241
    /* List of object in order of the init and fini calls.  */
244
    /* List of object in order of the init and fini calls.  */
242
    struct link_map **l_initfini;
245
    struct link_map **l_initfini;
243
    /* The init and fini list generated at startup, saved when the
244
       object is also loaded dynamically.  */
245
    struct link_map **l_orig_initfini;
246
246
247
    /* List of the dependencies introduced through symbol binding.  */
247
    /* List of the dependencies introduced through symbol binding.  */
248
    struct link_map_reldeps
248
    struct link_map_reldeps

Return to bug 13579