| Commit message (Expand) | Author | Age | Files | Lines |
| * | make dynamic linker depend on -DSHARED not -fPIC•••if libc.a is compiled PIC for use in static PIE code, this should not
cause the dynamic linker (which still does not support static-linked
main program) to be built into libc.a.
| Rich Felker | 2012-07-11 | 1 | -1/+1 |
| * | fix lots of breakage on dlopen, mostly with explicit pathnames•••most importantly, the name for such libs was being set from an
uninitialized buffer. also, shortname always had an initial '/'
character, making it useless for looking up already-loaded libraries
by name, and thus causing repeated searches through the library path.
major changes now:
- shortname is the base name for library lookups with no explicit
pathname. it's initially clear for libraries loaded with an explicit
pathname (and for the main program), but will be set if the same
library (detected via inodes match) is later found by a search.
- exact name match is never used to identify libraries loaded with an
explicit pathname. in this case, there's no explicit search, so we
can just stat the file and check for inode match.
| Rich Felker | 2012-07-11 | 1 | -14/+21 |
| * | fix dlsym RTLD_NEXT support•••previously this was being handled the same as a library-specific,
dependency-order lookup on the next library in the global chain, which
is likely to be utterly meaningless. instead the lookup needs to be in
the global namespace, but omitting the initial portion of the global
library chain up through the calling library.
| Rich Felker | 2012-07-07 | 1 | -1/+3 |
| * | fix char signedness bug (arm-specific) in dynamic linker | Rich Felker | 2012-06-09 | 1 | -1/+1 |
| * | treat failure of mprotect in map_library as a fatal load failure•••the error will propagate up and be printed to the user at program
start time; at runtime, dlopen will just fail and leave a message for
dlerror.
previously, if mprotect failed, subsequent attempts to perform
relocations would crash the program. this was resulting in an
increasing number of false bug reports on grsec systems where rwx
permission is not possible in cases where users were wrongly
attempting to use non-PIC code in shared libraries. supporting that
usage is in theory possible, but the x86_64 toolchain does not even
support textrels, and the cost of keeping around the necessary
information to handle textrels without rwx permissions is
disproportionate to the benefit (which is essentially just supporting
broken library setups on grsec machines).
also, i unified the error-out code in map_library now that there are 3
places from which munmap might have to be called.
| Rich Felker | 2012-06-06 | 1 | -9/+9 |
| * | add ldd and main program loading support to dynamic linker | Rich Felker | 2012-05-27 | 4 | -21/+89 |
| * | cleanup dynamic linker start code cruft•••two actual issues: one is that __dynlink no longer wants/needs a GOT
pointer argument, so the code to generate that argument can be
removed. the other issue was that in the i386 code, argc/argv were
being loaded into registers that would be call-clobbered, then copied
to preserved registers, rather than just being loaded into the proper
call-preserved registers to begin with.
this cleanup is in preparation for adding new dynamic linker
functionality (ability to explicitly invoke the dynamic linker to run
a program).
| Rich Felker | 2012-05-27 | 3 | -13/+6 |
| * | fix error reporting for dlsym with global symbols | Rich Felker | 2012-05-04 | 1 | -1/+2 |
| * | overhaul SSP support to use a real canary•••pthread structure has been adjusted to match the glibc/GCC abi for
where the canary is stored on i386 and x86_64. it will need variants
for other archs to provide the added security of the canary's entropy,
but even without that it still works as well as the old "minimal" ssp
support. eventually such changes will be made anyway, since they are
also needed for GCC/C11 thread-local storage support (not yet
implemented).
care is taken not to attempt initializing the thread pointer unless
the program actually uses SSP (by reference to __stack_chk_fail).
| Rich Felker | 2012-05-03 | 1 | -4/+3 |
| * | gdb shared library debugging support•••provide the minimal level of dynamic linker-to-debugger glue needed to
let gdb find loaded libraries and load their symbols.
| Rich Felker | 2012-04-25 | 1 | -5/+32 |
| * | first attempt at enabling stack protector support•••the code is written to pre-init the thread pointer in static linked
programs that pull in __stack_chk_fail or dynamic-linked programs that
lookup the symbol. no explicit canary is set; the canary will be
whatever happens to be in the thread structure at the offset gcc
hard-coded. this can be improved later.
| Rich Felker | 2012-04-24 | 1 | -0/+7 |
| * | make dlerror produce informative results•••note that dlerror is specified to be non-thread-safe, so no locking is
performed on the error flag or message aside from the rwlock already
held by dlopen or dlsym. if 2 invocations of dlsym are generating
errors at the same time, they could clobber each other's results, but
the resulting string, albeit corrupt, will still be null-terminated.
any use of dlerror in such a situation could not be expected to give
meaningful results anyway.
| Rich Felker | 2012-04-23 | 1 | -4/+15 |
| * | make dlerror conform to posix•••the error status is required to be sticky after failure of dlopen or
dlsym until cleared by dlerror. applications and especially libraries
should never rely on this since it is not thread-safe and subject to
race conditions, but glib does anyway.
| Rich Felker | 2012-03-23 | 1 | -6/+16 |
| * | protect against cancellation in dlopen•••i'm not sure that it's "correct" for dlopen to block cancellation
when calling constructors for libraries it loads, but it sure seems
like the right thing. in any case, dlopen itself needs cancellation
blocked.
| Rich Felker | 2012-02-07 | 1 | -2/+5 |
| * | reduce some wasted space in dso structure | Rich Felker | 2012-02-07 | 1 | -3/+3 |
| * | run ctors/dtors for shared objects loaded with dlopen | Rich Felker | 2012-02-06 | 1 | -0/+1 |
| * | add support for init/finit (constructors and destructors)•••this is mainly in hopes of supporting c++ (not yet possible for other
reasons) but will also help applications/libraries which use (and more
often, abuse) the gcc __attribute__((__constructor__)) feature in "C"
code.
x86_64 and arm versions of the new startup asm are untested and may
have minor problems.
| Rich Felker | 2012-02-06 | 1 | -0/+19 |
| * | include dummied-out dlopen and dlsym functions for static binaries•••these don't work (or do anything at all) but at least make it possible
to static link programs that insist on "having" dynamic loading
support...as long as they don't actually need to use it.
adding real support for dlopen/dlsym with static linking is going to
be significantly more difficult...
| Rich Felker | 2012-02-03 | 1 | -1/+10 |
| * | fix broken copy relocations from dynamic linker cleanup•••this issue affected programs which use global variables exported by
non-libc libraries.
| Rich Felker | 2012-01-23 | 1 | -1/+4 |
| * | dynamic linker support for PIE binaries (position-independent main program)•••even with this change, PIE will not work yet due to deficiencies in
the crt1.o startup code.
| Rich Felker | 2012-01-23 | 1 | -3/+6 |
| * | cleanup dynamic linker, removing some code duplication | Rich Felker | 2012-01-23 | 1 | -78/+64 |
| * | fix dynamic linker not to depend on DYNAMIC ptr in 0th entry of GOT•••this fixes an issue using gold instead of gnu ld for linking. it also
should eliminate the need of the startup code to even load/pass the
got address to the dynamic linker.
based on patch submitted by sh4rm4 with minor cosmetic changes.
further cleanup will follow.
| Rich Felker | 2012-01-20 | 1 | -3/+12 |
| * | fix char signedness bug in dynlinker hash function•••this only affects non-ascii symbol names, which are probably not in
use anyway..
| Rich Felker | 2012-01-17 | 1 | -1/+2 |
| * | dlsym entry point for arm | Rich Felker | 2011-10-01 | 1 | -0/+6 |
| * | dynamic linker entry point for arm•••mildly tested, seems to work
| Rich Felker | 2011-10-01 | 1 | -0/+14 |
| * | disable dynamic linking/loading code in static libc builds, for now•••it does not work, but some configure scripts will falsely detect
support then generate programs that crash when they call dlopen.
| Rich Felker | 2011-09-18 | 1 | -0/+2 |
| * | fix RTLD_NEXT on x86_64•••the return address was being truncated to 32 bits, preventing the
dlsym code from determining which module contains the calling code.
| Rich Felker | 2011-09-03 | 1 | -1/+1 |
| * | ldso: move the suid/secure check code closer to env/auxv processing•••this does not change behavior, but the idea is to avoid letting other
code build up between these two points, whereby the environment
variables might get used before security it checked.
| Rich Felker | 2011-08-16 | 1 | -7/+7 |
| * | honor AT_SECURE aux vector flag | Rich Felker | 2011-08-16 | 1 | -2/+2 |
| * | RTLD_NEXT support•••the asm wrapper is needed to get the return address without
compiler-specific extensions.
| Rich Felker | 2011-08-16 | 4 | -3/+32 |
| * | LD_PRELOAD support | Rich Felker | 2011-08-16 | 1 | -0/+20 |
| * | when resolving symbols with only weak defs, use first def, not last def | Rich Felker | 2011-07-25 | 1 | -0/+1 |
| * | fix resolution of weak symbols (hopefully right now) and vdso | Rich Felker | 2011-07-24 | 1 | -3/+9 |
| * | load vdso, if present, into the dso list | Rich Felker | 2011-07-24 | 1 | -2/+31 |
| * | simplify dynamic linker startup•••instead of creating temp dso objects on the stack and moving them to
the heap if dlopen/dlsym are used, use static objects to begin with,
and just donate them to malloc if we no longer need them.
| Rich Felker | 2011-07-24 | 1 | -23/+17 |
| * | fix dlopen UB due to longjmp/volatile rules violation | Rich Felker | 2011-07-01 | 1 | -1/+1 |
| * | simple rpath support (no token expansion yet) for dynamic linker | Rich Felker | 2011-06-30 | 1 | -2/+8 |
| * | textrel support, cheap and ugly | Rich Felker | 2011-06-29 | 1 | -0/+5 |
| * | reclaim the memory wasted by dynamic linking for use by malloc | Rich Felker | 2011-06-28 | 1 | -0/+39 |
| * | use load address from elf header if possible•••this is mostly useless for shared libs (though it could help for
prelink-like purposes); the intended use case is for adding support
for calling the dynamic linker directly to run a program, as in:
./libc.so ./a.out foo
this usage is not yet supported.
| Rich Felker | 2011-06-28 | 1 | -1/+1 |
| * | make dynamic linker relocate the main program image last, after all libs•••prior to this change, copy relocations for initialized pointer
variables would not reflect the relocated contents of the pointer.
| Rich Felker | 2011-06-28 | 1 | -0/+1 |
| * | fix stale pointer issue in dynamic linker with dlopen | Rich Felker | 2011-06-26 | 1 | -0/+1 |
| * | don't leave the lock held on dlopen failure.. | Rich Felker | 2011-06-26 | 1 | -2/+2 |
| * | add RTLD_DEFAULT support | Rich Felker | 2011-06-26 | 1 | -1/+2 |
| * | in dlopen: don't use null pointer•••deps can be null if a library has no dependencies (such as libc itself)
| Rich Felker | 2011-06-26 | 1 | -3/+3 |
| * | fix resolving symbols in objects loaded in RTLD_LOCAL mode•••basically we temporarily make the library and all its dependencies
part of the global namespace but only for the duration of performing
relocations, then return them to their former state.
| Rich Felker | 2011-06-26 | 1 | -0/+11 |
| * | experimental dlopen/dlsym and dynlink changes needed to support them | Rich Felker | 2011-06-26 | 1 | -8/+125 |
| * | error handling in dynamic linking•••some of the code is not yet used, and is in preparation for dlopen
which needs to be able to handle failure loading libraries without
terminating the program.
| Rich Felker | 2011-06-26 | 1 | -2/+19 |
| * | fix some symbol resolution issues in dynamic linker•••1. search was wrongly beginning with lib itself rather than dso head
2. inconsistent resolution of function pointers for functions in plt
| Rich Felker | 2011-06-25 | 1 | -4/+4 |
| * | handle library paths better (ignore empty path components, etc.) | Rich Felker | 2011-06-25 | 1 | -3/+5 |