summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sgs
diff options
context:
space:
mode:
authorRod Evans <Rod.Evans@Sun.COM>2009-04-10 13:45:29 -0700
committerRod Evans <Rod.Evans@Sun.COM>2009-04-10 13:45:29 -0700
commitdde769a2c00c82faaf80563ddd5610de2f4da339 (patch)
tree1c1aa17faaee1d823ca6489db681459e6bb399f4 /usr/src/cmd/sgs
parent983a10335731bc55a0b7a37f195575fa109e30d4 (diff)
downloadillumos-joyent-dde769a2c00c82faaf80563ddd5610de2f4da339.tar.gz
6715578 AOUT (BCP) symbol lookup can be compromised with lazy loading.
6752883 ld.so.1 error message should be buffered (not sent to stderr). 6577982 ld.so.1 calls getpid() before it should when any LD_* are set 6826513 ldd gets confused by a crle(1) LD_PRELOAD setting
Diffstat (limited to 'usr/src/cmd/sgs')
-rw-r--r--usr/src/cmd/sgs/libconv/common/lddstub.c20
-rw-r--r--usr/src/cmd/sgs/libconv/common/lddstub.msg9
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/mapfile-vers30
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README4
-rw-r--r--usr/src/cmd/sgs/rtld/common/_rtld.h1
-rw-r--r--usr/src/cmd/sgs/rtld/common/a.out.c2
-rw-r--r--usr/src/cmd/sgs/rtld/common/analyze.c2
-rw-r--r--usr/src/cmd/sgs/rtld/common/config_elf.c2
-rw-r--r--usr/src/cmd/sgs/rtld/common/debug.c21
-rw-r--r--usr/src/cmd/sgs/rtld/common/dlfcns.c29
-rw-r--r--usr/src/cmd/sgs/rtld/common/elf.c92
-rw-r--r--usr/src/cmd/sgs/rtld/common/external.c14
-rw-r--r--usr/src/cmd/sgs/rtld/common/object.c10
-rw-r--r--usr/src/cmd/sgs/rtld/common/paths.c5
-rw-r--r--usr/src/cmd/sgs/rtld/common/remove.c33
-rw-r--r--usr/src/cmd/sgs/rtld/common/setup.c147
-rw-r--r--usr/src/cmd/sgs/rtld/common/util.c109
-rw-r--r--usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c1
-rw-r--r--usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg1
19 files changed, 288 insertions, 244 deletions
diff --git a/usr/src/cmd/sgs/libconv/common/lddstub.c b/usr/src/cmd/sgs/libconv/common/lddstub.c
index 89978218d7..151ead9078 100644
--- a/usr/src/cmd/sgs/libconv/common/lddstub.c
+++ b/usr/src/cmd/sgs/libconv/common/lddstub.c
@@ -20,11 +20,9 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <unistd.h>
#include <strings.h>
@@ -77,17 +75,29 @@ conv_lddstub(int class)
if (geteuid()) {
if ((class == ELFCLASS32) && (orgflag != -1)) {
if (orgflag == 0) {
+ /* BEGIN CSTYLED */
if ((orgflag = originlddstub(orgstub,
- MSG_ORIG(MSG_ORG_LDDSTUB))) == -1)
+#ifdef _LP64
+ MSG_ORIG(MSG_ORG_64LDD_32STUB))) == -1)
+#else
+ MSG_ORIG(MSG_ORG_32LDD_32STUB))) == -1)
+#endif
return (stub);
+ /* END CSTYLED */
}
stub = (const char *)orgstub;
}
if ((class == ELFCLASS64) && (orgflag64 != -1)) {
if (orgflag64 == 0) {
+ /* BEGIN CSTYLED */
if ((orgflag64 = originlddstub(orgstub64,
- MSG_ORIG(MSG_ORG_LDDSTUB_64))) == -1)
+#ifdef _LP64
+ MSG_ORIG(MSG_ORG_64LDD_64STUB))) == -1)
+#else
+ MSG_ORIG(MSG_ORG_32LDD_64STUB))) == -1)
+#endif
return (stub);
+ /* END CSTYLED */
}
stub = (const char *)orgstub64;
}
diff --git a/usr/src/cmd/sgs/libconv/common/lddstub.msg b/usr/src/cmd/sgs/libconv/common/lddstub.msg
index a2a4b243f7..8913d2ea84 100644
--- a/usr/src/cmd/sgs/libconv/common/lddstub.msg
+++ b/usr/src/cmd/sgs/libconv/common/lddstub.msg
@@ -19,13 +19,14 @@
# CDDL HEADER END
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-@ MSG_ORG_LDDSTUB "/../lib/lddstub"
-@ MSG_ORG_LDDSTUB_64 "/../lib/64/lddstub"
+@ MSG_ORG_32LDD_32STUB "/../lib/lddstub"
+@ MSG_ORG_32LDD_64STUB "/../lib/64/lddstub"
+@ MSG_ORG_64LDD_32STUB "/../../lib/lddstub"
+@ MSG_ORG_64LDD_64STUB "/../../lib/64/lddstub"
@ MSG_PTH_LDDSTUB "/usr/lib/lddstub"
@ MSG_PTH_LDDSTUB_64 "/usr/lib/64/lddstub"
diff --git a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers
index 877c702853..f69949a4bb 100644
--- a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers
+++ b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers
@@ -530,33 +530,3 @@ SUNWprivate_3.23 {
local:
*;
};
-
-# The following functions must be provided by our caller, or one of the callers
-# dependencies. When used with ld.so.1 all functions are provided from ld.so.1,
-# but when used with ld, many of the functions fall back to libc. Presently we
-# don't build liblddbg with a libc dependency simply to avoid having to load it
-# with ld.so.1 which already offers the required interfaces (from libc_pic.a).
-# Distinguishing between `parent' and `extern' symbols offers a small
-# performance advantage with direct bindings, but this is mainly a test of what
-# we're capable of doing, rather than an admission that its really worth it :-).
-
-{
- _close = FUNCTION extern;
- _open = FUNCTION extern;
- _write = FUNCTION extern;
- dgettext = FUNCTION extern;
- dlopen = FUNCTION extern;
- dlsym = FUNCTION extern;
- free = FUNCTION parent;
- malloc = FUNCTION parent;
- memcpy = FUNCTION extern;
- qsort = FUNCTION extern;
- snprintf = FUNCTION extern;
- sprintf = FUNCTION extern;
- strcat = FUNCTION extern;
- strcmp = FUNCTION extern;
- strcpy = FUNCTION extern;
- strlen = FUNCTION extern;
- strrchr = FUNCTION extern;
- strtok_r = FUNCTION extern;
-};
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index 8630db1332..c647cc83da 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -1470,3 +1470,7 @@ Bugid Risk Synopsis
6821619 Solaris linkers need systematic approach to ELF OSABI
PSARC/2009/196 ELF objects to set OSABI / elfdump -O option
6827468 6801536 breaks 'ld -s' if there are weak/strong symbol pairs
+6715578 AOUT (BCP) symbol lookup can be compromised with lazy loading.
+6752883 ld.so.1 error message should be buffered (not sent to stderr).
+6577982 ld.so.1 calls getpid() before it should when any LD_* are set
+6826513 ldd gets confused by a crle(1) LD_PRELOAD setting
diff --git a/usr/src/cmd/sgs/rtld/common/_rtld.h b/usr/src/cmd/sgs/rtld/common/_rtld.h
index d80f79bd13..ee7907f43d 100644
--- a/usr/src/cmd/sgs/rtld/common/_rtld.h
+++ b/usr/src/cmd/sgs/rtld/common/_rtld.h
@@ -610,6 +610,7 @@ extern caddr_t caller(void);
extern void *calloc(size_t, size_t);
extern void cap_assign(Cap *, Rt_map *);
extern const char *_conv_reloc_type(uint_t rel);
+extern Aliste create_cntl(Lm_list *, int);
extern void defrag(void);
extern uintptr_t dbg_setup(const char *, Dbg_desc *);
extern const char *demangle(const char *);
diff --git a/usr/src/cmd/sgs/rtld/common/a.out.c b/usr/src/cmd/sgs/rtld/common/a.out.c
index 4331d96ac3..21f5ea0c11 100644
--- a/usr/src/cmd/sgs/rtld/common/a.out.c
+++ b/usr/src/cmd/sgs/rtld/common/a.out.c
@@ -149,7 +149,7 @@ aout_fix_name(const char *oname, Rt_map *clmp, Alist **alpp, Aliste alni,
return (0);
}
- if ((pdp = alist_append(alpp, 0, sizeof (Pdesc), alni)) == NULL)
+ if ((pdp = alist_append(alpp, NULL, sizeof (Pdesc), alni)) == NULL)
return (0);
pdp->pd_pname = nname;
diff --git a/usr/src/cmd/sgs/rtld/common/analyze.c b/usr/src/cmd/sgs/rtld/common/analyze.c
index f1a0eadba4..09400a8940 100644
--- a/usr/src/cmd/sgs/rtld/common/analyze.c
+++ b/usr/src/cmd/sgs/rtld/common/analyze.c
@@ -2222,7 +2222,7 @@ load_finish(Lm_list *lml, const char *name, Rt_map *clmp, int nmode,
* Establish the flags for this callers dependency descriptor
* (Grp_desc).
*
- * . The creation of a handle associated a descriptor for the
+ * . The creation of a handle associates a descriptor for the
* new object and descriptor for the parent (caller).
* Typically, the handle is created for dlopen() or for
* filtering. A handle may also be created to promote
diff --git a/usr/src/cmd/sgs/rtld/common/config_elf.c b/usr/src/cmd/sgs/rtld/common/config_elf.c
index ee72941dad..dd3e9a0428 100644
--- a/usr/src/cmd/sgs/rtld/common/config_elf.c
+++ b/usr/src/cmd/sgs/rtld/common/config_elf.c
@@ -503,7 +503,7 @@ elf_config_flt(Lm_list *lml, const char *filter, const char *string,
flte = config->c_strtbl + fltetbl->fe_filtee;
- if ((pdp = alist_append(alpp, 0, sizeof (Pdesc),
+ if ((pdp = alist_append(alpp, NULL, sizeof (Pdesc),
alni)) == NULL)
return;
diff --git a/usr/src/cmd/sgs/rtld/common/debug.c b/usr/src/cmd/sgs/rtld/common/debug.c
index 3d8cff944f..558e16021e 100644
--- a/usr/src/cmd/sgs/rtld/common/debug.c
+++ b/usr/src/cmd/sgs/rtld/common/debug.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -79,6 +79,11 @@ dbg_setup(const char *options, Dbg_desc *dbp)
return (ret);
/*
+ * Obtain the process id.
+ */
+ pid = getpid();
+
+ /*
* If an LD_DEBUG_OUTPUT file was specified then we need to direct all
* diagnostics to the specified file. Add the process id as a file
* suffix so that multiple processes that inherit the same debugging
@@ -88,7 +93,7 @@ dbg_setup(const char *options, Dbg_desc *dbp)
char file[MAXPATHLEN];
(void) snprintf(file, MAXPATHLEN, MSG_ORIG(MSG_DBG_FILE),
- dbg_file, getpid());
+ dbg_file, pid);
if ((dbg_fd = open(file, (O_RDWR | O_CREAT), 0666)) == -1) {
int err = errno;
@@ -112,7 +117,6 @@ dbg_setup(const char *options, Dbg_desc *dbp)
(void) rtld_fstat(dbg_fd, &status);
dbg_dev = status.st_dev;
dbg_ino = status.st_ino;
- pid = getpid();
return (ret);
}
@@ -204,16 +208,9 @@ dbg_print(Lm_list *lml, const char *format, ...)
prf.pr_fd = dbg_fd;
/*
- * The getpid() call is a 'special' interface between ld.so.1 and dbx,
- * because of this getpid() can't be called freely until after control
- * has been given to the user program. Once the control has been given
- * to the user program we know that the r_debug structure has been
- * properly initialized for the debugger.
+ * Obtain the process id.
*/
- if (rtld_flags & RT_FL_APPLIC)
- _pid = getpid();
- else
- _pid = pid;
+ _pid = getpid();
if (lml)
(void) bufprint(&prf, MSG_ORIG(MSG_DBG_PID), _pid);
diff --git a/usr/src/cmd/sgs/rtld/common/dlfcns.c b/usr/src/cmd/sgs/rtld/common/dlfcns.c
index 50c5b2177b..02ebfb8715 100644
--- a/usr/src/cmd/sgs/rtld/common/dlfcns.c
+++ b/usr/src/cmd/sgs/rtld/common/dlfcns.c
@@ -414,7 +414,7 @@ dlclose_core(Grp_hdl *ghp, Rt_map *clmp, Lm_list *lml)
* If we're already at atexit() there's no point processing further,
* all objects have already been tsorted for fini processing.
*/
- if ((rtld_flags & RT_FL_ATEXIT) != 0)
+ if (rtld_flags & RT_FL_ATEXIT)
return (0);
/*
@@ -428,7 +428,6 @@ dlclose_core(Grp_hdl *ghp, Rt_map *clmp, Lm_list *lml)
DBG_DLCLOSE_NULL));
}
-
/*
* Decrement reference count of this object.
*/
@@ -567,14 +566,13 @@ newlmid(Lm_list *lml)
* Core dlopen activity.
*/
static Grp_hdl *
-dlmopen_core(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
- uint_t flags, uint_t orig, int *in_nfavl)
+dlmopen_core(Lm_list *lml, Lm_list *olml, const char *path, int mode,
+ Rt_map *clmp, uint_t flags, uint_t orig, int *in_nfavl)
{
Alist *palp = NULL;
Rt_map *nlmp;
Grp_hdl *ghp;
Aliste olmco, nlmco;
- Lm_cntl *lmc;
DBG_CALL(Dbg_file_dlopen(clmp,
(path ? path : MSG_ORIG(MSG_STR_ZERO)), in_nfavl, mode));
@@ -675,15 +673,14 @@ dlmopen_core(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
}
/*
- * Create a new link-map control list for this request, and load the
+ * Establish a link-map control list for this request, and load the
* associated object.
*/
- if ((lmc = alist_append(&lml->lm_lists, 0, sizeof (Lm_cntl),
- AL_CNT_LMLISTS)) == NULL) {
+ if ((nlmco = create_cntl(lml, 1)) == NULL) {
remove_plist(&palp, 1);
return (NULL);
}
- olmco = nlmco = (Aliste)((char *)lmc - (char *)lml->lm_lists);
+ olmco = nlmco;
nlmp = load_one(lml, nlmco, palp, clmp, mode, (flags | FLG_RT_HANDLE),
&ghp, in_nfavl);
@@ -726,13 +723,15 @@ dlmopen_core(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
* If the dlopen has failed, clean up any objects that might have been
* loaded successfully on this new link-map control list.
*/
- if ((nlmp == NULL) && olmco)
+ if (olmco && (nlmp == NULL))
remove_lmc(lml, clmp, olmco, path);
/*
- * Finally, remove any link-map control list that was created.
+ * Finally, remove any temporary link-map control list. Note, if this
+ * operation successfully established a new link-map list, then a base
+ * link-map control list will have been created, which must remain.
*/
- if (olmco)
+ if (olmco && ((nlmp == NULL) || (olml != (Lm_list *)LM_ID_NEWLM)))
remove_cntl(lml, olmco);
return (ghp);
@@ -775,6 +774,7 @@ Grp_hdl *
dlmopen_intn(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
uint_t flags, uint_t orig)
{
+ Lm_list *olml = lml;
Rt_map *dlmp = NULL;
Grp_hdl *ghp;
int in_nfavl = 0;
@@ -825,7 +825,7 @@ dlmopen_intn(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
/*
* Open the required object on the associated link-map list.
*/
- ghp = dlmopen_core(lml, path, mode, clmp, flags, orig, &in_nfavl);
+ ghp = dlmopen_core(lml, olml, path, mode, clmp, flags, orig, &in_nfavl);
/*
* If the object could not be found it is possible that the "not-found"
@@ -837,7 +837,8 @@ dlmopen_intn(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
avl_tree_t *oavlt = nfavl;
nfavl = NULL;
- ghp = dlmopen_core(lml, path, mode, clmp, flags, orig, NULL);
+ ghp = dlmopen_core(lml, olml, path, mode, clmp, flags, orig,
+ NULL);
/*
* If the file is found, then its full path name will have been
diff --git a/usr/src/cmd/sgs/rtld/common/elf.c b/usr/src/cmd/sgs/rtld/common/elf.c
index 1777894109..e8d12ba4da 100644
--- a/usr/src/cmd/sgs/rtld/common/elf.c
+++ b/usr/src/cmd/sgs/rtld/common/elf.c
@@ -148,7 +148,8 @@ elf_fix_name(const char *name, Rt_map *clmp, Alist **alpp, Aliste alni,
DBG_CALL(Dbg_file_fixname(LIST(clmp), name,
MSG_ORIG(MSG_PTH_LIBSYS)));
- if ((pdp = alist_append(alpp, 0, sizeof (Pdesc), alni)) == NULL)
+ if ((pdp = alist_append(alpp, NULL, sizeof (Pdesc),
+ alni)) == NULL)
return (0);
pdp->pd_pname = (char *)MSG_ORIG(MSG_PTH_LIBSYS);
@@ -279,9 +280,8 @@ elf_verify(caddr_t addr, size_t size, Fdesc *fdp, const char *name,
if (elf_cap_check(fdp, ehdr, rej) == 0) {
Rt_map *lmp = lml_main.lm_head;
- if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) &&
- (lmp != NULL) && (FLAGS1(lmp) & FL1_RT_LDDSTUB) &&
- (NEXT(lmp) == NULL)) {
+ if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && lmp &&
+ (FLAGS1(lmp) & FL1_RT_LDDSTUB) && (NEXT(lmp) == NULL)) {
const char *fmt;
if (rej->rej_type == SGS_REJ_HWCAP_1)
@@ -356,7 +356,7 @@ elf_lazy_load(Rt_map *clmp, Slookup *slp, uint_t ndx, const char *sym,
int *in_nfavl)
{
Alist *palp = NULL;
- Rt_map *nlmp, *hlmp;
+ Rt_map *nlmp;
Dyninfo *dip = &DYNINFO(clmp)[ndx], *pdip;
uint_t flags = 0;
const char *name;
@@ -414,21 +414,12 @@ elf_lazy_load(Rt_map *clmp, Slookup *slp, uint_t ndx, const char *sym,
return (NULL);
/*
- * Provided the object on the head of the link-map has completed its
- * relocation, create a new link-map control list for this request.
+ * Establish a link-map control list for this request.
*/
- hlmp = lml->lm_head;
- if (FLAGS(hlmp) & FLG_RT_RELOCED) {
- Lm_cntl *lmc;
-
- if ((lmc = alist_append(&lml->lm_lists, 0, sizeof (Lm_cntl),
- AL_CNT_LMLISTS)) == NULL) {
- remove_plist(&palp, 1);
- return (NULL);
- }
- lmco = (Aliste)((char *)lmc - (char *)lml->lm_lists);
- } else
- lmco = ALIST_OFF_DATA;
+ if ((lmco = create_cntl(lml, 0)) == NULL) {
+ remove_plist(&palp, 1);
+ return (NULL);
+ }
/*
* Load the associated object.
@@ -463,7 +454,7 @@ elf_lazy_load(Rt_map *clmp, Slookup *slp, uint_t ndx, const char *sym,
remove_lmc(lml, clmp, lmco, name);
/*
- * Finally, remove any link-map control list that was created.
+ * Remove any temporary link-map control list.
*/
if (lmco != ALIST_OFF_DATA)
remove_cntl(lml, lmco);
@@ -952,16 +943,11 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx,
const char *dir = pdp->pd_pname;
Aliste lmco;
- if (FLAGS(lml->lm_head) & FLG_RT_RELOCED) {
- Lm_cntl *lmc;
-
- if ((lmc = alist_append(&lml->lm_lists, 0,
- sizeof (Lm_cntl), AL_CNT_LMLISTS)) == NULL)
- return (NULL);
- lmco = (Aliste)((char *)lmc -
- (char *)lml->lm_lists);
- } else
- lmco = ALIST_OFF_DATA;
+ /*
+ * Establish a link-map control list for this request.
+ */
+ if ((lmco = create_cntl(lml, 0)) == NULL)
+ return (NULL);
/*
* Determine the hardware capability filtees. If none
@@ -996,7 +982,8 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx,
/*
* Now that any hardware capability objects have been
- * processed, remove any link-map control list.
+ * processed, remove any temporary link-map control
+ * list.
*/
if (lmco != ALIST_OFF_DATA)
remove_cntl(lml, lmco);
@@ -1075,21 +1062,11 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx,
continue;
/*
- * Establish a new link-map control list from
- * which to analyze any newly added objects.
+ * Establish a link-map control list for this
+ * request.
*/
- if (FLAGS(lml->lm_head) & FLG_RT_RELOCED) {
- Lm_cntl *lmc;
-
- if ((lmc =
- alist_append(&lml->lm_lists, 0,
- sizeof (Lm_cntl),
- AL_CNT_LMLISTS)) == NULL)
- return (NULL);
- lmco = (Aliste)((char *)lmc -
- (char *)lml->lm_lists);
- } else
- lmco = ALIST_OFF_DATA;
+ if ((lmco = create_cntl(lml, 0)) == NULL)
+ return (NULL);
/*
* Locate and load the filtee.
@@ -1172,8 +1149,7 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx,
remove_lmc(lml, clmp, lmco, name);
/*
- * Remove any link-map control list that was
- * created.
+ * Remove any temporary link-map control list.
*/
if (lmco != ALIST_OFF_DATA)
remove_cntl(lml, lmco);
@@ -1873,15 +1849,14 @@ elf_new_lmp(Lm_list *lml, Aliste lmco, Fdesc *fdp, Addr addr, size_t msize,
* dynamic objects that require an interpretor
* (ie. all dynamic executables and some shared
* objects), and provide for a hand-shake with
- * debuggers. This entry is initialized to
- * zero by the link-editor. If a debugger has
- * us and updated this entry set the debugger
- * flag, and finish initializing the debugging
- * structure (see setup() also). Switch off any
- * configuration object use as most debuggers
- * can't handle fixed dynamic executables as
- * dependencies, and we can't handle requests
- * like object padding for alternative objects.
+ * old debuggers. This entry is initialized to
+ * zero by the link-editor. If a debugger is
+ * monitoring us, and has updated this entry,
+ * set the debugger monitor flag, and finish
+ * initializing the debugging structure. See
+ * setup(). Also, switch off any configuration
+ * object use as most debuggers can't handle
+ * fixed dynamic executables as dependencies.
*/
if (dyn->d_un.d_ptr)
rtld_flags |=
@@ -2037,7 +2012,7 @@ elf_new_lmp(Lm_list *lml, Aliste lmco, Fdesc *fdp, Addr addr, size_t msize,
* may provide thread_init, and another
* structure may provide atexit reservations.
*/
- if ((rti = alist_append(&lml->lm_rti, 0,
+ if ((rti = alist_append(&lml->lm_rti, NULL,
sizeof (Rti_desc),
AL_CNT_RTLDINFO)) == NULL) {
remove_so(0, lmp);
@@ -2619,8 +2594,7 @@ elf_lazy_find_sym(Slookup *slp, Rt_map **_lmp, uint_t *binfo, int *in_nfavl)
continue;
sl.sl_imap = nlmp;
- if (sym = LM_LOOKUP_SYM(sl.sl_cmap)(&sl, _lmp,
- binfo, in_nfavl))
+ if (sym = lookup_sym(&sl, _lmp, binfo, in_nfavl))
break;
/*
diff --git a/usr/src/cmd/sgs/rtld/common/external.c b/usr/src/cmd/sgs/rtld/common/external.c
index 3681d938e5..709918c7b3 100644
--- a/usr/src/cmd/sgs/rtld/common/external.c
+++ b/usr/src/cmd/sgs/rtld/common/external.c
@@ -471,6 +471,20 @@ rt_thr_init(Lm_list *lml)
leave(NULL, thr_flg_reenter);
(*fptr)();
(void) enter(thr_flg_reenter);
+
+ /*
+ * If this is an alternative link-map list, and this is the
+ * first call to initialize threads, don't let the destination
+ * libc be deleted. It is possible that an auditors complete
+ * initialization fails, but there is presently no main link-map
+ * list. As this libc has established the thread pointer, don't
+ * delete this libc, otherwise the initialization of libc on the
+ * main link-map can be compromised during its threads
+ * initialization.
+ */
+ if (((lml->lm_flags & LML_FLG_BASELM) == 0) &&
+ ((rtld_flags2 & RT_FL2_PLMSETUP) == 0))
+ MODE(lml->lm_lcs[CI_THRINIT].lc_lmp) |= RTLD_NODELETE;
}
}
diff --git a/usr/src/cmd/sgs/rtld/common/object.c b/usr/src/cmd/sgs/rtld/common/object.c
index aea56e4d2d..cc2d633424 100644
--- a/usr/src/cmd/sgs/rtld/common/object.c
+++ b/usr/src/cmd/sgs/rtld/common/object.c
@@ -231,9 +231,8 @@ elf_obj_fini(Lm_list *lml, Rt_map *lmp, int *in_nfavl)
* they are appropriate for this platform.
*/
if ((ofl->ofl_hwcap_1) && (hwcap_check(ofl->ofl_hwcap_1, &rej) == 0)) {
- if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) &&
- (lmp != NULL) && (FLAGS1(lmp) & FL1_RT_LDDSTUB) &&
- (NEXT(lmp) == NULL)) {
+ if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && lmp &&
+ (FLAGS1(lmp) & FL1_RT_LDDSTUB) && (NEXT(lmp) == NULL)) {
(void) printf(MSG_INTL(MSG_LDD_GEN_HWCAP_1),
ofl->ofl_name, rej.rej_str);
}
@@ -241,9 +240,8 @@ elf_obj_fini(Lm_list *lml, Rt_map *lmp, int *in_nfavl)
}
if ((ofl->ofl_sfcap_1) && (sfcap_check(ofl->ofl_sfcap_1, &rej) == 0)) {
- if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) &&
- (lmp != NULL) && (FLAGS1(lmp) & FL1_RT_LDDSTUB) &&
- (NEXT(lmp) == NULL)) {
+ if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && lmp &&
+ (FLAGS1(lmp) & FL1_RT_LDDSTUB) && (NEXT(lmp) == NULL)) {
(void) printf(MSG_INTL(MSG_LDD_GEN_SFCAP_1),
ofl->ofl_name, rej.rej_str);
}
diff --git a/usr/src/cmd/sgs/rtld/common/paths.c b/usr/src/cmd/sgs/rtld/common/paths.c
index d754563d58..14e7d5b70b 100644
--- a/usr/src/cmd/sgs/rtld/common/paths.c
+++ b/usr/src/cmd/sgs/rtld/common/paths.c
@@ -53,7 +53,7 @@ set_dirs(Alist **alpp, Spath_defn *sdp, uint_t flags)
while (sdp->sd_name) {
Pdesc *pdp;
- if ((pdp = alist_append(alpp, 0, sizeof (Pdesc),
+ if ((pdp = alist_append(alpp, NULL, sizeof (Pdesc),
AL_CNT_SPATH)) == NULL)
return;
@@ -1057,7 +1057,8 @@ expand_paths(Rt_map *clmp, const char *list, Alist **alpp, Aliste alni,
/*
* Create a new pathname descriptor.
*/
- if ((pdp = alist_append(alpp, 0, sizeof (Pdesc), alni)) == NULL)
+ if ((pdp = alist_append(alpp, NULL, sizeof (Pdesc),
+ alni)) == NULL)
return (0);
pdp->pd_pname = str;
diff --git a/usr/src/cmd/sgs/rtld/common/remove.c b/usr/src/cmd/sgs/rtld/common/remove.c
index e11c4d0444..7e978f1eb5 100644
--- a/usr/src/cmd/sgs/rtld/common/remove.c
+++ b/usr/src/cmd/sgs/rtld/common/remove.c
@@ -465,20 +465,18 @@ remove_lists(Rt_map *lmp, int lazy)
void
remove_cntl(Lm_list *lml, Aliste lmco)
{
- if (lmco && (lmco != ALIST_OFF_DATA)) {
- Aliste _lmco = lmco;
+ Aliste _lmco = lmco;
#if DEBUG
- Lm_cntl *lmc;
+ Lm_cntl *lmc;
- lmc = (Lm_cntl *)alist_item_by_offset(lml->lm_lists, lmco);
+ lmc = (Lm_cntl *)alist_item_by_offset(lml->lm_lists, lmco);
- /*
- * This element should be empty.
- */
- ASSERT(lmc->lc_head == NULL);
+ /*
+ * This element should be empty.
+ */
+ ASSERT(lmc->lc_head == NULL);
#endif
- alist_delete_by_offset(lml->lm_lists, &_lmco);
- }
+ alist_delete_by_offset(lml->lm_lists, &_lmco);
}
/*
@@ -1068,8 +1066,12 @@ remove_hdl(Grp_hdl *ghp, Rt_map *clmp, int *removed)
(GPD_FILTER | GPD_ADDEPS)) != GPD_FILTER)
continue;
- if (aplist_test(&lmalp, gdp->gd_depend, 0) ==
- ALE_EXISTS)
+ lmp = gdp->gd_depend;
+
+ if (FLAGS(lmp) & FLG_RT_DELETE)
+ continue;
+
+ if (aplist_test(&lmalp, lmp, 0) == ALE_EXISTS)
continue;
/*
@@ -1078,8 +1080,7 @@ remove_hdl(Grp_hdl *ghp, Rt_map *clmp, int *removed)
* that are candidates for deletion to continue this
* group verification.
*/
- DBG_CALL(Dbg_file_hdl_collect(ghp,
- NAME(gdp->gd_depend)));
+ DBG_CALL(Dbg_file_hdl_collect(ghp, NAME(lmp)));
aplist_delete(ghalp, &idx1);
free(lmalp);
@@ -1398,9 +1399,7 @@ remove_hdl(Grp_hdl *ghp, Rt_map *clmp, int *removed)
* sure the filtees reference count
* gets decremented.
*/
- if ((FLAGS(lmp) & FLG_RT_DELETE) &&
- ((gdp->gd_flags &
- GPD_PARENT) == 0)) {
+ if (FLAGS(lmp) & FLG_RT_DELETE) {
(void) dlclose_core(ghp,
lmp, lml);
}
diff --git a/usr/src/cmd/sgs/rtld/common/setup.c b/usr/src/cmd/sgs/rtld/common/setup.c
index 6ee1b9a56f..2e604f5041 100644
--- a/usr/src/cmd/sgs/rtld/common/setup.c
+++ b/usr/src/cmd/sgs/rtld/common/setup.c
@@ -73,14 +73,16 @@ void *_nd = &_end;
*/
static Interp _interp;
+/*
+ * LD_PRELOAD objects.
+ */
static int
-preload(const char *str, Rt_map *lmp)
+preload(const char *str, Rt_map *mlmp, Rt_map **clmp)
{
Alist *palp = NULL;
- Rt_map *clmp = lmp;
char *objs, *ptr, *next;
Word lmflags = lml_main.lm_flags;
- uint_t flags;
+ int lddstub;
DBG_CALL(Dbg_util_nl(&lml_main, DBG_NL_STD));
@@ -88,44 +90,76 @@ preload(const char *str, Rt_map *lmp)
return (0);
/*
- * Establish the flags for loading each object. If we're called via
- * lddstub, then the first shared object is the object being inspected
- * by ldd(1). This object should not be marked as an interposer, as
- * it is intended to act like the first object of the process.
+ * Determine if we've been called from lddstub.
*/
- if ((lmflags & LML_FLG_TRC_ENABLE) && (FLAGS1(lmp) & FL1_RT_LDDSTUB))
- flags = FLG_RT_PRELOAD;
- else
- flags = (FLG_RT_PRELOAD | FLG_RT_OBJINTPO);
+ lddstub = (lmflags & LML_FLG_TRC_ENABLE) &&
+ (FLAGS1(*clmp) & FL1_RT_LDDSTUB);
ptr = strtok_r(objs, MSG_ORIG(MSG_STR_DELIMIT), &next);
do {
Rt_map *nlmp = NULL;
+ uint_t flags;
DBG_CALL(Dbg_file_preload(&lml_main, ptr));
/*
+ * Establish the flags for loading each object. If we're
+ * called via lddstub, then the first preloaded object is the
+ * object being inspected by ldd(1). This object should not be
+ * marked as an interposer, as this object is intended to act
+ * as the target object of the process.
+ */
+ if (lddstub)
+ flags = FLG_RT_PRELOAD;
+ else
+ flags = (FLG_RT_PRELOAD | FLG_RT_OBJINTPO);
+
+ /*
* If this a secure application, then preload errors are
* reduced to warnings, as the errors are non-fatal.
*/
if (rtld_flags & RT_FL_SECURE)
rtld_flags2 |= RT_FL2_FTL2WARN;
- if (expand_paths(clmp, ptr, &palp, AL_CNT_NEEDED,
+ if (expand_paths(*clmp, ptr, &palp, AL_CNT_NEEDED,
PD_FLG_EXTLOAD, 0) != 0)
- nlmp = load_one(&lml_main, ALIST_OFF_DATA, palp, clmp,
- MODE(lmp), flags, 0, NULL);
+ nlmp = load_one(&lml_main, ALIST_OFF_DATA, palp, *clmp,
+ MODE(mlmp), flags, 0, NULL);
remove_plist(&palp, 0);
if (rtld_flags & RT_FL_SECURE)
rtld_flags2 &= ~RT_FL2_FTL2WARN;
- if (nlmp && (bind_one(clmp, nlmp, BND_NEEDED) == 0))
+ if (nlmp && (bind_one(*clmp, nlmp, BND_NEEDED) == 0))
nlmp = NULL;
+ if (lddstub && nlmp) {
+ lddstub = 0;
+
+ /*
+ * Fabricate a binding between the target shared object
+ * and lddstub so that the target object isn't called
+ * out from unused() processing.
+ */
+ if (lmflags &
+ (LML_FLG_TRC_UNREF | LML_FLG_TRC_UNUSED)) {
+ if (bind_one(*clmp, nlmp, BND_REFER) == 0)
+ nlmp = NULL;
+ }
+
+ /*
+ * By identifying lddstub as the caller, several
+ * confusing ldd() diagnostics get suppressed. These
+ * diagnostics would reveal how the target shared object
+ * was found from lddstub. Now that the real target is
+ * loaded, identify the target as the caller so that all
+ * ldd() diagnostics are enabled for subsequent objects.
+ */
+ if (nlmp)
+ *clmp = nlmp;
+ }
+
/*
- * Establish state for the next preloadable object. If no
- * error occurred with loading this object, indicate that this
- * link-map list contains an interposer.
+ * If no error occurred with loading this object, indicate that
+ * this link-map list contains an interposer.
*/
- flags |= FLG_RT_OBJINTPO;
if (nlmp == NULL) {
if ((lmflags & LML_FLG_TRC_ENABLE) ||
(rtld_flags & RT_FL_SECURE))
@@ -133,25 +167,8 @@ preload(const char *str, Rt_map *lmp)
else
return (0);
}
- lml_main.lm_flags |= LML_FLG_INTRPOSE;
-
- /*
- * If we're tracing shared objects via lddstub, establish a
- * binding between the initial shared object and lddstub so that
- * the shared object isn't called out from unused() processing.
- * After the first object is loaded increment the caller to the
- * initial preloaded object to provide intuitive ldd -v and -s
- * diagnostics
- */
- if ((lmflags & LML_FLG_TRC_ENABLE) &&
- (FLAGS1(lmp) & FL1_RT_LDDSTUB)) {
- if ((lmp == clmp) && (lmflags &
- (LML_FLG_TRC_UNREF | LML_FLG_TRC_UNUSED))) {
- if (bind_one(clmp, nlmp, BND_REFER) == 0)
- continue;
- }
- clmp = NEXT_RT_MAP(lmp);
- }
+ if (flags & FLG_RT_OBJINTPO)
+ lml_main.lm_flags |= LML_FLG_INTRPOSE;
} while ((ptr = strtok_r(NULL,
MSG_ORIG(MSG_STR_DELIMIT), &next)) != NULL);
@@ -167,7 +184,7 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz,
char *execname, char **argv, uid_t uid, uid_t euid, gid_t gid, gid_t egid,
void *aoutdyn, int auxflags, uint_t hwcap_1)
{
- Rt_map *rlmp, *mlmp, **tobj = NULL;
+ Rt_map *rlmp, *mlmp, *clmp, **tobj = NULL;
Ehdr *ehdr;
rtld_stat_t status;
int features = 0, ldsoexec = 0;
@@ -277,14 +294,14 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz,
/*
* Establish initial link-map list flags, and link-map list alists.
*/
- if (alist_append(&lml_main.lm_lists, 0, sizeof (Lm_cntl),
+ if (alist_append(&lml_main.lm_lists, NULL, sizeof (Lm_cntl),
AL_CNT_LMLISTS) == NULL)
return (0);
lml_main.lm_flags |= LML_FLG_BASELM;
lml_main.lm_lmid = LM_ID_BASE;
lml_main.lm_lmidstr = (char *)MSG_ORIG(MSG_LMID_BASE);
- if (alist_append(&lml_rtld.lm_lists, 0, sizeof (Lm_cntl),
+ if (alist_append(&lml_rtld.lm_lists, NULL, sizeof (Lm_cntl),
AL_CNT_LMLISTS) == NULL)
return (0);
lml_rtld.lm_flags |= (LML_FLG_RTLDLM | LML_FLG_NOAUDIT |
@@ -833,9 +850,12 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz,
* initialized. Once the debugging setup has completed, this local
* descriptor is copied to the global descriptor which effectively
* enables diagnostic output.
+ *
+ * Ignore any debugging request if we're being monitored by a process
+ * that expects the old getpid() initialization handshake.
*/
- if (rpl_debug || prm_debug) {
- Dbg_desc _dbg_desc = {0, 0, 0};
+ if ((rpl_debug || prm_debug) && ((rtld_flags & RT_FL_DEBUGGER) == 0)) {
+ Dbg_desc _dbg_desc = {0, 0, NULL};
if (rpl_debug) {
uintptr_t ret;
@@ -960,13 +980,19 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz,
}
/*
- * Map in any preloadable shared objects. Note, it is valid to preload
- * a 4.x shared object with a 5.0 executable (or visa-versa), as this
- * functionality is required by ldd(1).
+ * Map in any preloadable shared objects. Establish the caller as the
+ * head of the main link-map list. In the case of being exercised from
+ * lddstub, the caller gets reassigned to the first target shared object
+ * so as to provide intuitive diagnostics from ldd().
+ *
+ * Note, it is valid to preload a 4.x shared object with a 5.0
+ * executable (or visa-versa), as this functionality is required by
+ * ldd(1).
*/
- if (rpl_preload && (preload(rpl_preload, mlmp) == 0))
+ clmp = mlmp;
+ if (rpl_preload && (preload(rpl_preload, mlmp, &clmp) == 0))
return (0);
- if (prm_preload && (preload(prm_preload, mlmp) == 0))
+ if (prm_preload && (preload(prm_preload, mlmp, &clmp) == 0))
return (0);
/*
@@ -998,12 +1024,25 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz,
return (0);
/*
- * Inform the debuggers we're here and stable. Newer debuggers
- * can indicate their presence by setting the DT_DEBUG entry in
- * the dynamic executable (see elf_new_lm()). In this case call
- * getpid() so the debugger can catch the system call. This
- * handshake allows the debugger to initialize, and consequently
- * allows the user to set break points in .init code.
+ * Inform the debuggers that basic process initialization is
+ * complete, and that the state of ld.so.1 (link-map lists,
+ * etc.) is stable. This handshake enables the debugger to
+ * initialize themselves, and consequently allows the user to
+ * set break points in .init code.
+ *
+ * Most new debuggers use librtld_db to monitor activity events.
+ * Older debuggers indicated their presence by setting the
+ * DT_DEBUG entry in the dynamic executable (see elf_new_lm()).
+ * In this case, getpid() is called so that the debugger can
+ * catch the system call. This old mechanism has some
+ * restrictions, as getpid() should not be called prior to
+ * basic process initialization being completed. This
+ * restriction has become increasingly difficult to maintain,
+ * as the use of auditors, LD_DEBUG, and the initialization
+ * handshake with libc can result in "premature" getpid()
+ * calls. The use of this getpid() handshake is expected to
+ * disappear at some point in the future, and there is intent
+ * to work towards that goal.
*/
rd_event(&lml_main, RD_DLACTIVITY, RT_CONSISTENT);
rd_event(&lml_rtld, RD_DLACTIVITY, RT_CONSISTENT);
diff --git a/usr/src/cmd/sgs/rtld/common/util.c b/usr/src/cmd/sgs/rtld/common/util.c
index 36979f8b1b..931efc33b5 100644
--- a/usr/src/cmd/sgs/rtld/common/util.c
+++ b/usr/src/cmd/sgs/rtld/common/util.c
@@ -799,6 +799,7 @@ call_init(Rt_map **tobj, int flag)
for (_tobj = _nobj = tobj, _nobj++; *_tobj != NULL; _tobj++, _nobj++) {
Rt_map *lmp = *_tobj;
void (*iptr)() = INIT(lmp);
+ uint_t rtldflags;
if (FLAGS(lmp) & FLG_RT_INITCALL)
continue;
@@ -806,6 +807,17 @@ call_init(Rt_map **tobj, int flag)
FLAGS(lmp) |= FLG_RT_INITCALL;
/*
+ * It is possible, that during the initial handshake with libc,
+ * an interposition object has resolved a symbol binding, and
+ * that this objects .init must be fired. As we're about to
+ * run user code, make sure any dynamic linking errors remain
+ * internal (ie., only obtainable from dlerror()), and are not
+ * flushed to stderr.
+ */
+ rtldflags = (rtld_flags & RT_FL_APPLIC) ? 0 : RT_FL_APPLIC;
+ rtld_flags |= rtldflags;
+
+ /*
* Establish an initfirst state if necessary - no other inits
* will be fired (because of additional relocation bindings)
* when in this state.
@@ -829,6 +841,11 @@ call_init(Rt_map **tobj, int flag)
DBG_CALL(Dbg_util_call_init(lmp, DBG_INIT_DONE));
/*
+ * Return to a non-application setting if necessary.
+ */
+ rtld_flags &= ~rtldflags;
+
+ /*
* Set the initdone flag regardless of whether this object
* actually contains an .init section. This flag prevents us
* from processing this section again for an .init and also
@@ -1342,6 +1359,47 @@ lm_move(Lm_list *lml, Aliste nlmco, Aliste plmco, Lm_cntl *nlmc, Lm_cntl *plmc)
}
/*
+ * Create, or assign a link-map control list. Each link-map list contains a
+ * main control list, which has an Alist offset of ALIST_OFF_DATA (see the
+ * description in include/rtld.h). During the initial construction of a
+ * process, objects are added to this main control list. This control list is
+ * never deleted, unless an alternate link-map list has been requested (say for
+ * auditors), and the associated objects could not be loaded or relocated.
+ *
+ * Once relocation has started, any lazy loadable objects, or filtees, are
+ * processed on a new, temporary control list. Only when these objects have
+ * been fully relocated, are they moved to the main link-map control list.
+ * Once the objects are moved, this temporary control list is deleted (see
+ * remove_cntl()).
+ *
+ * A dlopen() always requires a new temporary link-map control list.
+ * Typically, a dlopen() occurs on a link-map list that had already started
+ * relocation, however, auditors can dlopen() objects on the main link-map
+ * list while under initial construction, before any relocation has begun.
+ * Hence, dlopen() requests are explicitly flagged.
+ */
+Aliste
+create_cntl(Lm_list *lml, int dlopen)
+{
+ /*
+ * If the head link-map object has already been relocated, create a
+ * new, temporary, control list.
+ */
+ if (dlopen || (lml->lm_head == NULL) ||
+ (FLAGS(lml->lm_head) & FLG_RT_RELOCED)) {
+ Lm_cntl *lmc;
+
+ if ((lmc = alist_append(&lml->lm_lists, NULL, sizeof (Lm_cntl),
+ AL_CNT_LMLISTS)) == NULL)
+ return (NULL);
+
+ return ((Aliste)((char *)lmc - (char *)lml->lm_lists));
+ }
+
+ return (ALIST_OFF_DATA);
+}
+
+/*
* Environment variables can have a variety of defined permutations, and thus
* the following infrastructure exists to allow this variety and to select the
* required definition.
@@ -1477,12 +1535,7 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
* Replaceable and permanent audit objects can exist.
*/
select |= SEL_ACT_STR;
- if (select & SEL_REPLACE)
- str = &rpl_audit;
- else {
- str = &prm_audit;
- rpl_audit = 0;
- }
+ str = (select & SEL_REPLACE) ? &rpl_audit : &prm_audit;
variable = ENV_FLG_AUDIT;
} else if ((len == MSG_LD_AUDIT_ARGS_SIZE) &&
(strncmp(s1, MSG_ORIG(MSG_LD_AUDIT_ARGS),
@@ -1566,12 +1619,7 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
if ((len == MSG_LD_DEBUG_SIZE) && (strncmp(s1,
MSG_ORIG(MSG_LD_DEBUG), MSG_LD_DEBUG_SIZE) == 0)) {
select |= SEL_ACT_STR;
- if (select & SEL_REPLACE)
- str = &rpl_debug;
- else {
- str = &prm_debug;
- rpl_debug = 0;
- }
+ str = (select & SEL_REPLACE) ? &rpl_debug : &prm_debug;
variable = ENV_FLG_DEBUG;
} else if ((len == MSG_LD_DEBUG_OUTPUT_SIZE) && (strncmp(s1,
MSG_ORIG(MSG_LD_DEBUG_OUTPUT),
@@ -1595,12 +1643,8 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
if ((len == MSG_LD_FLAGS_SIZE) && (strncmp(s1,
MSG_ORIG(MSG_LD_FLAGS), MSG_LD_FLAGS_SIZE) == 0)) {
select |= SEL_ACT_SPEC_1;
- if (select & SEL_REPLACE)
- str = &rpl_ldflags;
- else {
- str = &prm_ldflags;
- rpl_ldflags = 0;
- }
+ str = (select & SEL_REPLACE) ? &rpl_ldflags :
+ &prm_ldflags;
variable = ENV_FLG_FLAGS;
}
}
@@ -1622,12 +1666,8 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
if ((len == MSG_LD_LIBPATH_SIZE) && (strncmp(s1,
MSG_ORIG(MSG_LD_LIBPATH), MSG_LD_LIBPATH_SIZE) == 0)) {
select |= SEL_ACT_SPEC_1;
- if (select & SEL_REPLACE)
- str = &rpl_libpath;
- else {
- str = &prm_libpath;
- rpl_libpath = 0;
- }
+ str = (select & SEL_REPLACE) ? &rpl_libpath :
+ &prm_libpath;
variable = ENV_FLG_LIBPATH;
} else if ((len == MSG_LD_LOADAVAIL_SIZE) && (strncmp(s1,
MSG_ORIG(MSG_LD_LOADAVAIL), MSG_LD_LOADAVAIL_SIZE) == 0)) {
@@ -1730,12 +1770,8 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
if ((len == MSG_LD_PRELOAD_SIZE) && (strncmp(s1,
MSG_ORIG(MSG_LD_PRELOAD), MSG_LD_PRELOAD_SIZE) == 0)) {
select |= SEL_ACT_STR;
- if (select & SEL_REPLACE)
- str = &rpl_preload;
- else {
- str = &prm_preload;
- rpl_preload = 0;
- }
+ str = (select & SEL_REPLACE) ? &rpl_preload :
+ &prm_preload;
variable = ENV_FLG_PRELOAD;
} else if ((len == MSG_LD_PROFILE_SIZE) && (strncmp(s1,
MSG_ORIG(MSG_LD_PROFILE), MSG_LD_PROFILE_SIZE) == 0)) {
@@ -1871,10 +1907,8 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
*/
if (env_flags & ENV_TYP_ISA) {
/*
- * This is ISA setting. We do the setting
- * even if s2 is NULL.
- * If s2 is NULL, we might need to undo
- * the setting.
+ * This is an ISA setting. We do the setting even if s2 is
+ * NULL. If s2 is NULL, we might need to undo the setting.
*/
if (select & SEL_REPLACE) {
if (rplisa & variable)
@@ -1885,7 +1919,7 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
}
} else if (s2) {
/*
- * This is non0-ISA setting
+ * This is a non-ISA setting.
*/
if (select & SEL_REPLACE) {
if (rplgen & variable)
@@ -1895,8 +1929,7 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
prmgen |= variable;
} else
/*
- * This is non-ISA setting which
- * can be ignored.
+ * This is a non-ISA setting which can be ignored.
*/
return;
@@ -2011,7 +2044,7 @@ ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,
*lmflags |= LML_FLG_TRC_LDDSTUB;
} else
*lmflags &=
- ~(LML_FLG_TRC_ENABLE|LML_FLG_TRC_LDDSTUB);
+ ~(LML_FLG_TRC_ENABLE | LML_FLG_TRC_LDDSTUB);
}
}
}
diff --git a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c
index dca4ca14d6..b3108bdd63 100644
--- a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c
+++ b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c
@@ -51,6 +51,7 @@ static const mdb_bitmask_t rtflags_bits[] = {
{ MSG_ORIG(MSG_FLG_SETGROUP), FLG_RT_SETGROUP, FLG_RT_SETGROUP},
{ MSG_ORIG(MSG_FLG_HWCAP), FLG_RT_HWCAP, FLG_RT_HWCAP},
{ MSG_ORIG(MSG_FLG_OBJECT), FLG_RT_OBJECT, FLG_RT_OBJECT},
+ { MSG_ORIG(MSG_FLG_NEWLOAD), FLG_RT_NEWLOAD, FLG_RT_NEWLOAD},
{ MSG_ORIG(MSG_FLG_NODUMP), FLG_RT_NODUMP, FLG_RT_NODUMP},
{ MSG_ORIG(MSG_FLG_DELETE), FLG_RT_DELETE, FLG_RT_DELETE},
{ MSG_ORIG(MSG_FLG_ANALYZED), FLG_RT_ANALYZED, FLG_RT_ANALYZED},
diff --git a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg
index 2fedbb267f..597316816c 100644
--- a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg
+++ b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg
@@ -66,6 +66,7 @@
@ MSG_FLG_SETGROUP "SET-GROUP"
@ MSG_FLG_HWCAP "HWCAP"
@ MSG_FLG_OBJECT "OBJECT"
+@ MSG_FLG_NEWLOAD "NEWLOAD"
@ MSG_FLG_NODUMP "NODUMP"
@ MSG_FLG_DELETE "DELETE"
@ MSG_FLG_ANALYZED "ANALYZED"