Magellan Linux

Annotation of /trunk/glibc/patches/glibc-2.14-libdl-crash.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1806 - (hide annotations) (download)
Tue Jun 12 12:33:27 2012 UTC (11 years, 11 months ago) by niro
File size: 4587 byte(s)
-added patches for 2.15-r1
1 niro 1806 diff --git a/elf/dl-close.c b/elf/dl-close.c
2     index 73b2a2f..9bd91e3 100644
3     --- a/elf/dl-close.c
4     +++ b/elf/dl-close.c
5     @@ -1,5 +1,5 @@
6     /* Close a shared object opened by `_dl_open'.
7     - Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
8     + Copyright (C) 1996-2007, 2009, 2010 Free Software Foundation, Inc.
9     This file is part of the GNU C Library.
10    
11     The GNU C Library is free software; you can redistribute it and/or
12     @@ -119,17 +119,8 @@ _dl_close_worker (struct link_map *map)
13     if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
14     || dl_close_state != not_pending)
15     {
16     - if (map->l_direct_opencount == 0)
17     - {
18     - if (map->l_type == lt_loaded)
19     - dl_close_state = rerun;
20     - else if (map->l_type == lt_library)
21     - {
22     - struct link_map **oldp = map->l_initfini;
23     - map->l_initfini = map->l_orig_initfini;
24     - _dl_scope_free (oldp);
25     - }
26     - }
27     + if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
28     + dl_close_state = rerun;
29    
30     /* There are still references to this object. Do nothing more. */
31     if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
32     diff --git a/elf/dl-deps.c b/elf/dl-deps.c
33     index 9e30594..3890d00 100644
34     --- a/elf/dl-deps.c
35     +++ b/elf/dl-deps.c
36     @@ -478,6 +478,7 @@ _dl_map_object_deps (struct link_map *map,
37     nneeded * sizeof needed[0]);
38     atomic_write_barrier ();
39     l->l_initfini = l_initfini;
40     + l->l_free_initfini = 1;
41     }
42    
43     /* If we have no auxiliary objects just go on to the next map. */
44     @@ -681,6 +682,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
45     l_initfini[nlist] = NULL;
46     atomic_write_barrier ();
47     map->l_initfini = l_initfini;
48     + map->l_free_initfini = 1;
49     if (l_reldeps != NULL)
50     {
51     atomic_write_barrier ();
52     @@ -689,5 +691,5 @@ Filters not supported with LD_TRACE_PRELINKING"));
53     _dl_scope_free (old_l_reldeps);
54     }
55     if (old_l_initfini != NULL)
56     - map->l_orig_initfini = old_l_initfini;
57     + _dl_scope_free (old_l_initfini);
58    
59     diff --git a/elf/dl-libc.c b/elf/dl-libc.c
60     index 7be9483..a13fce3 100644
61     --- a/elf/dl-libc.c
62     +++ b/elf/dl-libc.c
63     @@ -265,13 +265,13 @@ libc_freeres_fn (free_mem)
64    
65     for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
66     {
67     - /* Remove all additional names added to the objects. */
68     for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
69     {
70     struct libname_list *lnp = l->l_libname->next;
71    
72     l->l_libname->next = NULL;
73    
74     + /* Remove all additional names added to the objects. */
75     while (lnp != NULL)
76     {
77     struct libname_list *old = lnp;
78     @@ -279,6 +279,10 @@ libc_freeres_fn (free_mem)
79     if (! old->dont_free)
80     free (old);
81     }
82     +
83     + /* Free the initfini dependency list. */
84     + if (l->l_free_initfini)
85     + free (l->l_initfini);
86     }
87    
88     if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
89     diff --git a/elf/rtld.c b/elf/rtld.c
90     index 4a9109e..617e30e 100644
91     --- a/elf/rtld.c
92     +++ b/elf/rtld.c
93     @@ -2251,6 +2251,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
94     lnp->dont_free = 1;
95     lnp = lnp->next;
96     }
97     + l->l_free_initfini = 0;
98    
99     if (l != &GL(dl_rtld_map))
100     _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
101     diff --git a/include/link.h b/include/link.h
102     index e877104..051b99a 100644
103     --- a/include/link.h
104     +++ b/include/link.h
105     @@ -1,6 +1,6 @@
106     /* Data structure for communication from the run-time dynamic linker for
107     loaded ELF shared objects.
108     - Copyright (C) 1995-2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
109     + Copyright (C) 1995-2006, 2007, 2009, 2010 Free Software Foundation, Inc.
110     This file is part of the GNU C Library.
111    
112     The GNU C Library is free software; you can redistribute it and/or
113     @@ -192,6 +192,9 @@ struct link_map
114     during LD_TRACE_PRELINKING=1
115     contains any DT_SYMBOLIC
116     libraries. */
117     + unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
118     + freed, ie. not allocated with
119     + the dummy malloc in ld.so. */
120    
121     /* Collected information about own RPATH directories. */
122     struct r_search_path_struct l_rpath_dirs;
123     @@ -240,9 +243,6 @@ struct link_map
124    
125     /* List of object in order of the init and fini calls. */
126     struct link_map **l_initfini;
127     - /* The init and fini list generated at startup, saved when the
128     - object is also loaded dynamically. */
129     - struct link_map **l_orig_initfini;
130    
131     /* List of the dependencies introduced through symbol binding. */
132     struct link_map_reldeps