change related to AT_EXECFN. We cannot use that string.
* sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
_dl_execfn member.
* elf/dl-support.c: Remove _dl_execfn variable.
(_dl_aux_init): Remove handling of AT_EXECFN.
* elf/dl-sysdep.c (_dl_sysdep_start): Remove handling of AT_EXECFN.
* elf/rtld.c (process_envvars): Remove use of __ASSUME_AT_EXECFN.
argument.
(_dl_lookup_symbol_x): Adjust caller.
* sysdeps/generic/ldsodefs.h (struct link_namespaces): Remove
_ns_global_scope.
* elf/rtld.c (dl_main): Don't initialize _ns_global_scope.
* elf/dl-libc.c: Revert l_scope name changes.
* elf/dl-load.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/rtld.c: Likewise.
* elf/dl-close.c (_dl_close): Likewise.
* elf/dl-open.c (dl_open_worker): Likewise. If not SINGLE_THREAD_P,
always use __rtld_mrlock_{change,done}. Always free old scope list
here if not l_scope_mem.
* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Revert l_scope name
change. Never free scope list here. Just __rtld_mrlock_lock before
the lookup and __rtld_mrlock_unlock it after the lookup.
* elf/dl-sym.c: Likewise.
* include/link.h (struct r_scoperec): Remove.
(struct link_map): Replace l_scoperec with l_scope, l_scoperec_mem
with l_scope_mem and l_scoperec_lock with l_scope_lock.
Implement reference counting of scope records.
* elf/dl-close.c (_dl_close): Remove all scopes from removed objects
from the list in objects which remain. Always allocate new scope
record.
* elf/dl-open.c (dl_open_worker): When growing array for scopes,
don't resize, allocate a new one.
* elf/dl-runtime.c: Update reference counters before using a scope
array.
* elf/dl-sym.c: Likewise.
* elf/dl-libc.c: Adjust for l_scope name change.
* elf/dl-load.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/rtld.c: Likewise.
* include/link.h: Inlcude <rtld-lowlevel.h>. Define struct
r_scoperec. Replace r_scope with pointer to r_scoperec structure.
Add l_scoperec_lock.
* sysdeps/generic/ldsodefs.h: Include <rtld-lowlevel.h>.
* sysdeps/generic/rtld-lowlevel.h: New file.
* include/atomic.h: Rename atomic_and to atomic_and_val and
atomic_or to atomic_or_val. Define new macros atomic_and and
atomic_or which do not return values.
* sysdeps/x86_64/bits/atomic.h: Define atomic_and and atomic_or.
Various cleanups.
* sysdeps/i386/i486/bits/atomic.h: Likewise.
2006-09-29 Ulrich Drepper <drepper@redhat.com>
[BZ #3273]
* nscd/nscd_initgroups.c (__nscd_getgrouplist): It is OK to have
found no group members.
Patch by Petr Baudis.
2006-09-29 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (_dl_start_final): If not USE___THREAD, don't
assert bootstrap_map.l_tls_modid is zero.
(_dl_start): Initialize bootstrap_map.l_tls_modid to 0
if USE___THREAD.
From Alexandre Oliva <aoliva@redhat.com>.
* elf/tst-audit2.c: New file.
* elf/Makefile (tests): Add it.
($(objpfx)tst-audit2.out): New target.
(tst-audit2-ENV): New variable.
* elf/tst-leaks1.c: Include <stdio.h>.
Tom Gall <tom_gall@vnet.ibm.com>
* elf/rtld.c (dl_main): Initialize l_local_scope for sysinfo_map.
* sysdeps/powerpc/elf/libc-start.c: Move this...
* sysdeps/unix/sysv/linux/powerpc/libc-start.c: ...to here.
* sysdeps/powerpc/powerpc32/dl-start.S: Add _dl_main_dispatch label.
* sysdeps/powerpc/powerpc32/hp-timing.h: New file.
* sysdeps/unix/sysv/linux/powerpc/Versions: New file.
* sysdeps/unix/sysv/linux/clock_getres.c: If HAVE_CLOCK_GETRES_VSYSCALL
is not defined, redefine INTERNAL_VSYSCALL and INLINE_VSYSCALL to
INTERNAL_SYSCALL and INLINE_SYSCALL respectively. Otherwise include
<bits/libc-vdso.h>. Use INLINE_VSYSCALL and INTERNAL_SYSCALL instead
of the normal versions throughout the code.
* sysdeps/unix/sysv/linux/clock_gettime.c: Likewise if
HAVE_CLOCK_GETTIME_VSYSCALL is defined.
* sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h: New file.
* sysdeps/unix/sysv/linux/powerpc/dl-vdso.c: New file.
* sysdeps/unix/sysv/linux/powerpc/dl-vdso.h: New file.
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Use vDSO.
* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c: New file.
* sysdeps/unix/sysv/linux/powerpc/Makefile: Add dl-vdso to routines.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Define
INLINE_VSYSCALL, INTERNAL_VSYSCALL, INTERNAL_SYSCALL_NCS,
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, HAVE_CLOCK_GETRES_VSYSCALL,
and HAVE_CLOCK_GETTIME_VSYSCALL.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
* elf/rtld.c: Define __pointer_chk_guard_local and if necessary
__pointer_chk_guard.
(_rtld_global_ro): Initialize _dl_pointer_guard.
(dl_main): Initialize __pointer_chk_guard_local and either
__pointer_chk_guard or TLS value if necessary.
(process_envvars): Recognize and handle LD_POINTER_GUARD.
* sysdeps/generic/ldsodefs.h (rtld_global_ro): Add _dl_pointer_guard.
* sysdeps/i386/__longjmp.S: Use PTR_DEMANGLE for PC if defined.
* sysdeps/x86_64/__longjmp.S: Likewise.
* sysdeps/i386/bsd-_setjmp.S: Use PTR_MANGLE for PC if defined.
* sysdeps/i386/bsd-_setjmp.S: Likewise.
* sysdeps/i386/setjmp.S: Likewise.
[IS_IN_rtld]: Avoid call to __sigjmp_save.
* sysdeps/i386/setjmp.S: Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Define PTR_MANGLE and
PTR_DEMANGLE.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
* sysdeps/i386/elf/setjmp.S: Removed.
* sysdeps/i386/elf/bsd-setjmp.S: Removed.
* configure.in: Add --enable-stackguard-randomization option.
(ENABLE_STACKGUARD_RANDOMIZE): New define.
* config.h.in (ENABLE_STACKGUARD_RANDOMIZE): Add.
* sysdeps/unix/sysv/linux/dl-osinfo.h: Include stdint.h.
(_dl_setup_stack_chk_guard): New inline function.
* sysdeps/generic/dl-osinfo.h: Include stdint.h.
(_dl_setup_stack_chk_guard): New inline function.
* elf/rtld.c (__stack_chk_guard): New variable.
(dl_main): Remove all traces of TLS_INIT_TP_EXPENSIVE.
Set __stack_chk_guard to _dl_setup_stack_chk_guard (),
use THREAD_SET_STACK_GUARD if defined.
* elf/Versions (ld): Export __stack_chk_guard@@GLIBC_2.4.
* sysdeps/generic/libc-start.c (__stack_chk_guard): New variable.
(__libc_start_main): Set __stack_chk_guard to
_dl_setup_stack_chk_guard (), use THREAD_SET_STACK_GUARD if defined.
* sysdeps/generic/libc-tls.c (__libc_setup_tls): Remove all
traces of TLS_INIT_TP_EXPENSIVE.
* debug/Versions (libc): Export __stack_chk_fail@@GLIBC_2.4.
* debug/Makefile (routines): Add stack_chk_fail.
(static-only-routines): Add stack_chk_fail_local.
* debug/stack_chk_fail_local.c: New file.
* debug/stack_chk_fail.c: New file.
* elf/Makefile: Add rules to build and run tst-stackguard1{,-static}
tests.
* elf/tst-stackguard1.c: New file.
* elf/tst-stackguard1-static.c: New file.
* elf/stackguard-macros.h: New file.
2005-06-13 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/clock_gettime.c (clock_gettime): Implement case
where HANDLED_REALTIME is not defined. [BZ #966]
2005-06-13 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_sendreq,
__netlink_receive): Remove prototypes.
(__netlink_request): New prototype.
* sysdeps/unix/sysv/linux/ifaddrs.c: Include <alloca.h> and
<stdint.h>.
(__netlink_sendreq): Make static.
(__netlink_receive): Rename to...
(__netlink_request): ... this. Add type argument, call
__netlink_sendreq. If MSG_TRUNC is set after recvmsg, retry
with a bigger buffer. Don't record buffers that contain no
messages we are expecting.
(getifaddrs): Use __netlink_request instead of __netlink_sendreq
and __netlink_receive pairs. Formatting.
* sysdeps/unix/sysv/linux/if_index.c (if_nameindex_netlink): Use
__netlink_request instead of __netlink_sendreq and __netlink_receive
pair.
2005-06-13 Thorsten Kukuk <kukuk@suse.de>
* sysdeps/unix/sysv/linux/netinet/if_tr.h: Don't include kernel
headers, instead copy important structs/defines.
2005-06-13 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (dl_main): Move DT_DEBUG setup before first
_dl_debug_state call.
real malloc in the catch object.
(_dl_catch_error): Forward information about malloc use to caller
in new parameter.
(_dl_out_of_memory): Make static.
* elf/dl-deps.c: Adjust callers of _dl_catch_error.
* elf/dl-libc.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/rtld.c: Likewise.
Add new --audit option.
* sysdeps/generic/ldsodefs.h: Remove _dl_out_of_memory declaration.
(rtld_global_ro._dl_signal_error): Add new parameter.
* include/dlfcn.h (_dl_catch_error): Add new parameter.
* dlfcn/dlfcn.c (_dlerror_run): Pass additional parameter to
_dl_catch_error. Only free if the returned newly value says so.
[(NEED_DL_SYSINFO || NEED_DL_SYSINFO_DSO) && SHARED]: Scan
GLRO(dl_sysinfo_map) for PT_NOTE giving Linux kernel version,
we can skip the uname call if it's there.
* sysdeps/generic/dl-sysdep.c (_dl_sysdep_start): Don't use
DL_SYSDEP_OSCHECK here.
* elf/rtld.c (dl_main) [DL_SYSDEP_OSCHECK]: Do it here instead.
* sysdeps/generic/ldsodefs.h (struct rtld_global_ro):
Add _dl_sysinfo_map.
* elf/rtld.c (dl_main): Don't call _dl_init_paths early in the
rtld_is_main case. Call it unconditionally later.
Move GLRO(dl_sysinfo_dso) handling earlier, before _dl_init_paths call.
Initialize GLRO(dl_sysinfo_map).
* elf/dl-load.c (open_path): Bail out if _dl_init_paths wasn't called.
* sysdeps/generic/dl-sysdep.c (_DL_FIRST_EXTRA): New macro.
(_dl_important_hwcaps)
[(NEED_DL_SYSINFO || NEED_DL_SYSINFO_DSO) && SHARED]: Scan
GLRO(dl_sysinfo_map) for PT_NOTE giving synthetic hwcap names
and bit values.
* elf/ldconfig.c (_DL_FIRST_EXTRA): New macro.
(hwcap_extra): New static variable.
(is_hwcap_platform): Check hwcap_extra for a matching name.
Remove tls special case.
(path_hwcap): Likewise.
(parse_conf): Parse "hwcap" directive to define synthetic hwcap bits
and their names, stored in hwcap_extra.
(main) [USE_TLS]: Initialize final synthetic hwcap bit as "tls".
* sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Use uint64_t for
_dl_hwcap and _dl_hwcap_mask.
* sysdeps/generic/dl-sysdep.c (_dl_sysdep_start): Cast a_val for
AT_HWCAP to unsigned long int.
* elf/dl-support.c (_dl_aux_init): Likewise.
(_dl_hwcap): Update defn.
* elf/cache.c (print_entry): Pad hwcap value with 0s in diagnostic.
* elf/ldconfig.c (search_dir): Likewise.
2005-03-15 Jakub Jelinek <jakub@redhat.com>
[BZ #786]
* sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Handle
GL(dl_tls_static_nelem) == GL(dl_tls_max_dtv_idx).
* elf/Makefile: Add rules to build and run tst-tls15.
* elf/tst-tls15.c: New test.
* elf/tst-tlsmod15a.c: New file.
* elf/tst-tlsmod15b.c: New file.
2005-03-20 Ulrich Drepper <drepper@redhat.com>
* elf/rtld.c (dl_main): Always call init_tls if we have audit modules.
Change type of l_idx to int.
* elf/dl-close.c: Basically rewrite. Do not use l_opencount to
determine whether a DSO has to be unloaded. Instead compute this
in this function.
* elf/dl-deps.c: No need to manipulate l_opencount anymore.
* elf/dl-lookup.c: Likewise.
* elf/rtld.c: Likewise
* elf/dl-open.c: Likewise. Use l_init_called to determine whether
object was just loaded.
* elf/dl-fini.c: Bump l_direct_opencount instead of l_opencount.
* elf/dl-load.c (_dl_map_object_from_fd): Do not recognize DSO which
is about to be unloaded as a match.
(_dl_map_object): Likewise.
* elf/do-lookup.h (do_lookup_x): Do not look into DSO which is about
to be unloaded.
* elf/circleload1.c: Don't use l_opencount anymore.
* elf/neededtest.c: Likewise.
* elf/neededtest2.c: Likewise.
* elf/neededtest3.c: Likewise.
* elf/neededtest4.c: Likewise.
* elf/unload.c: Likewise.
* elf/unload2.c: Likewise.
* elf/loadtest.c: Likewise.
* elf/rtld.c: Preloading errors are now never fatal.
2005-03-08 Jakub Jelinek <jakub@redhat.com>
* elf/Makefile: Add rules to build and run unload5 test.
* elf/unload5.c: New file.
2005-03-08 Jakub Jelinek <jakub@redhat.com>
* elf/Makefile: Add rules to build and run unload4 test.
* elf/unload4.c: New file.
* elf/unload4mod1.c: New file.
* elf/unload4mod2.c: New file.
* elf/unload4mod3.c: New file.
* elf/unload4mod4.c: New file.
__libc_message to kill GCC warning about noreturn function returning.
* elf/rtld.c (dlmain): If LD_TRACE_PRELINKING, clear l_relocated flag
before relocating ld.so again.
* elf/rtld.c (_dl_start): Set bootstrap_map.l_relocated even
for already prelinked ld.so.
2005-01-09 Ulrich Drepper <drepper@redhat.com>
* elf/dl-debug.c (_dl_debug_initialize): Take extra parameter and
use it to select the r_debug structure for that namespace.
* elf/dl-close.c (_dl_close): Adjust call to _dl_debug_initialize.
* elf/dl-load.c (_dl_map_object_from_fd): Likewise.
* elf/dl-open.c (_dl_open): Likewise.
* elf/rtld.c (dl_main): Likewise.
* sysdeps/generic/ldsodefs.h (struct link_namespaces): Add _ns_debug
member.
(_dl_debug_initialize): Add new parameter in declaration.
* elf/dl-close.c (_dl_close): Make sure auditing callbacks are not
called for the auditing objects themselves.
* elf/dl-load.c (_dl_map_object_from_fd): Likewise.
2005-01-05 Steven Munroe <sjmunroe@us.ibm.com>
* elf/rtld.c (dl_main) [NEED_DL_SYSINFO_DSO]: Insure l_map_end and
l_text_end are set for a VDSO with a single PT_LOAD entry.
piping to cat; when not, don't use the pipe at all.
Pipe to cat in all cases of running the executable.
When direct running exits with code 5, retry running via ${RTLD}.
* elf/rtld.c (process_envvars): If __libc_enable_secure and
mode != normal, exit with exitcode 5.
2004-12-01 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (process_envvars): Don't consider LD_SHOW_AUXV
and LD_DYNAMIC_WEAK if __libc_enable_secure.
If __libc_enable_secure, /etc/suid-debug doesn't exist and
program will be actually run, turn off all debugging.
* sysdeps/generic/unsecvars.h (UNSECURE_ENVVARS): Add LD_DEBUG,
LD_DYNAMIC_WEAK and LD_SHOW_AUXV.
2004-11-13 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (print_statistics): Avoid segfaults if not all namespaces
are used. Fix computation of num_relative_relocations on RELA
architectures other than IA-64 and Alpha.
2004-11-13 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Use munmap_chunk for handling
mmaped memory.
_dl_sysinfo_dso under [NEED_DL_SYSINFO_DSO] as well.
* elf/rtld.c (dl_main): Set up GLRO(dl_sysinfo_dso) under
[NEED_DL_SYSINFO_DSO] as well.
* sysdeps/generic/dl-sysdep.c (_dl_show_auxv): Always include
AT_SYSINFO and AT_SYSINFO_EHDR in name table.
(_dl_sysdep_start) [NEED_DL_SYSINFO_DSO]: Match AT_SYSINFO_EHDR.
* elf/dl-support.c (_dl_sysinfo_dso): Define also under
[NEED_DL_SYSINFO_DSO].
(_dl_aux_init) [NEED_DL_SYSINFO || NEED_DL_SYSINFO_DSO]:
Match AT_SYSINFO_EHDR and set GL(dl_sysinfo_dso).
2004-11-05 Roland McGrath <roland@redhat.com>
2004-10-14 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (_dl_start): Fix one last dl_loaded.
* elf/dl-load.c (_dl_map_object_from_fd): Avoid definition of
label when it is not needed.
* elf/dl-close.c (_dl_close): Typo: & -> &&.
Update.
Add support for namespaces in the dynamic linker.
* dlfcn/Makefile (libdl-routines): Add dlmopen.
* dlfcn/Versions [libdl, GLIBC_2.3.4]: Add dlmopen.
* dlfcn/dlfcn.h: Define Lmid_t, LM_ID_BASE, and LM_ID_NEWLM.
Declare dlmopen. Document RTLD_DI_LMID.
* dlfcn/dlinfo.c: Handle RTLD_DI_LMID.
* dlfcn/dlmopen.c: New file.
* dlfcn/dlopen.c: Pass new parameter to _dl_open.
* dlfcn/dlopenold.c: Likewise.
* elf/dl-addr.c: Adjust for removal of GL(dl_loaded).
* elf/dl-caller.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-conflict.c: Likewise.
* elf/dl-debug.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-sym.c: Likewise.
* elf/dl-version.c: Likewise.
* elf/do-lookup.h: Likewise.
* elf/rtld.c: Likewise.
* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise.
* elf/dl-depsc: Likewise. Add new parameter to _dl_map_object.
* elf/dl-fini.c: Call destructors in all namespaces.
* elf/dl-iteratephdr.c: Compute total nloaded. Adjust for removal of
GL(dl_loaded).
* elf/dl-libc.c: Pass new parameter to _dl_open. Adjust for removal
of GL(dl_loaded).
* elf/dl-load.c (_dl_map_object_from_fd): Don't load ld.so a second
time. Reuse the one from the main namespace in all others.
Pass new parameter to _dl_new_object.
Adjust for removal of GL(dl_loaded).
* elf/dl-object.c: Take new parameter. Use it to initialize l_ns.
Adjust for removal of GL(dl_loaded).
* elf/dl-open.c (_dl_open): Take new parameter.
Adjust for removal of GL(dl_loaded).
* elf/dl-support.c: Replace global _dl_loaded etc variables with
_dl_ns variable.
* include/dlfcn.h: Adjust prototype of _dl_open.
Define __LM_ID_CALLER.
* include/link.h: Add l_real, l_ns, and l_direct_opencount elements.
* sysdeps/generic/dl-tls.c: Bump TLS_STATIC_SURPLUS. Since libc is
using TLS we need memory appropriate to the number of namespaces.
* sysdeps/generic/ldsodefs.h (struct rtld_global): Replace _dl_loaded,
_dl_nloaded, _dl_global_scope, _dl_main_searchlist, and
_dl_global_scope_alloc with _dl_ns element. Define DL_NNS.
Adjust prototypes of _dl_map_object and member in rtld_global_ro.
* malloc/malloc.c: Include <dlfcn.h>.
* malloc/arena.c (ptmalloc_init): If libc is not in primary namespace,
never use brk.
* elf/Makefile: Add rules to build and run tst-dlmopen1 and
tst-dlmopen2.
* elf/tst-dlmopen1.c: New file.
* elf/tst-dlmopen1mod.c: New file.
* elf/tst-dlmopen2.c: New file.
* elf/dl-close.c: Improve reference counting by tracking direct loads.
* elf/dl-lookup.c (add_dependency): Likewise.
* elf/dl-open.c (dl_open_worker): Likewise.
* elf/rtld.c (dl_main): Likewise.
2004-09-09 GOTO Masanori <gotom@debian.or.jp>
[BZ #77]
* elf/dl-close.c: Count down l_opencount to check not only for
l_reldeps, but also l_initfini.
2004-10-13 Ulrich Drepper <drepper@redhat.com>
2004-09-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/bits/dlfcn.h: Add RTLD_DEEPBIND.
* elf/dl-object.c (_dl_new_object): Add new parameter mode. If mode
has RTLD_DEEPBIND set add local searchlist before global scope.
* sysdeps/generic/ldsodefs.h (_dl_new_object): Adjust prototype.
* elf/rtld.c: Adjust callers of _dl_new_object.
* elf/dl-load.c: Likewise.
(_dl_map_object_from_fd): If RTLD_DEEPBIND is used, don't do anything
for DF_SYMBOLIC.
* elf/dl-open.c (dl_open_writer): Pass RTLD_DEEPBIND flag on to
_dl_map_object_deps.
* elf/tst-deep1.c: New file.
* elf/tst-deep1mod1.c: New file.
* elf/tst-deep1mod2.c: New file.
* elf/tst-deep1mod3.c: New file.
* elf/Makefile: Add rules to build and run new tests.
* elf/dl-deps.c: Pretty printing.
2004-09-20 Ulrich Drepper <drepper@redhat.com>
* elf/dl-load.c (_dl_map_object_from_fd): Add some error checking.
Reorder code slightly.
* elf/rtld.c (dl_main): No need to check whether l_info[DT_HASH]
is non-null, _dl_setup_hash will do that.