Module Name: src
Committed By: matt
Date: Wed Apr 21 05:26:10 UTC 2010
Modified Files:
src/libexec/ftpd [matt-nb5-mips64]: popen.c version.h
src/libexec/ld.elf_so [matt-nb5-mips64]: map_object.c reloc.c rtld.c
rtld.h symbol.c
Log Message:
sync to netbsd-5
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.10.1 src/libexec/ftpd/popen.c
cvs rdiff -u -r1.70 -r1.70.10.1 src/libexec/ftpd/version.h
cvs rdiff -u -r1.36.4.1 -r1.36.4.1.4.1 src/libexec/ld.elf_so/map_object.c
cvs rdiff -u -r1.96 -r1.96.10.1 src/libexec/ld.elf_so/reloc.c
cvs rdiff -u -r1.123 -r1.123.8.1 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.79 -r1.79.10.1 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.47 -r1.47.10.1 src/libexec/ld.elf_so/symbol.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/libexec/ftpd/popen.c
diff -u src/libexec/ftpd/popen.c:1.34 src/libexec/ftpd/popen.c:1.34.10.1
--- src/libexec/ftpd/popen.c:1.34 Sat Sep 13 02:41:52 2008
+++ src/libexec/ftpd/popen.c Wed Apr 21 05:26:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: popen.c,v 1.34 2008/09/13 02:41:52 lukem Exp $ */
+/* $NetBSD: popen.c,v 1.34.10.1 2010/04/21 05:26:10 matt Exp $ */
/*-
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#else
-__RCSID("$NetBSD: popen.c,v 1.34 2008/09/13 02:41:52 lukem Exp $");
+__RCSID("$NetBSD: popen.c,v 1.34.10.1 2010/04/21 05:26:10 matt Exp $");
#endif
#endif /* not lint */
@@ -138,7 +138,8 @@
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE|GLOB_LIMIT;
memset(&gl, 0, sizeof(gl));
- if (glob(argv[argc], flags, NULL, &gl)) {
+ if (glob(argv[argc], flags, NULL, &gl)
+ || gl.gl_pathv == NULL) {
if (sl_add(sl, ftpd_strdup(argv[argc])) == -1) {
globfree(&gl);
goto pfree;
Index: src/libexec/ftpd/version.h
diff -u src/libexec/ftpd/version.h:1.70 src/libexec/ftpd/version.h:1.70.10.1
--- src/libexec/ftpd/version.h:1.70 Tue Sep 16 12:30:38 2008
+++ src/libexec/ftpd/version.h Wed Apr 21 05:26:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.70 2008/09/16 12:30:38 lukem Exp $ */
+/* $NetBSD: version.h,v 1.70.10.1 2010/04/21 05:26:10 matt Exp $ */
/*-
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,5 +29,5 @@
*/
#ifndef FTPD_VERSION
-#define FTPD_VERSION "NetBSD-ftpd 20080916"
+#define FTPD_VERSION "NetBSD-ftpd 20100320"
#endif
Index: src/libexec/ld.elf_so/map_object.c
diff -u src/libexec/ld.elf_so/map_object.c:1.36.4.1 src/libexec/ld.elf_so/map_object.c:1.36.4.1.4.1
--- src/libexec/ld.elf_so/map_object.c:1.36.4.1 Fri Jan 16 22:21:30 2009
+++ src/libexec/ld.elf_so/map_object.c Wed Apr 21 05:26:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: map_object.c,v 1.36.4.1 2009/01/16 22:21:30 bouyer Exp $ */
+/* $NetBSD: map_object.c,v 1.36.4.1.4.1 2010/04/21 05:26:10 matt Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: map_object.c,v 1.36.4.1 2009/01/16 22:21:30 bouyer Exp $");
+__RCSID("$NetBSD: map_object.c,v 1.36.4.1.4.1 2010/04/21 05:26:10 matt Exp $");
#endif /* not lint */
#include <errno.h>
@@ -325,6 +325,9 @@
xfree(elm);
}
xfree(obj);
+#ifdef COMBRELOC
+ _rtld_combreloc_reset(obj);
+#endif
}
Obj_Entry *
Index: src/libexec/ld.elf_so/reloc.c
diff -u src/libexec/ld.elf_so/reloc.c:1.96 src/libexec/ld.elf_so/reloc.c:1.96.10.1
--- src/libexec/ld.elf_so/reloc.c:1.96 Tue Jul 29 16:27:01 2008
+++ src/libexec/ld.elf_so/reloc.c Wed Apr 21 05:26:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: reloc.c,v 1.96 2008/07/29 16:27:01 matt Exp $ */
+/* $NetBSD: reloc.c,v 1.96.10.1 2010/04/21 05:26:10 matt Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: reloc.c,v 1.96 2008/07/29 16:27:01 matt Exp $");
+__RCSID("$NetBSD: reloc.c,v 1.96.10.1 2010/04/21 05:26:10 matt Exp $");
#endif /* not lint */
#include <err.h>
Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.123 src/libexec/ld.elf_so/rtld.c:1.123.8.1
--- src/libexec/ld.elf_so/rtld.c:1.123 Sun Oct 26 07:11:54 2008
+++ src/libexec/ld.elf_so/rtld.c Wed Apr 21 05:26:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.c,v 1.123 2008/10/26 07:11:54 mrg Exp $ */
+/* $NetBSD: rtld.c,v 1.123.8.1 2010/04/21 05:26:10 matt Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.123 2008/10/26 07:11:54 mrg Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.123.8.1 2010/04/21 05:26:10 matt Exp $");
#endif /* not lint */
#include <err.h>
@@ -439,8 +439,8 @@
getenv("LD_LIBRARY_PATH"));
} else {
execname = NULL;
- unsetenv("LD_DEBUG");
- unsetenv("LD_LIBRARY_PATH");
+ if (unsetenv("LD_DEBUG") || unsetenv("LD_LIBRARY_PATH"))
+ _rtld_die();
}
_rtld_process_hints(execname, &_rtld_paths, &_rtld_xforms,
_PATH_LD_HINTS);
@@ -514,7 +514,8 @@
if (_rtld_preload(getenv("LD_PRELOAD")) == -1)
_rtld_die();
} else
- unsetenv("LD_PRELOAD");
+ if (unsetenv("LD_PRELOAD"))
+ _rtld_die();
dbg(("loading needed objects"));
if (_rtld_load_needed_objects(_rtld_objmain, RTLD_MAIN) == -1)
@@ -985,6 +986,47 @@
return 1;
}
+__strong_alias(__dlinfo,dlinfo)
+int
+dlinfo(void *handle, int req, void *v)
+{
+ const Obj_Entry *obj;
+ void *retaddr;
+
+ if (handle == RTLD_SELF) {
+#ifdef __powerpc__
+ retaddr = hackish_return_address();
+#else
+ retaddr = __builtin_return_address(0);
+#endif
+ if ((obj = _rtld_obj_from_addr(retaddr)) == NULL) {
+ _rtld_error("Cannot determine caller's shared object");
+ return -1;
+ }
+ } else {
+ if ((obj = _rtld_dlcheck(handle)) == NULL) {
+ _rtld_error("Invalid handle");
+ return -1;
+ }
+ }
+
+ switch (req) {
+ case RTLD_DI_LINKMAP:
+ {
+ const struct link_map **map = v;
+
+ *map = &obj->linkmap;
+ break;
+ }
+
+ default:
+ _rtld_error("Invalid request");
+ return -1;
+ }
+
+ return 0;
+}
+
/*
* Error reporting function. Use it like printf. If formats the message
* into a buffer, and sets things up so that the next call to dlerror()
Index: src/libexec/ld.elf_so/rtld.h
diff -u src/libexec/ld.elf_so/rtld.h:1.79 src/libexec/ld.elf_so/rtld.h:1.79.10.1
--- src/libexec/ld.elf_so/rtld.h:1.79 Sat Oct 4 09:37:12 2008
+++ src/libexec/ld.elf_so/rtld.h Wed Apr 21 05:26:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.h,v 1.79 2008/10/04 09:37:12 skrll Exp $ */
+/* $NetBSD: rtld.h,v 1.79.10.1 2010/04/21 05:26:10 matt Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -130,7 +130,6 @@
caddr_t entry; /* Entry point */
const Elf_Phdr *__junk001;
size_t pathlen; /* Pathname length */
- void *ehdr;
/* Items from the dynamic section. */
Elf_Addr *pltgot; /* PLTGOT table */
@@ -195,6 +194,8 @@
Objlist dagmembers; /* DAG has these members (%) */
dev_t dev; /* Object's filesystem's device */
ino_t ino; /* Object's inode number */
+
+ void *ehdr;
} Obj_Entry;
#if defined(_RTLD_SOURCE)
@@ -222,6 +223,7 @@
void *dlsym(void *, const char *);
int dlclose(void *);
int dladdr(const void *, Dl_info *);
+int dlinfo(void *, int, void *);
void _rtld_error(const char *, ...)
__attribute__((__format__(__printf__,1,2)));
@@ -276,6 +278,9 @@
const Obj_Entry *, const Obj_Entry **, bool);
const Elf_Sym *_rtld_symlook_needed(const char *, unsigned long,
const Needed_Entry *, const Obj_Entry **, bool);
+#ifdef COMBRELOC
+void _rtld_combreloc_reset(const Obj_Entry *);
+#endif
/* map_object.c */
Obj_Entry *_rtld_map_object(const char *, int, const struct stat *);
Index: src/libexec/ld.elf_so/symbol.c
diff -u src/libexec/ld.elf_so/symbol.c:1.47 src/libexec/ld.elf_so/symbol.c:1.47.10.1
--- src/libexec/ld.elf_so/symbol.c:1.47 Sat Oct 4 09:37:12 2008
+++ src/libexec/ld.elf_so/symbol.c Wed Apr 21 05:26:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: symbol.c,v 1.47 2008/10/04 09:37:12 skrll Exp $ */
+/* $NetBSD: symbol.c,v 1.47.10.1 2010/04/21 05:26:10 matt Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: symbol.c,v 1.47 2008/10/04 09:37:12 skrll Exp $");
+__RCSID("$NetBSD: symbol.c,v 1.47.10.1 2010/04/21 05:26:10 matt Exp $");
#endif /* not lint */
#include <err.h>
@@ -69,6 +69,7 @@
(fptr_t)dlsym,
(fptr_t)dlerror,
(fptr_t)dladdr,
+ (fptr_t)dlinfo,
NULL
};
int i;
@@ -235,6 +236,21 @@
return NULL;
}
+#ifdef COMBRELOC
+static const Obj_Entry *_rtld_last_refobj;
+
+/*
+ * Called when an object is freed. Reset the cached symbol look up if
+ * our last referencing or definition object just got unloaded.
+ */
+void
+_rtld_combreloc_reset(const Obj_Entry *obj)
+{
+ if (_rtld_last_refobj == obj)
+ _rtld_last_refobj = NULL;
+}
+#endif
+
/*
* Given a symbol number in a referencing object, find the corresponding
* definition of the symbol. Returns a pointer to the symbol, or NULL if
@@ -260,11 +276,10 @@
* return the cached results.
*/
static unsigned long last_symnum;
- static const Elf_Sym *last_def;
- static const Obj_Entry *last_refobj;
static const Obj_Entry *last_defobj;
+ static const Elf_Sym *last_def;
- if (symnum == last_symnum && refobj == last_refobj
+ if (symnum == last_symnum && refobj == _rtld_last_refobj
&& in_plt == false) {
*defobj_out = last_defobj;
return last_def;
@@ -318,7 +333,7 @@
* non-PLT lookup.
*/
last_symnum = symnum;
- last_refobj = refobj;
+ _rtld_last_refobj = refobj;
last_def = def;
last_defobj = defobj;
}