diff options
| author | Rod Evans <Rod.Evans@Sun.COM> | 2009-04-10 13:45:29 -0700 |
|---|---|---|
| committer | Rod Evans <Rod.Evans@Sun.COM> | 2009-04-10 13:45:29 -0700 |
| commit | dde769a2c00c82faaf80563ddd5610de2f4da339 (patch) | |
| tree | 1c1aa17faaee1d823ca6489db681459e6bb399f4 /usr/src/cmd/sgs/rtld/common/debug.c | |
| parent | 983a10335731bc55a0b7a37f195575fa109e30d4 (diff) | |
| download | illumos-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/rtld/common/debug.c')
| -rw-r--r-- | usr/src/cmd/sgs/rtld/common/debug.c | 21 |
1 files changed, 9 insertions, 12 deletions
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); |
