Commit graph

269 commits

Author SHA1 Message Date
Ulrich Drepper e7c8359e43 * posix/wordexp.c (w_addword): Free word if realloc fails and it
was allocated here.  [Coverity CID 219]

	* posix/getconf.c (print_all): Free confstr data after printing.
	[Coverity CID 218]

	* sysdeps/posix/getaddrinfo.c (gaih_inet): Free canon string if
	list allocation fails.  [Coverity CID 215]

	* nss/nsswitch.c (__nss_configure_lookup): Fix loop end condition.
	[Coverity CID 213]

	* argp/argp-help.c (hol_entry_cmp): Don't call canon_doc_option if
	string is NULL.  [Coverity CID 212]
	* argp/Makefile: Add rules to build and run bug-argp1.
	* argp/bug-argp1.c: New file.

	* io/ftw.c (ftw_dir): Use __rawmemchr instead of strchr to find
	end of string.
	* stdlib/canonicalize.c (__realpath): Likewise.

	* locale/programs/ld-time.c (time_finish): Don't dereference NULL
	pointer.  [Coverity CID 206]

	* elf/dl-dst.h (DL_DST_REQUIRED): Be prepared for missing link map
	in statically linked code.
	* elf/dl-load.c (_dl_dst_substitute): When replacing ORIGIN in
	statically built code, be prepared to have no link map.
	[Coverity CID 205]

	* argp/argp-help.c (fill_in_uparams): Handle STATE==NULL in
	dgettext calls. [Coverity CID 204]

	* argp/argp-help.c (struct uparams): Remove valid member.  Change
	the one user.
	(uparam_names): Reduce size.  Avoid relative relocations.
	Moved to read-only segment.
	(fill_in_uparams): Update for new layout.

	* sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Parameter can be
	assumed to always be != NULL. [Coverity CID 202]

	* argp/argp-help.c (hol_entry_help): Remove some dead code
	[Coverity CID 200].

	* nis/nss_nis/nis-service.c (_nss_nis_getservbyport_r): Optimize
	away a few more unconditional yperr2nss calls.
	(_nss_nis_getservbyname_r): Likewise.
2006-05-10 00:03:41 +00:00
Ulrich Drepper bca2218b9b * elf/dl-load.c (_dl_map_object_from_fd): Move state change
notification...
	(lose): ...to here.
