The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / uclibc / 0.9.33.2 / 0028-dl-fix-dlsym-lookups-with-RTLD_NEXT.patch
1 From f5108ce0c0f72a285e4cb198426e477295c84517 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
3 Date: Tue, 8 Jan 2013 11:55:26 +0200
4 Subject: [PATCH] dl: fix dlsym lookups with RTLD_NEXT
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The current code for dlsym() when invoked with RTLD_NEXT lookup
10 searches for the module where it's being called from, and executes the
11 _dl_find_hash only for the next module in the chain. However, if the
12 looked symbol is not there, the rest of the modules are not checked.
13
14 Generally this is not a problem as symbols are merged for the parent
15 modules; so this affects only RTLD_NEXT.
16
17 This patch adds a loop iterating through all the following modules.
18
19 Signed-off-by: Timo Teräs <timo.teras@iki.fi>
20 Reviewed-by: Filippo ARCIDIACONO <filippo.arcidiacono@st.com>
21 Tested-by: Florian Fainelli <florian@openwrt.org>
22 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
23 ---
24  ldso/libdl/libdl.c |   10 ++++++++--
25  1 file changed, 8 insertions(+), 2 deletions(-)
26
27 diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
28 index 51bcf7d..71ade1f 100644
29 --- a/ldso/libdl/libdl.c
30 +++ b/ldso/libdl/libdl.c
31 @@ -671,7 +671,7 @@ static void *do_dlsym(void *vhandle, const char *name, void *caller_address)
32  {
33         struct elf_resolve *tpnt, *tfrom;
34         struct dyn_elf *handle;
35 -       ElfW(Addr) from;
36 +       ElfW(Addr) from = 0;
37         struct dyn_elf *rpnt;
38         void *ret;
39         struct symbol_ref sym_ref = { NULL, NULL };
40 @@ -729,7 +729,13 @@ static void *do_dlsym(void *vhandle, const char *name, void *caller_address)
41         tpnt = NULL;
42         if (handle == _dl_symbol_tables)
43                 tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
44 -       ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
45 +
46 +       do {
47 +               ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
48 +               if (ret != NULL)
49 +                       break;
50 +               handle = handle->next;
51 +       } while (from && handle);
52  
53  #if defined(USE_TLS) && USE_TLS && defined SHARED
54         if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {
55 -- 
56 1.7.10.4
57