It addresses a number of problems that were present in earlier
versions.
The calls to the "init" and "fini" functions of shared libraries
have been reordered, so that they are called in a strictly nested
fashion, as is required for C++ constructors and destructors. In
addition, the "init" functions are called in better order relative
to each other. That makes the system more tolerant of C++ programs
which depend on a library's being initialized before its clients.
The dynamic linker is now more tolerant of shared libraries in
which dependencies on other shared libraries are incompletely
recorded.
Cleanup in the event of errors has been improved throughout the
dynamic linker. A number of memory leaks were eliminated.
The warning message for a shared library whose minor version number
is too old has been clarified.
The code dealing with the "ld.so.hints" file has been cleaned up.
A bug that caused the hints file to be unmapped incompletely has
been fixed. A different bug that could potentially cause the hints
file to be mapped on top of a loaded object has been fixed.
The code that searches for shared libraries has been cleaned up.
The searching is now more compatible with that done by SunOS and
SVR4. Also, some unnecessary and useless searches of both the
hints file and library directories have been eliminated.
Reviewed by: nate@freebsd.org
on a failure, but if we're checking a corrupt map we could also get back
a zero from ypserv without really encountering any actual error. Flag this
condition and generate an meaningful error message.
- Fix transmission of ypxfr_clear to ypserv: error checking was wrong
and we sending YPXFR_YPERR as an error status instead of YPXFR_CLEAR.
- To help avoid a race condition (or at least reduce the likelyhood of
it occuring), use rename() to move a newly transfered map into place
instead of unlink()ing the old one first and then renaming. Da man page
sez that rename should do the unlink() for us. This prevents ypserv
from returning 'no such map in domain' when asked to query a map which
ypxfr has just unlink()ed but not yet replaced.
- Fix a SEGV condition in ypxfr_main.c that reared its ugly head while I
was working on the 'parallel jobs' feature of the new yppush. After we've
completed the map transfer and created a local temporary copy, we check
the order number of the map on ypserv again to make sure it didn't change
while the transfer was in progress (map skew). If for some reason we flat
out fail to get the order number from the server, we flag this as an
error and bail, telling ypxfr_exit() to clean up our temporary files
for us. However, ypxfr_exit() tries to close the database before unkining
it, not realizing that it has already been closed prior to the skew check.
The second attempt to close the database causes a SEGV somewhere inside
the DB code.
(Well, it does on my 2.0.5 machine anyway. I haven't seen anyone modify
the DB library code in ages, so the condition is probably still there.)
To work around this, we deliberately set dbp to NULL after closing the
database and check for the condition in ypxfr_exit(), being careful to
avoid the second close if we see the NULL.
- In yp_dbwrite.c, make yp_open_db_rw() open the database with O_EXLOCK
flag set. This probably won't affect much of anything, but I feel better
having it there.
to the old one, except that it supports an additional option (-p path)
that lets you specify the top level path wiere your NIS maps live.
(ypserv allows you to specify a path like this, so it makes sense that
ypxfr should too. ypserv will automagically pass the -p flag to ypxfr
if you use a path other than /var/yp when you start it.)
This program uses client stub code generated by rpcgen as well as
the yp_dblookup.c module from ypserv.
vector. Now it is called the "symbol caching" vector. This was made
possible and unconfusing by other changes that allowed me to localize
everything having to do with the caching vector in the function
reloc_map().
Switched to alloca() for allocating the caching vector, and eliminated
the special mmap-based allocation routines. Although this was motivated
by performance reasons, it led to significant simplification of the
code, and made it possible to confine the symbol caching code to the
single function reloc_map().
Got rid of the unnecessary and inefficient division loop at the
beginning of rtld().
Reduced the number of calls to getenv("LD_LIBRARY_PATH") to just 1, on
suggestion from <davidg@root.com>.
Added breaks out of the relocation loops when the relocation address is
found to be 0. A relocation address of 0 is caused by an unused
relocation entry. Unused relocation entries are caused by linking a
shared object with the "-Bsymbolic" switch. The runtime linker itself
is linked that way, and the last 40% of its relocation entries are
unused. Thus, breaking out of the loop on the first such entry is a
performance win when ld.so relocates itself. As a side benefit, it
permits removing a test from md_relocate_simple() in
../i386/md-static-funcs.c.
Unused relocation entries in other shared objects (linked with
"-Bsymbolic") caused even bigger problems in previous versions of the
runtime linker. The runtime linker interpreted the unused entries as if
they were valid. That caused it to perform repeated relocations of the
first byte of the shared object. In order to do that, it had to remap
the text segment writable. Breaking out of the loop on the first unused
relocation entry solves that.
Submitted by: John Polstra <jdp@polstra.com>
program parses the /etc/netgroup file into netgroup.byuser and netgroup.byhost
format for NIS.
I used hash tables to store the initial netgroup data in memory and to
construct the 'reverse' netgroup output. It seems just as fast as the
SunOS revnetgroup, which is surprising considering this is my first
attempt at using hash tables in a real application. :)
Note that I canibalized a large chunk of getnetgrent.c to save myself
from having to write my own netgroup parsing functions.
Implemented symbol memorizing to reduce the number of calls to lookup(),
making relocation go faster. While relocating a given shared object,
the dynamic linker maintains a memorizing vector that is directly
indexed by the symbol number in the relocation entry. The first time a
given symbol is looked up, the memorizing vector is filled in with a
pointer to the symbol table entry, and a pointer to the so_map of the
shared object in which the symbol was defined. On subsequent uses of
the same symbol, that information is retrieved directly from the
memorizing vector, without calling lookup() again.
A symbol that is referenced in a relocation entry is typically
referenced in many relocation entries, so this memorizing reduces the
number of calls to lookup() dramatically. The overall improvement in
the speed of dynamic linking is also dramatic -- as much as a factor of
three for programs that use many shared libaries.
Submitted by: jdp@polstra.com "John Polstra"
Kerberos obtains a network address for the local host from the routing
tables and uses it consistently for all Kerberos transactions. This ensures
that packets only leave the *authenticated* interface. Clients who open
and use their own sockets for encrypted or authenticated correspondance
to kerberos services should bind their sockets to the same address as that
used by kerberos. krb_get_local_addr() and krb_bind_local_addr() allow
clients to obtain the local address or bind a socket to the local address
used by Kerberos respectively.
Reviewed by: Mark Murray <markm>, Garrett Wollman <wollman>
Obtained from: concept by Dieter Dworkin Muller <dworkin@village.org>
shared library. Formerly, the message looked like this:
ld.so: run: libjdp1.so.1.0: Undefined error: 0
The new message looks like this:
ld.so: run: Can't find shared library "libjdp1.so.1.0"
(Where "run" is the name of the program being executed.)
Submitted by: jdp@polstra.com (John Polstra)
symbols.
An easy example to see this is to develop an X program which links
against Xt, but doesn't add -lX11 to the link line. It will link fine,
but cause run-time errors by ld.so because of missing symbols used by Xt
defined in X11. This patch makes the errors more readable.
Submitted by: jdp@polstra.com (John Polstra)
were chopped off of the function call and garbage was passed instead.
The solution involves making some variable globals as well as fixing the
call to have all the arguments.
specified in the top level Makefiles.
Previously I missed dozens of Makefiles that skip the install after
using `cmp -s' to decide that the install isn't necessary.
I get on this topic will go straight to /dev/null. This is absolutely the
last word on this topic you'll see from me. Too much time has already been
wasted.
on dlclose. Also correctly call constructors and destructors for libraries
linked with /usr/lib/c++rt0.o.
Change interpretation of dlopen manpage to call _init() rather than init()
for dlopened objects.
Change c++rt0.o to avoid using atexit to call destructors, allowing dlclose to
call destructors when an object is unloaded.
Change interface between crt0 and ld.so to allow crt0 to call a function on
exit to call destructors for shared libraries explicitly.
These changes are backwards compatible. Old binaries will work with the new
ld.so and new binaries will work with the old ld.so. A version number has
been introduced in the crt0-ld.so interface to allow for future changes.
Reviewed by: GAWollman, Craig Struble <cstruble@singularity.bevc.blacksburg.va.us>
causes some clients that do not support linemode to mis-interpret the return
key (i.e. double returns).
The fix is to only do the state check for binary options if linemode will
be used.
Closes PR#505.
Submitted by: Charles Henrich
- set TCP_NOPUSH to keep from sending short packets at each write(2) boundary
- set SO_SNDBUF to 64k so we have a reasonable amount of buffer space
- for a regular file in binary mode which is not being restarted and is
. smaller than 16 Meg, use mmap(2) and write(2) the whole file in one big
gulp
In the most common circumstances, this should dramatically reduce the
system-call load from ftpd, since the call to write() will not return until
the entire file has been written, rather than writing just a few K at a time
in a loop.
Change the library order so libcrypt is the last library in the list.
libskey contains references to _crypt and can't resolve it unless
-lcrypt occurs after it in the link command. This only occurs when
linking statically.
libskey contains references to _crypt and can't resolve it unless
-lcrypt occurs after it in the link command. This only occurs when
linking statically.
NetBSD ld code except for local changes for dlopen() and friends and
the hashing on the minor value of the shlibs. We should be binary
compatible now with all their libraries.
Obtained from: NetBSD
misfeature caused troubles when a program attempted to access a shlib
where one with a higher minor number has been hashed. Ldconfig does
only include the highest-numbered shlib anyway, so this is in no way a
limitation of generality.
Caution: after installing the new programs, your /var/run/ld.so.hints
needs to be rebuiult; run ldconfig again as it's done from /etc/rc.
warning handling and allows for link-time warnings with a modified
version of gas.
Note: Not all of the newer bits were updated such as some of the non-x86
machine-dependant code is relevant to FreeBSD right now.
Obtained from: NetBSD
I know that many of these entries are bogus and need to be revisited,
but let's get the tree working again for now and then do a pass through
looking at all the __FreeBSD__ entries, shall we?
(as is printing out a version number at the telnet login banner).
Don't print out /etc/motd when people login, instead if present,
print out /etc/ftpmotd. It looks like 4.4lite2 has done something similar
(perhaps for different reasons) because /etc/motd no longer shows up
on vangogh.
Folks who like the old behavior can create a symbolic link to motd.
- Get rid of inverse logic (NOKERBEROS and NOEBONES) in src/makefile,
and replace with MAKE_KERBEROS and MAKE_EBONES. (Far fewer contortions,
and both default to off.) IF YOU WANT KERBEROS, YOU HAVE TO EXPLICITLY
DEFINE ONE OF THESE.
- Make Makefiles kerberos-aware.
Rexecd is a crock, it never should have been written, however make it so
that people who have a need to run it don't hurt themselves so badly.
Obtained from: Ideas obtained from logdaemon 4.3 from Wietse Venema
rpc files and other cruft. It's not important enough to have it in the
source distribution and I don't feel comfortable with this, as it's below
the standards of CSRG.
Disable & remove pcnfsd. Either I'll rewrite this so it can all be
generated with rpcgen or stuff it in ports and let it rot there.
/usr/libexec/getty doesn't properly interpret the '%d' escape. It tries
to use %P to get AM or PM, but instead all it gets is "P".
Submitted by: John Kohl
completely when ldconfig unlinks it. If init is shared, then the
referenced unlinked copy of the hints file created by running
ldconfig in /etc/rc caused the file system to be unclean after
every reboot.
automagically. -lfoo has to be right to work, but ${LIBFO0} is too
easy to forget or misspell; nothing checks it and it should be
different for shared libraries.