* [PATCH v2 2/2] add test for correct calculation of dl_phdr_info.dlpi_subs
2016-08-05 7:41 [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
2016-08-05 7:41 ` [PATCH v2 1/2] " Gleb Natapov
@ 2016-08-05 7:41 ` Gleb Natapov
2016-09-07 17:00 ` [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
2 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2016-08-05 7:41 UTC (permalink / raw)
To: libc-alpha
---
elf/Makefile | 5 ++++-
elf/tst-dlpi_subs.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 1 deletion(-)
create mode 100644 elf/tst-dlpi_subs.c
diff --git a/elf/Makefile b/elf/Makefile
index 593403c..d64b281 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -149,7 +149,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-nodelete) \
tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
- tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error
+ tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-dlpi_subs
# reldep9
ifeq ($(build-hardcoded-path-in-tests),yes)
tests += tst-dlopen-aout
@@ -1005,6 +1005,9 @@ generated += check-execstack.out
$(objpfx)tst-dlmodcount: $(libdl)
$(objpfx)tst-dlmodcount.out: $(test-modules)
+$(objpfx)tst-dlpi_subs: $(libdl)
+$(objpfx)tst-dlpi_subs.out: $(test-modules)
+
$(all-built-dso:=.jmprel): %.jmprel: % Makefile
@rm -f $@T
LC_ALL=C $(READELF) -W -S -d -r $< > $@T
diff --git a/elf/tst-dlpi_subs.c b/elf/tst-dlpi_subs.c
new file mode 100644
index 0000000..24b8ed4
--- /dev/null
+++ b/elf/tst-dlpi_subs.c
@@ -0,0 +1,52 @@
+
+/* Test checks that dlpi_subs is calculated correctly when dlmopen is used
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <stdio.h>
+
+static int fail = 0;
+
+static int
+callback (struct dl_phdr_info *info, size_t size, void *data)
+{
+ if (info->dlpi_subs != 0) {
+ printf ("dlpi_subs == %llu instead of 0\n", info->dlpi_subs);
+ fail = 1;
+ }
+ return 0;
+}
+
+
+static int
+do_test (void)
+{
+ void *h = dlmopen (LM_ID_NEWLM, "$ORIGIN/tst-deep1mod2.so", RTLD_LAZY);
+ if (h == NULL)
+ {
+ printf ("cannot get handle for %s: %s\n",
+ "tst-deep1mod2.so", dlerror ());
+ return 1;
+ }
+ dl_iterate_phdr (callback, NULL);
+
+ return fail;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
--
2.5.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 0/2] count number of loaded objects in each namespace only once
@ 2016-08-05 7:41 Gleb Natapov
2016-08-05 7:41 ` [PATCH v2 1/2] " Gleb Natapov
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Gleb Natapov @ 2016-08-05 7:41 UTC (permalink / raw)
To: libc-alpha
v1->v2:
- indentation fixes
- fix c&p error in test comment
Gleb Natapov (2):
count number of loaded objects in each namespace only once
add test for correct calculation of dl_phdr_info.dlpi_subs
elf/Makefile | 5 ++++-
elf/dl-iteratephdr.c | 23 ++++++++++++-----------
elf/tst-dlpi_subs.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+), 12 deletions(-)
create mode 100644 elf/tst-dlpi_subs.c
--
2.5.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] count number of loaded objects in each namespace only once
2016-08-05 7:41 [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
@ 2016-08-05 7:41 ` Gleb Natapov
2016-08-05 7:41 ` [PATCH v2 2/2] add test for correct calculation of dl_phdr_info.dlpi_subs Gleb Natapov
2016-09-07 17:00 ` [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
2 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2016-08-05 7:41 UTC (permalink / raw)
To: libc-alpha
_ns_nloaded already has count of all objects in a namespace, no need to
add it while iterating over all objects.
---
elf/dl-iteratephdr.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c
index 1cb6e26..e4e7205 100644
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -48,17 +48,18 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
#ifdef SHARED
const void *caller = RETURN_ADDRESS (0);
for (Lmid_t cnt = GL(dl_nns) - 1; cnt > 0; --cnt)
- for (struct link_map *l = GL(dl_ns)[cnt]._ns_loaded; l; l = l->l_next)
- {
- /* We have to count the total number of loaded objects. */
- nloaded += GL(dl_ns)[cnt]._ns_nloaded;
-
- if (caller >= (const void *) l->l_map_start
- && caller < (const void *) l->l_map_end
- && (l->l_contiguous
- || _dl_addr_inside_object (l, (ElfW(Addr)) caller)))
- ns = cnt;
- }
+ {
+ /* We have to count the total number of loaded objects. */
+ nloaded += GL(dl_ns)[cnt]._ns_nloaded;
+ for (struct link_map *l = GL(dl_ns)[cnt]._ns_loaded; l; l = l->l_next)
+ {
+ if (caller >= (const void *) l->l_map_start
+ && caller < (const void *) l->l_map_end
+ && (l->l_contiguous
+ || _dl_addr_inside_object (l, (ElfW(Addr)) caller)))
+ ns = cnt;
+ }
+ }
#endif
for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
--
2.5.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] count number of loaded objects in each namespace only once
2016-08-05 7:41 [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
2016-08-05 7:41 ` [PATCH v2 1/2] " Gleb Natapov
2016-08-05 7:41 ` [PATCH v2 2/2] add test for correct calculation of dl_phdr_info.dlpi_subs Gleb Natapov
@ 2016-09-07 17:00 ` Gleb Natapov
2016-09-21 8:12 ` Gleb Natapov
2 siblings, 1 reply; 6+ messages in thread
From: Gleb Natapov @ 2016-09-07 17:00 UTC (permalink / raw)
To: libc-alpha
Copyright assignment paperwork was submitted and processed already. Can
this be applied now?
On Fri, Aug 05, 2016 at 10:40:24AM +0300, Gleb Natapov wrote:
> v1->v2:
> - indentation fixes
> - fix c&p error in test comment
>
> Gleb Natapov (2):
> count number of loaded objects in each namespace only once
> add test for correct calculation of dl_phdr_info.dlpi_subs
>
> elf/Makefile | 5 ++++-
> elf/dl-iteratephdr.c | 23 ++++++++++++-----------
> elf/tst-dlpi_subs.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 68 insertions(+), 12 deletions(-)
> create mode 100644 elf/tst-dlpi_subs.c
>
> --
> 2.5.5
>
--
Gleb.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] count number of loaded objects in each namespace only once
2016-09-07 17:00 ` [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
@ 2016-09-21 8:12 ` Gleb Natapov
0 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2016-09-21 8:12 UTC (permalink / raw)
To: libc-alpha
Ping?
On Wed, Sep 07, 2016 at 08:00:15PM +0300, Gleb Natapov wrote:
> Copyright assignment paperwork was submitted and processed already. Can
> this be applied now?
>
> On Fri, Aug 05, 2016 at 10:40:24AM +0300, Gleb Natapov wrote:
> > v1->v2:
> > - indentation fixes
> > - fix c&p error in test comment
> >
> > Gleb Natapov (2):
> > count number of loaded objects in each namespace only once
> > add test for correct calculation of dl_phdr_info.dlpi_subs
> >
> > elf/Makefile | 5 ++++-
> > elf/dl-iteratephdr.c | 23 ++++++++++++-----------
> > elf/tst-dlpi_subs.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 68 insertions(+), 12 deletions(-)
> > create mode 100644 elf/tst-dlpi_subs.c
> >
> > --
> > 2.5.5
> >
>
> --
> Gleb.
--
Gleb.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 0/2] count number of loaded objects in each namespace only once
@ 2016-08-03 13:53 Gleb Natapov
0 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2016-08-03 13:53 UTC (permalink / raw)
To: libc-alpha
It turned out I do not have glibc contribution agreement signed yet (this is in the works),
but here is the patches with comments addressed for review meanwhile.
Gleb Natapov (2):
count number of loaded objects in each namespace only once
add test for correct calculation of dl_phdr_info.dlpi_subs
elf/Makefile | 5 ++++-
elf/dl-iteratephdr.c | 7 ++++---
elf/tst-dlpi_subs.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 62 insertions(+), 4 deletions(-)
create mode 100644 elf/tst-dlpi_subs.c
--
2.5.5
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-09-21 8:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-05 7:41 [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
2016-08-05 7:41 ` [PATCH v2 1/2] " Gleb Natapov
2016-08-05 7:41 ` [PATCH v2 2/2] add test for correct calculation of dl_phdr_info.dlpi_subs Gleb Natapov
2016-09-07 17:00 ` [PATCH v2 0/2] count number of loaded objects in each namespace only once Gleb Natapov
2016-09-21 8:12 ` Gleb Natapov
-- strict thread matches above, loose matches on Subject: below --
2016-08-03 13:53 Gleb Natapov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).