Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so If dlopen of the dynamic linker is request...
details: https://anonhg.NetBSD.org/src/rev/4fabc2efb070
branches: trunk
changeset: 791473:4fabc2efb070
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Nov 20 07:18:23 2013 +0000
description:
If dlopen of the dynamic linker is requested, e.g. by rump in
rumpuser_dl_bootstrap, then return &_rtld_objself as the handle and do
not create a duplicate mapping.
The handle is mostly useless as _rtld_objself doesn't appear on
_rtld_objlist.
This fixes a problem on earm platforms where ld.elf_so (currently) has
an init_array section. Calling this caused binaries to segv.
diffstat:
libexec/ld.elf_so/load.c | 11 +++++++++--
libexec/ld.elf_so/rtld.c | 8 +++++---
2 files changed, 14 insertions(+), 5 deletions(-)
diffs (62 lines):
diff -r a255e8b57d74 -r 4fabc2efb070 libexec/ld.elf_so/load.c
--- a/libexec/ld.elf_so/load.c Tue Nov 19 22:41:43 2013 +0000
+++ b/libexec/ld.elf_so/load.c Wed Nov 20 07:18:23 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: load.c,v 1.45 2013/05/09 15:37:58 christos Exp $ */
+/* $NetBSD: load.c,v 1.46 2013/11/20 07:18:23 skrll Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: load.c,v 1.45 2013/05/09 15:37:58 christos Exp $");
+__RCSID("$NetBSD: load.c,v 1.46 2013/11/20 07:18:23 skrll Exp $");
#endif /* not lint */
#include <err.h>
@@ -146,6 +146,13 @@
}
}
+#ifdef RTLD_LOADER
+ if (pathlen == _rtld_objself.pathlen &&
+ strcmp(_rtld_objself.path, filepath) == 0) {
+ return &_rtld_objself;
+ }
+#endif
+
if (obj == NULL) { /* First use of this object, so we must map it in */
obj = _rtld_map_object(filepath, fd, &sb);
(void)close(fd);
diff -r a255e8b57d74 -r 4fabc2efb070 libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c Tue Nov 19 22:41:43 2013 +0000
+++ b/libexec/ld.elf_so/rtld.c Wed Nov 20 07:18:23 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.c,v 1.170 2013/10/19 17:19:30 christos Exp $ */
+/* $NetBSD: rtld.c,v 1.171 2013/11/20 07:18:23 skrll Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.170 2013/10/19 17:19:30 christos Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.171 2013/11/20 07:18:23 skrll Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -636,8 +636,10 @@
* one is being used.
*/
if (_rtld_objmain->interp != NULL &&
- strcmp(_rtld_objmain->interp, _rtld_objself.path) != 0)
+ strcmp(_rtld_objmain->interp, _rtld_objself.path) != 0) {
_rtld_objself.path = xstrdup(_rtld_objmain->interp);
+ _rtld_objself.pathlen = strlen(_rtld_objself.path);
+ }
dbg(("actual dynamic linker is %s", _rtld_objself.path));
_rtld_digest_dynamic(execname, _rtld_objmain);
Home |
Main Index |
Thread Index |
Old Index