| From 9ba069f8859789c85b96aaa17876534b0f3b3058 Mon Sep 17 00:00:00 2001 |
| From: Dan Padgett <dpadgett@google.com> |
| Date: Thu, 24 Mar 2016 16:20:02 -0700 |
| Subject: [PATCH 07/17] dlopen: use libname cache before _dl_open-ing files |
| |
| --- |
| .../uclibc-0071-dlopen-use-libname-cache.patch | 29 ++++++++++++++++++++++ |
| 1 file changed, 29 insertions(+) |
| create mode 100644 package/uclibc/uclibc-0071-dlopen-use-libname-cache.patch |
| |
| diff --git a/package/uclibc/uclibc-0071-dlopen-use-libname-cache.patch b/package/uclibc/uclibc-0071-dlopen-use-libname-cache.patch |
| new file mode 100644 |
| index 0000000..5d295cf |
| --- /dev/null |
| +++ b/package/uclibc/uclibc-0071-dlopen-use-libname-cache.patch |
| @@ -0,0 +1,29 @@ |
| +commit d0b1894a40fff961c44a2e44840882e5e9048abf |
| +Author: Stephen McGruer <smcgruer@google.com> |
| +Date: Thu Oct 29 17:50:44 2015 -0400 |
| + |
| + [PATCH] dlopen: use libname cache before _dl_open-ing files |
| + |
| +diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c |
| +index 5631905..282a645 100644 |
| +--- a/ldso/ldso/dl-elf.c |
| ++++ b/ldso/ldso/dl-elf.c |
| +@@ -465,6 +465,18 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned rflags, |
| + DL_LOADADDR_TYPE lib_loadaddr; |
| + DL_INIT_LOADADDR_EXTRA_DECLS |
| + |
| ++ /* We can easily pre-check for already loaded absolute-path libraries. */ |
| ++ /* TODO(smcgruer): Determine if we can handle non-absolute paths. */ |
| ++ if (_dl_strlen(libname) && libname[0] == '/') { |
| ++ for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { |
| ++ if (_dl_strcmp(tpnt->libname, libname) == 0) { |
| ++ /* Already loaded */ |
| ++ tpnt->usage_count++; |
| ++ return tpnt; |
| ++ } |
| ++ } |
| ++ } |
| ++ |
| + libaddr = 0; |
| + infile = _dl_open(libname, O_RDONLY, 0); |
| + if (infile < 0) { |
| -- |
| 2.8.0.rc3.226.g39d4020 |
| |