2006-04-30 23:47:30 +00:00
Ulrich Drepper 2e0fc40cc4 [BZ #2451]
2006-03-13  Jakub Jelinek  <jakub@redhat.com>
	[BZ #2451]
	* elf/dl-load.c (open_verify): Add free_name argument, if true, free
	name before calling lose.
	(open_path): Adjust caller.
	(_dl_map_object): Adjust callers.  Free name_copy before calling
	_dl_signal_error.
	* elf/Makefile: Add rules to build and run tst-leaks1.
	* elf/tst-leaks1.c: New test.
2006-03-15 19:26:13 +00:00
Roland McGrath a3fcd5e8a4 2005-10-17 Roland McGrath <roland@redhat.com>
* elf/dl-load.c (MAP_COPY): When undefined, define to
	MAP_PRIVATE|MAP_DENYWRITE instead of just MAP_PRIVATE.
	(_dl_map_object_from_fd): Don't use MAP_DENYWRITE explicitly.
2005-10-17 20:59:28 +00:00
Ulrich Drepper 7f71c55ddf [BZ #516]
* elf/dl-load.c: Report failed loading due to ELF class mismatch
	with better words.
2005-09-26 15:58:00 +00:00
Roland McGrath e751d28209 [BZ #1346]
2005-09-20  Roland McGrath  <roland@redhat.com>
	[BZ #1346]
	* elf/dl-load.c (_dl_map_object_from_fd) [HAVE_Z_RELRO]: Do relro
	magic on __stack_prot only if [SHARED].  Skip mprotect if __stack_prot
	lies outside the page-rounded-down relro region.
2005-09-20 07:46:12 +00:00
Ulrich Drepper fc072badce (_dl_map_object_from_fd): No need to change protection of memory used for the last segment. 2005-09-02 07:33:58 +00:00
Ulrich Drepper 23e2554f5b * elf/dl-load.c [__WORDSIZE==64] (FILEBUF_SIZE): Adjust the value
up.  We have more program header entries now and the note section
	was normally not loaded.
2005-07-30 21:15:22 +00:00
Roland McGrath b34cbd1428 * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
(INTERNAL_SYSCALL_ERROR_P): Fix typo in last change.

	* sunrpc/xdr.c (xdr_u_int): Use `long' for L and cast where needed.

	* elf/dl-load.c: Revert last change.
2005-04-26 04:26:13 +00:00
Roland McGrath 6c63200907 * elf/dl-load.c (_dl_map_object_from_fd): Don't use MAP_DENYWRITE,
since Linux ignores it in user mmap calls.
2005-04-21 21:49:23 +00:00
Roland McGrath ab1d521db3 * sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_discover_osversion)
[(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-04-07 20:57:41 +00:00
Roland McGrath 9640622776 * elf/dl-load.c: Don't include dl-osinfo.h here. 2005-03-30 02:07:41 +00:00
Ulrich Drepper 20fe49b93a * include/link.h (struct link_map): Remove l_opencount. Add l_removed.
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.
2005-03-18 11:11:42 +00:00
Roland McGrath f8286ce613 [BZ #721]
2005-03-01  Roland McGrath  <roland@redhat.com>
	[BZ #721]
	* sysdeps/arm/dl-machine.h (ELF_MACHINE_NO_RELA): Define this outside
	of [RESOLVE_MAP].

2005-03-01  Alfred M. Szmidt  <ams@gnu.org>

	* elf/dl-load.c (__stack_prot) [!PROT_GROWSUP && !PROT_GROWSDOWN]:
	Add missing initializer.

	* malloc/arena.c: #include <stdbool.h> outside of [SHARED &&
	USE_TLS && !USE___THREAD].
2005-03-01 20:55:00 +00:00
Ulrich Drepper 094d3c54ae * sysdeps/generic/libc-tls.c (static_dtv): Size the same as the
slotinfo array.
	(__libc_setup_tls_): Initializer length of DTV based on array length.
	* elf/dl-load.c: Revert last change.
	* sysdeps/generic/dl-tls.c: Revert last change.
2005-02-23 06:19:23 +00:00
Ulrich Drepper e13e33e279 2005-02-21 Alan Modra <amodra@bigpond.net.au>
* elf/dl-reloc.c (_dl_nothread_init_static_tls): Assert that dtv
	array index is within bounds.

	* elf/dl-load.c: Do not allow PT_TLS in modules loaded in statically
	linked code.
	* sysdeps/generic/dl-tls.c [!SHARED]: Don't build _dl_next_tls_modid.
	* elf/Makefile: Remove rules to build and run tst-tls9-static.
2005-02-22 03:51:38 +00:00
Ulrich Drepper 785290ea87 (_dl_map_object_from_fd): Fix a typo. 2005-02-08 21:29:01 +00:00
Ulrich Drepper 606832e6e5 * sysdeps/sh/dl-machine.h (elf_machine_rela): Remove code using
RESOLVE.

2005-02-07  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-load.c (_dl_map_object_from_fd): Makre sure registers are
	set correctly.

	* sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Define.
2005-02-08 08:25:22 +00:00
Ulrich Drepper ecc1d0c301 * elf/dl-load.c (open_path): If rtld_search_dirs is in RELRO segment,
avoid writing to it if none of the standard search directories exist.
2005-02-07 23:52:23 +00:00
Ulrich Drepper 3e539cb47e * elf/dl-load.c (_dl_map_object_from_fd): We don't have to allow
callers from libc anymore.

	* elf/dl-open.c (dl_open_worker): Pass __RTLD_AUDIT flag from caller
	to _dl_map_object_deps.
	* elf/dl-load.c (_dl_map_object_from_fd): Don't change memory
	protections when loading auditing modules.

	* dlfcn/dlopen.c (dlopen_doit): Catch invalid mode arguments and fail.
2005-01-13 02:08:37 +00:00
Ulrich Drepper 29f976542b Update.
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-09 08:29:25 +00:00
Ulrich Drepper 9dcafc5597 * csu/elf-init.c (__libc_csu_fini): Don't do anything here.
* sysdeps/generic/libc-start.c: Don't register program destructor here.
	* dlfcn/Makefile: Add rules to build dlfcn.c.
	(LDFLAGS-dl.so): Removed.
	* dlfcn/dlclose.c: _dl_close is now in ld.so, use function pointer
	table.
	* dlfcn/dlmopen.c: Likewise for _dl_open.
	* dlfcn/dlopen.c: Likewise.
	* dlfcn/dlopenold.c: Likewise.
	* elf/dl-libc.c: Likewise for _dl_open and _dl_close.
	* elf/Makefile (routines): Remove dl-open and dl-close.
	(dl-routines): Add dl-open, dl-close, and dl-trampoline.
	Add rules to build and run tst-audit1.
	* elf/tst-audit1.c: New file.
	* elf/tst-auditmod1.c: New file.
	* elf/Versions [libc]: Remove _dl_open and _dl_close.
	* elf/dl-close.c: Change for use inside ld.so instead of libc.so.
	* elf/dl-open.c: Likewise.
	* elf/dl-debug.c (_dl_debug_initialize): Allow reinitialization,
	signaled by nonzero parameter.
	* elf/dl-init.c: Fix use of r_state.
	* elf/dl-load.c: Likewise.

	* elf/dl-close.c: Add auditing checkpoints.
	* elf/dl-open.c: Likewise.
	* elf/dl-fini.c: Likewise.
	* elf/dl-load.c: Likewise.
	* elf/dl-sym.c: Likewise.
	* sysdeps/generic/libc-start.c: Likewise.
	* elf/dl-object.c: Allocate memory for auditing information.
	* elf/dl-reloc.c: Remove RESOLV.  We now always need the map.
	Correctly initialize slotinfo.
	* elf/dynamic-link.h: Adjust after removal of RESOLV.
	* sysdeps/hppa/dl-lookupcfg.h: Likewise.
	* sysdeps/ia64/dl-lookupcfg.h: Likewise.
	* sysdeps/powerpc/powerpc64/dl-lookupcfg.h: Removed.
	* elf/dl-runtime.c (_dl_fixup): Little cleanup.
	(_dl_profile_fixup): New parameters to point to register struct and
	variable for frame size.
	Add auditing checkpoints.
	(_dl_call_pltexit): New function.
	Don't define trampoline code here.
	* elf/rtld.c: Recognize LD_AUDIT.  Load modules on startup.
	Remove all the functions from _rtld_global_ro which only _dl_open
	and _dl_close needed.
	Add auditing checkpoints.
	* elf/link.h: Define symbols for auditing interfaces.
	* include/link.h: Likewise.
	* include/dlfcn.h: Define __RTLD_AUDIT.
	Remove prototypes for _dl_open and _dl_close.
	Adjust access to argc and argv in libdl.
	* dlfcn/dlfcn.c: New file.
	* sysdeps/generic/dl-lookupcfg.h: Remove all content now that RESOLVE
	is gone.
	* sysdeps/generic/ldsodefs.h: Add definitions for auditing interfaces.
	* sysdeps/generic/unsecvars.h: Add LD_AUDIT.
	* sysdeps/i386/dl-machine.h: Remove trampoline code here.
	Adjust for removal of RESOLVE.
	* sysdeps/x86_64/dl-machine.h: Likewise.
	* sysdeps/generic/dl-trampoline.c: New file.
	* sysdeps/i386/dl-trampoline.c: New file.
	* sysdeps/x86_64/dl-trampoline.c: New file.

	* sysdeps/generic/dl-tls.c: Cleanups.  Fixup for dtv_t change.
	Fix updating of DTV.
	* sysdeps/generic/libc-tls.c: Likewise.

	* sysdeps/arm/bits/link.h: Renamed to ...
	* sysdeps/arm/buts/linkmap.h: ...this.
	* sysdeps/generic/bits/link.h: Renamed to...
	* sysdeps/generic/bits/linkmap.h: ...this.
	* sysdeps/hppa/bits/link.h: Renamed to...
	* sysdeps/hppa/bits/linkmap.h: ...this.
	* sysdeps/hppa/i386/link.h: Renamed to...
	* sysdeps/hppa/i386/linkmap.h: ...this.
	* sysdeps/hppa/ia64/link.h: Renamed to...
	* sysdeps/hppa/ia64/linkmap.h: ...this.
	* sysdeps/hppa/s390/link.h: Renamed to...
	* sysdeps/hppa/s390/linkmap.h: ...this.
	* sysdeps/hppa/sh/link.h: Renamed to...
	* sysdeps/hppa/sh/linkmap.h: ...this.
	* sysdeps/hppa/x86_64/link.h: Renamed to...
	* sysdeps/hppa/x86_64/linkmap.h: ...this.
2005-01-06  Ulrich Drepper  <drepper@redhat.com>

	* allocatestack.c (init_one_static_tls): Adjust initialization of DTV
	entry for static tls deallocation fix.
	* sysdeps/alpha/tls.h (dtv_t): Change pointer type to be struct which
	also contains information whether the memory pointed to is static
	TLS or not.
	* sysdeps/i386/tls.h: Likewise.
	* sysdeps/ia64/tls.h: Likewise.
	* sysdeps/powerpc/tls.h: Likewise.
	* sysdeps/s390/tls.h: Likewise.
	* sysdeps/sh/tls.h: Likewise.
	* sysdeps/sparc/tls.h: Likewise.
	* sysdeps/x86_64/tls.h: Likewise.
2005-01-06 22:40:27 +00:00
Ulrich Drepper a334319f65 (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. 2004-12-22 20:10:10 +00:00
Jakub Jelinek 0ecb606cb6 2.5-18.1 2007-07-12 18:26:36 +00:00
Ulrich Drepper 410828e47a Update.
2004-12-12  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-load.c (_dl_map_object_from_fd): Fix computation of
	mapping start.  It must take the actual pagesize into account, not
	the alignment in the file.
2004-12-12 21:06:37 +00:00
Ulrich Drepper 7d4afb9b7f Update.
2004-10-27  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-load.c (_dl_map_object): Use cache_rpath to check for
	existing rpath in main executable, not explicit test.
2004-10-28 06:53:20 +00:00
Ulrich Drepper 7cb92a99fa Update.
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: & -> &&.
2004-10-14 09:24:14 +00:00
Ulrich Drepper c0f62c5678 [BZ #77]
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-10-14 02:08:23 +00:00
Ulrich Drepper 1fc074913b Update.
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-23 07:45:38 +00:00
Roland McGrath 44828b9d2a 2004-09-20 Roland McGrath <roland@frob.com>
* elf/dl-load.c (__stack_prot): Only use PROT_GROWSUP/PROT_GROWSDOWN
	in initializer #if defined.
2004-09-20 20:56:03 +00:00
Ulrich Drepper 703ccc1245 (_dl_map_object_from_fd): Add caller check. 2004-09-20 15:15:23 +00:00
Ulrich Drepper 664e7d93f9 Update.
2004-09-20  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-load.c: Define __stack_prot.
	* sysdeps/unix/sysv/linux/dl-execstack.c: Don't define
	__stack_prot here, just declare it.
2004-09-20 15:08:26 +00:00
Ulrich Drepper efec50797a Update.
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.
2004-09-20 07:43:16 +00:00
Ulrich Drepper dcca3fe25f Update.
* sysdeps/unisx/sysv/linux/dl-execstack.c: Get protection flag
	from memory.
	* elf/dl-load.c (_dl_map_object_from_fd): Add PROT_EXEC flag to
	__stack_flags.
2004-09-19 02:48:59 +00:00
Ulrich Drepper c14e91352e [BZ #116]
Update.
	* elf/dl-load.c (_dl_map_object): If __RTLD_CALLMAP flag is set,
	reset loader before the actual loading.
	* elf/dl-open.c (dl_open_worker): If file name contains no path
	element determine map of caller.  Pass caller map in this case to
	_dl_map_object.  Set __RTLD_CALLMAP in mode.
	* include/dlfcn.h (__RTLD_CALLMAP): Define.  [BZ #116]
	Patch by Greg Wolodkin <greg@mathworks.com>.
2004-08-09 06:41:04 +00:00
Roland McGrath 3fb035f6a2 2004-05-18 Andreas Schwab <schwab@suse.de>
* elf/dl-load.c (_dl_map_object_from_fd): Use the end address of
	the first segment for mprotect, not l_text_end.
2004-07-06 22:59:31 +00:00
Ulrich Drepper 1773d1ba5f Update.
2004-05-25  Ulrich Drepper  <drepper@redhat.com>

	* nss/digits_dots.c (__nss_hostname_digits_dots): Remove typep and
	flags parameter, convert afp to simple int parameter.  Adjust code.
	typep was never != NULL and flags therefore also unused.  *afp is
	never modified.
	* nss/nsswitch.h: Adjust __nss_hostname_digits_dots prototype.
	* nss/getXXbyYY.c: Remove HAVE_TYPE handling.  Adjust af parameter
	handling for __nss_hostname_digits_dots calls.
	* nss/getXXbyYY_r.c: Likewise.

	* elf/dl-load.c (_dl_map_object_from_fd): Map DSOs with MAP_DENYWRITE.
2004-05-26 06:42:16 +00:00
Ulrich Drepper 5ce98c3f3f Update.
2004-05-03  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/bsd/bits/fcntl.h (F_SETOWN, F_GETOWN): Define if
	__USE_BSD or __USE_UNIX98.
	* sysdeps/unix/bsd/ultrix4/bits/fcntl.h (F_SETOWN, F_GETOWN): Likewise.
	* sysdeps/unix/bsd/bsd4.4/bits/fcntl.h (F_SETOWN, F_GETOWN): Likewise.
	* sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/common/bits/fcntl.h (F_SETOWN, F_GETOWN): Likewise.
	* sysdeps/unix/sysv/aix/bits/fcntl.h (F_SETOWN, F_GETOWN): Likewise.
	* sysdeps/unix/sysv/irix4/bits/fcntl.h (F_SETOWN, F_GETOWN): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/cris/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	*sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h (F_SETOWN, F_GETOWN):
	Likewise.
	* sysdeps/generic/bits/fcntl.h (F_SETOWN, F_GETOWN): Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h (F_SETOWN, F_GETOWN): Likewise.
	* io/sys/stat.h (S_ISSOCK, S_IFSOCK): Likewise.

2004-05-01  Jakub Jelinek  <jakub@redhat.com>

	* posix/Versions (libc): Remove __libc_wait, __libc_waitpid,
	__libc_pause, __libc_nanosleep, __libc_pread, __libc_pread64,
	__libc_pwrite64, __waitid and __pselect @@GLIBC_PRIVATE.
	* stdlib/Versions (libc): Remove __on_exit@@GLIBC_PRIVATE.
	* sysdeps/unix/sysv/linux/Versions (libc): Remove
	__libc_sigaction@@GLIBC_PRIVATE.
	* sysdeps/unix/sysv/linux/x86_64/Versions (libc): Remove
	__modify_ldt@@GLIBC_PRIVATE.
	* socket/Versions (libc): Remove __libc_accept, __libc_send,
	__libc_recvfrom, __libc_recvmsg, __libc_sendmsg, __libc_recv,
	__libc_sendto and __libc_connect @@GLIBC_PRIVATE.
	* stdio-common/Versions (libc): Remove
	_itoa_upper_digits@@GLIBC_PRIVATE.
	* resolv/Versions (libresolv): Remove __ns_samename@@GLIBC_PRIVATE.
	* misc/Versions (libc): Remove __libc_fsync, __libc_msync,
	__libc_readv and __libc_writev @@GLIBC_PRIVATE.
	* termios/Versions (libc): Remove __libc_tcdrain@@GLIBC_PRIVATE.
	* io/Versions (libc): Remove __libc_open, __libc_close, __libc_read,
	__libc_write, __libc_lseek, __libc_fcntl, __libc_open64 and
	__libc_lseek64 @@GLIBC_PRIVATE.

2004-04-30  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-load.c (open_verify): Move e_phentsize check after e_type
	check.

2004-04-29  Steven Munroe  <sjmunroe@us.ibm.com>

	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.c: Removed.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.c: Removed.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llround.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_lround.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_lroundf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: New file.

	* math/test-misc.c [LDBL_MANT_DIG == 106](main): Correct LDBL_MAX
	mantissa for AIX long double format.
	* misc/qefgcvt.c [LDBL_MANT_DIG == 106] (NDIGIT_MAX): Define for AIX
	long double format.
	* misc/qefgcvt_r.c [LDBL_MANT_DIG == 106] (NDIGIT_MAX): Likewise.
	* stdlib/fpioconst.c [!__NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__>1024]
	(_fpioconst_pow10): AIX long double format has same exponent range as
	double.
	* stdlib/fpioconst.h [!__NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__>1024]
	(LDBL_MAX_10_EXP_LOG): AIX long double format has same exponent range
	as double.

2004-04-23  Art Haas  <ahaas@airmail.net>

	* sysdeps/unix/sysv/linux/kernel-features.h: Add 'defined'.
2004-05-03 21:40:12 +00:00
Ulrich Drepper eec8b6cae5 Update.
2004-03-26  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-caller.c: New file.
	* include/caller.h: New file.
	* Makefile (distribute): Add include/caller.h.
	* elf/Makefile (dl-routines): Add dl-caller.
	* elf/dl-load.c (_dl_map_object_from_fd): Record l_text_end.
	* elf/dl-open.c (check_libc_caller): Removed.
	(dl_open_worker): Use __check_caller instead.
	* elf/rtld.c (_rtld_global_ro): Initialize _dl_check_caller.
	(_dl_start_final): Record l_text_end for ld.so map.
	(dl_main): Record l_text_end for main object and vdso.
	* include/link.h (struct link_map): Add l_text_end field.
	* sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Add
	_dl_check_caller field.
	Define enum allowmask.  Add declaration of _dl_check_caller.
	* sysdeps/unix/sysv/linux/dl-execstack.c: Also use __check_caller test.
2004-03-27 03:40:33 +00:00
Ulrich Drepper c31e278f86 Update.
2004-03-07  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/generic/ldsodefs.h: Move _dl_initial_searclist,
	_dl_hp_timing_overhead, _dl_init_all_dirs, and the content of
	dl-procinfo.c from _rtld_global to _rtld_global_ro.
	* elf/rtld.c: Adjust initializer for _rtld_global_ro.
	* elf/dl-close.c: Use GLRO instead of GL where appropriate.
	* elf/dl-libc.c: Likewise.
	* elf/dl-load.c: Likewise.
	* sysdeps/i386/dl-procinfo.h: Likewise.
	* sysdeps/i386/i686/hp-timing.h: Likewise.
	* sysdeps/ia64/hp-timing.h: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/hp-timing.h: Likewise.
	* sysdeps/sparc/sparc64/hp-timing.h: Likewise.
	* sysdeps/unix/sysv/linux/arm/dl-procinfo.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h: Likewise.
2004-03-07 08:39:57 +00:00
Ulrich Drepper 154d10bdf1 Update.
* elf/Versions: Remove functions which are not exported anymore.
	* dlfcn/dlerror.c: Call ld.so functions through GLSO.
	* dlfcn/dlinfo.c: Likewise.
	* elf/dl-close.c: Likewise.
	* elf/dl-libc.c: Likewise.
	* elf/dl-open.c: Likewise.
	* elf/dl-sym.c: Likewise.
	* sysdeps/generic/libc-start.c: Likewise.
	* elf/dl-debug.c: Remove *_internal definition.  Don't use INTUSE for
	functions which are not exported anymore.
	* elf/dl-deps.c: Likewise.
	* elf/dl-dst.h: Likewise.
	* elf/dl-error.c: Likewise.
	* elf/dl-fini.c: Likewise.
	* elf/dl-init.c: Likewise.
	* elf/dl-load.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* elf/dl-misc.c: Likewise.
	* elf/dl-profile.c: Likewise.
	* elf/dl-profstub.c: Likewise.
	* elf/dl-reloc.c: Likewise.
	* elf/dl-runtime.c: Likewise.
	* elf/dl-version.c: Likewise.
	* elf/do-lookup.h: Likewise.
	* include/dlfcn.h: Likewise.
	* sysdeps/generic/dl-cache.c: Likewise.
	* sysdeps/generic/dl-fptr.c: Likewise.
	* sysdeps/generic/dl-origin.c: Likewise.
	* sysdeps/generic/dl-sysdep.c: Likewise.
	* sysdeps/generic/dl-tls.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
	* sysdeps/i386/dl-tls.h: Likewise.
	* sysdeps/unix/sysv/linux/dl-origin.c: Likewise.
	* elf/rtld.c: Likewise.  Export function though _rtld_global_ro.

	* generic/dl-fptr.c: Likewise.
	* mach/hurd/dl-sysdep.c: Likewise.
	* unix/sysv/linux/ia64/dl-static.c: Likewise.
	* unix/sysv/linux/ia64/getpagesize.c: Likewise.
	* unix/sysv/linux/m68k/getpagesize.c: Likewise.
	* unix/sysv/linux/sparc/sparc32/getpagesize.c: Likewise.
2004-03-06 08:19:29 +00:00
Ulrich Drepper afdca0f2a3 Update.
* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
	* sysdeps/s390/s390-32/dl-machine.h: Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.h: Likewise.
	* sysdeps/powerpc/powerpc32/dl-machine.c: Likewise.
	* sysdeps/m68k/dl-machine.h: Likewise.
	* sysdeps/ia64/dl-machine.h: Likewise.
	* sysdeps/arm/dl-machine.h: Likewise.
	* sysdeps/alpha/dl-machine.h: Likewise.
2004-03-05 10:29:47 +00:00
Andreas Jaeger 14755b91e9 * elf/dl-load.c (_dl_map_object_from_fd): Fix casts used as lvalue.
* iconv/gconv_simple.c (internal_ucs4le_loop): Remove cast used as
	lvalue.
2004-02-21 18:25:59 +00:00
Ulrich Drepper a481b13cc2 Update.
* elf/dl-load.c (lose): Use noinline attribute instead of silly
	alloca to prevent inlining.
	* elf/dl-runtime.c (fixup): Likewise.
	(profile_fixup): Likewise.
2004-02-09 07:10:19 +00:00
Ulrich Drepper a658675d7b Update.
2004-01-20  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/readahead.c (__readahead): Use off64_t
	instead of loff_t.  Include <fcntl.h>.
	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Add readahead prototype.
	* sysdeps/unix/sysv/linux/arm/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/cris/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.

	* elf/dl-load.c: Don't add attribute_relro to max_dirnamelen.

	* sysdeps/generic/inttypes.h: Fix PRI*FAST{16,32} macros.

	* include/unistd.h (__libc_enable_secure): Mark attribute_relro.
	(__libc_enable_secure_internal): Likewise.
	* elf/dl-load.c: Don't declare __libc_stack_end.
	* sysdeps/generic/libc-start.c: Likewise.
	* sysdeps/unix/sysv/linux/dl-execstack.c: Likewise.
	* sysdeps/generic/segfault.c: Likewise.  Include ldsodefs.h.
	* sysdeps/generic/backtrace.c: Likewise.
2004-01-20 23:25:27 +00:00
Richard Henderson ff151400d8 * elf/dl-load.c: Don't declare __libc_stack_end. * sysdeps/generic/libc-start.c: Likewise. * sysdeps/unix/sysv/linux/dl-execstack.c: Likewise. * sysdeps/generic/segfault.c: Likewise. Include ldsodefs.h. * sysdeps/generic/backtrace.c: Likewise. linuxthreads/ * attr.c: Include ldsodefs.h. (pthread_getattr_np): Don't declare __libc_stack_end. nptl/ * allocatestack.c: Don't declare __libc_stack_end. * init.c (__pthread_initialize_minimal_internal): Likewise. * pthread_getattr_np.c (pthread_getattr_np): Likewise.
2004-01-16  Richard Henderson  <rth@redhat.com>

        * elf/dl-load.c: Don't declare __libc_stack_end.
        * sysdeps/generic/libc-start.c: Likewise.
        * sysdeps/unix/sysv/linux/dl-execstack.c: Likewise.
        * sysdeps/generic/segfault.c: Likewise.  Include ldsodefs.h.
        * sysdeps/generic/backtrace.c: Likewise.
2004-01-16 08:07:01 +00:00
Ulrich Drepper 392a6b5265 Update.
2004-01-14  Ulrich Drepper  <drepper@redhat.com>

	* configure.in: Define HAVE_Z_RELRO if the linker supports -z relro.
	* config.h.in: Add entry for HAVE_Z_RELRO.
	* include/libc-symbols.h: Define attribute_relro.
	* elf/dl-load.c: Add attribute_relro to env_path_list, capstr, ncapstr,
	max_capstrlen, and max_dirnamelen definitions.
	* elf/rtld.c: Add attribute_relro to _dl_argc, _dl_argv, _dl_skip_args,
	load_time, start_time, library_path, preloadlist, version_info,
	any_debug.
	Remove rtld_total_time.  Make it a local variable.  Pass pointer to
	it to print_statistics.  Change print_statistics accordingly.
	* sysdeps/generic/dl-sysdep.c: Add attribute_relro to _dl_auxv.  Use
	attribute_relro instead of explicitly assigning variable to the
	.data.rel.ro section for __libc_enable_secure and __libc_stack_end.
	* sysdeps/generic/ldsodefs.h: Declare __libc_stack_end, _dl_argc,
	_dl_argv, _dl_argv_internal with attribute_relro.
2004-01-15 06:38:27 +00:00
Ulrich Drepper d1fc817ea4 Update.
2004-01-13  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/dl-execstack.c: Change interface.  Add
	challenge for caller.
	* sysdeps/generic/ldsodefs.h: Change declaration and type of hook
	member in rtld_global appropriately.
	* elf/dl-support.c: Likewise.
	* elf/dl-load.c (_dl_map_object_from_fd): Take additional paramter.
	Pass it on to the changed function.
	(_dl_map_object): Pass new parameter to _dl_map_object_from_fd.
2004-01-13 15:47:32 +00:00
Ulrich Drepper ed20b3d9cc Update.
2004-01-13  Ulrich Drepper  <drepper@redhat.com>

	* Makeconfig: Define relro-LDFLAGS if have-z-relro==yes.  Add it to
	LDFLAGS.so and LDFLAGS-rtld.
	(+link): Add relro-LDFLAGS.
	* Makeconfig (shlib.lds): Place __libc_subfreeres, __libc_atexit, and
	__libc_thread_subfreeres sections after .jcr section.
	* config.make.in: Add have-z-relro.
	* configure.in: Add check for -z relro option.
	* include/link.h (struct link_map): Add relro_addr and relro_size
	members.
	* elf/dl-load.c (_dl_map_object_from_fd): Recognize PT_GNU_RELRO.
	* elf/dl-reloc.c (_dl_relocate_object): At the end, make relro
	part of loaded segments read-only.
	* elf/elf.h: Define PT_GNU_RELRO.
	* elf/rtld.c (_dl_start): Recognize PT_GNU_RELRO of ld.so.
	(dl_main): Recognize PT_GNU_RELRO of the application.  Call
	_dl_debug_initialize and initialize l_info[DT_DEBUG] before
	relocations.
2004-01-13 08:36:54 +00:00
Ulrich Drepper 97fd3a3003 Update.
2003-11-25  Ulrich Drepper  <drepper@redhat.com>

	* posix/runptests.c (main): Make errors fatal.
	* posix/PTESTS: One test in GA135 and GA136 check functionality
	which seems not guaranteed.

2003-11-25  Jakub Jelinek  <jakub@redhat.com>

	* posix/regexec.c (re_search_internal): If prune_impossible_nodes
	returned REG_NOMATCH, set match_last to -1.  Don't initialize
	pmatch[0] needlessly.  Fix comment.
	(prune_impossible_nodes): Don't segfault on NULL state_log entry.
	(set_regs): Fix comment.
	* posix/regcomp.c (parse_bracket_exp): Only set has_plural_match
	if adding both SIMPLE_BRACKET and COMPLEX_BRACKET.
	(build_charclass_op): Set has_plural_match if adding both
	SIMPLE_BRACKET and COMPLEX_BRACKET.
	* posix/bug-regex11.c (tests): Fix register values for one commented
	out test.  Add new tests.

	* posix/regex_internal.c (re_string_allocate): Make sure init_len
	is at least dfa->mb_cur_max.
	(re_string_reconstruct): If is_utf8, don't fall back into
	re_string_skip_chars just because idx points into a middle of
	valid UTF-8 character.  Instead, set the wcs bytes which correspond
	to the partial character bytes to WEOF.
	* posix/regexec.c (re_search_internal): Allocate input.bufs_len + 1
	instead of dfa->nodes_len + 1 state_log entries initially.
	* posix/bug-regex20.c (main): Uncomment backwards case insensitive
	tests.
2003-11-26 03:24:15 +00:00