Go to file
Maciej W. Rozycki bac15a72fc elf: Accept absolute (SHN_ABS) symbols whose value is zero [BZ #23307]
We have this condition in `check_match' (in elf/dl-lookup.c):

  if (__glibc_unlikely ((sym->st_value == 0 /* No value.  */
                         && stt != STT_TLS)
                        || ELF_MACHINE_SYM_NO_MATCH (sym)
                        || (type_class & (sym->st_shndx == SHN_UNDEF))))
    return NULL;

which causes all !STT_TLS symbols whose value is zero to be silently
ignored in lookup.  This may make sense for regular symbols, however not
for absolute (SHN_ABS) ones, where zero is like any value, there's no
special meaning attached to it.

Consequently legitimate programs fail, for example taking the
`elf/tst-absolute-sym' test case, substituting 0 for 0x55aa in
`elf/tst-absolute-sym-lib.lds' and then trying to run the resulting
program we get this:

$ .../elf/tst-absolute-sym
.../elf/tst-absolute-sym: symbol lookup error: .../elf/tst-absolute-sym-lib.so: undefined symbol: absolute
$

even though the symbol clearly is there:

$ readelf --dyn-syms .../elf/tst-absolute-sym-lib.so | grep '\babsolute\b'
     7: 00000000     0 NOTYPE  GLOBAL DEFAULT  ABS absolute
$

The check for the zero value has been there since forever or commit
d66e34cd4234/08162fa88891 ("Implemented runtime dynamic linker to
support ELF shared libraries.") dating back to May 2nd 1995, and the
problem triggers regardless of commit e7feec374c ("elf: Correct
absolute (SHN_ABS) symbol run-time calculation [BZ #19818]") being
present or not.

Fix the issue then, by permitting `sym->st_value' to be 0 for SHN_ABS
symbols in lookup.

	[BZ #23307]
	* elf/dl-lookup.c (check_match): Do not reject a symbol whose
	`st_value' is 0 if `st_shndx' is SHN_ABS.
	* elf/tst-absolute-zero.c: New file.
	* elf/tst-absolute-zero-lib.c: New file.
	* elf/tst-absolute-zero-lib.lds: New file.
	* elf/Makefile (tests): Add `tst-absolute-zero'.
	(modules-names): Add `tst-absolute-zero-lib'.
	(LDLIBS-tst-absolute-zero-lib.so): New variable.
	($(objpfx)tst-absolute-zero-lib.so): New dependency.
	($(objpfx)tst-absolute-zero: New dependency.
2018-06-29 17:10:43 +01:00
argp Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
assert Fix uninitialized variable in assert_perror (bug 22761) 2018-02-05 11:06:15 +01:00
benchtests benchtests: Add -f/--functions argument 2018-06-12 09:10:42 -07:00
bits hurd: Fix shmid_ds's shm_segsz field type 2018-06-02 21:52:43 +02:00
catgets intl/tst-gettext: fix failure with newest msgfmt 2018-02-18 18:16:05 +01:00
ChangeLog.old Add missing reference to bug 21654 2017-10-07 13:14:36 +02:00
conform New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
crypt New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
csu Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
ctype Use libc_hidden_* for tolower, toupper (bug 15105). 2018-02-23 13:54:53 +00:00
debug libio: Avoid _allocate_buffer, _free_buffer function pointers [BZ #23236] 2018-06-01 10:41:03 +02:00
dirent Consolidate alphasort{64} and versionsort{64} implementation 2018-04-23 17:35:16 -03:00
dlfcn Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
elf elf: Accept absolute (SHN_ABS) symbols whose value is zero [BZ #23307] 2018-06-29 17:10:43 +01:00
gmon Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
gnulib Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
grp Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
gshadow Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
hesiod Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
htl hurd: Fix missing __pthread_get_cleanup_stack symbol 2018-06-16 10:52:04 +02:00
hurd hurd: Silence warning 2018-04-04 02:06:16 +02:00
iconv Fix s390 -Os iconv build. 2018-03-05 21:46:55 +00:00
iconvdata localedata: Make IBM273 compatible with ISO-8859-1 [BZ #23290] 2018-06-14 22:34:10 +02:00
include Remove macros extend_alloca, extend_alloca_account [BZ #18023] 2018-06-27 19:20:37 +02:00
inet manual: Revise crypt.texi. 2018-06-29 16:53:37 +02:00
intl intl/tst-gettext: fix failure with newest msgfmt 2018-02-18 18:16:05 +01:00
io Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
libio libio: Add tst-vtables, tst-vtables-interposed 2018-06-26 12:31:08 +02:00
locale Fix two more -Os strcoll / wcscoll build failures. 2018-02-27 16:55:42 +00:00
localedata ast_ES: Add alternative month names (bug 23140). 2018-06-29 12:36:53 +02:00
login Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
mach hurd: Avoid PLT references to syscalls 2018-06-16 02:50:36 +02:00
malloc malloc: Update heap dumping/undumping comments [BZ #23351] 2018-06-29 14:55:15 +02:00
manual New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
math Add a generic significand implementation 2018-06-20 18:15:06 -03:00
mathvec Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
misc Implement allocate_once for atomic initialization with allocation 2018-05-23 15:27:01 +02:00
nis nisplus: Correct pwent parsing issue and resulting build error [BZ #23266] 2018-06-27 21:12:16 +01:00
nptl Remove nptl/sockperf.c. 2018-06-27 17:01:06 +00:00
nptl_db nptl_db: Remove stale match_pid' parameter from iterate_thread_list' 2018-03-01 16:10:05 +00:00
nscd manual: Revise crypt.texi. 2018-06-29 16:53:37 +02:00
nss nss_files: Use struct scratch_buffer instead of extend_alloca [BZ #18023] 2018-06-25 19:48:01 +02:00
po Update translations from the Translation Project 2018-03-12 13:24:46 +00:00
posix manual: Revise crypt.texi. 2018-06-29 16:53:37 +02:00
pwd manual: Revise crypt.texi. 2018-06-29 16:53:37 +02:00
resolv Run thread shutdown functions in an explicit order 2018-06-26 15:27:12 +02:00
resource resource/tst-getrlimit.c: Add copyright header 2018-01-05 20:34:10 +01:00
rt hurd: Add hurd thread library 2018-04-02 01:44:14 +02:00
scripts Fix hardcoded /tmp paths in testing (bug 13888). 2018-06-26 21:48:48 +00:00
setjmp x86: Use pad in pthread_unwind_buf to preserve shadow stack register 2018-05-02 06:17:41 -07:00
shadow manual: Revise crypt.texi. 2018-06-29 16:53:37 +02:00
signal Add tst-sigaction.c to test BZ #23069 2018-04-26 22:21:13 +02:00
socket Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
soft-fp Make powerpc-nofpu __sqrtsf2, __sqrtdf2 compat symbols (bug 18473). 2018-06-01 17:25:12 +00:00
stdio-common Fix hardcoded /tmp paths in testing (bug 13888). 2018-06-26 21:48:48 +00:00
stdlib Disallow use of DES encryption functions in new programs. 2018-06-29 16:53:18 +02:00
streams Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
string Run thread shutdown functions in an explicit order 2018-06-26 15:27:12 +02:00
sunrpc Disallow use of DES encryption functions in new programs. 2018-06-29 16:53:18 +02:00
support support: Add TEST_NO_SETVBUF 2018-06-26 12:30:50 +02:00
sysdeps getifaddrs: Don't return ifa entries with NULL names [BZ #21812] 2018-06-29 09:44:55 +02:00
sysvipc Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
termios Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
time Use _STRUCT_TIMESPEC as guard in <bits/types/struct_timespec.h> [BZ #23349] 2018-06-28 13:12:16 +02:00
timezone Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcsmbs Add tests for sign of NaN returned by strtod (bug 23007). 2018-06-15 17:36:21 +00:00
wctype Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
.gitattributes Assume __NR_openat is always defined 2016-03-23 23:35:08 +01:00
.gitignore Add *.pyc to .gitignore 2015-05-18 15:26:26 +05:30
abi-tags Remove the bulk of the NaCl port. 2017-05-20 08:09:10 -04:00
aclocal.m4 LIBC_SLIBDIR_RTLDDIR: substitute arguments in single quotes 2018-01-25 17:20:28 +01:00
ChangeLog elf: Accept absolute (SHN_ABS) symbols whose value is zero [BZ #23307] 2018-06-29 17:10:43 +01:00
config.h.in Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247] 2018-05-23 15:27:24 +02:00
config.make.in New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
configure New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
configure.ac New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
COPYING Update to latest versions of GPL-2.0 and LGPL-2.1 2013-09-09 12:52:48 +10:00
COPYING.LIB Update to latest versions of GPL-2.0 and LGPL-2.1 2013-09-09 12:52:48 +10:00
extra-lib.mk Rename cppflags-iterator.mk to libof-iterator.mk, remove extra-modules.mk. 2017-05-09 07:06:29 -04:00
gen-locales.mk Improve gen-locales.mk and gen-locale.sh to make test files with @ options work 2018-02-27 17:01:57 +01:00
INSTALL New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
libc-abis A few more archs have IFUNC support. 2010-03-17 02:43:12 -07:00
libof-iterator.mk Rename cppflags-iterator.mk to libof-iterator.mk, remove extra-modules.mk. 2017-05-09 07:06:29 -04:00
LICENSES Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247] 2018-05-23 15:27:24 +02:00
MAINTAINERS Add MAINTAINERS 2017-05-11 13:38:30 -04:00
Makeconfig New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
Makefile Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Makefile.in New make target to only build benchmark binaries 2016-04-20 10:23:28 +05:30
Makerules Run thread shutdown functions in an explicit order 2018-06-26 15:27:12 +02:00
NEWS New configure option --disable-crypt. 2018-06-29 16:53:47 +02:00
o-iterator.mk
README Remove tilegx port. 2018-04-27 19:11:24 +00:00
Rules Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
shlib-versions Extend NSS test suite 2017-07-17 15:52:44 -04:00
test-skeleton.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
version.h Open master branch for glibc 2.28 development 2018-02-01 17:18:19 +00:00

This directory contains the sources of the GNU C Library.
See the file "version.h" for what release version you have.

The GNU C Library is the standard system C library for all GNU systems,
and is an important part of what makes up a GNU system.  It provides the
system API for all programs written in C and C-compatible languages such
as C++ and Objective C; the runtime facilities of other programming
languages use the C library to access the underlying operating system.

In GNU/Linux systems, the C library works with the Linux kernel to
implement the operating system behavior seen by user applications.
In GNU/Hurd systems, it works with a microkernel and Hurd servers.

The GNU C Library implements much of the POSIX.1 functionality in the
GNU/Hurd system, using configurations i[4567]86-*-gnu.

When working with Linux kernels, this version of the GNU C Library
requires Linux kernel version 3.2 or later.

Also note that the shared version of the libgcc_s library must be
installed for the pthread library to work correctly.

The GNU C Library supports these configurations for using Linux kernels:

	aarch64*-*-linux-gnu
	alpha*-*-linux-gnu
	arm-*-linux-gnueabi
	hppa-*-linux-gnu
	i[4567]86-*-linux-gnu
	x86_64-*-linux-gnu	Can build either x86_64 or x32
	ia64-*-linux-gnu
	m68k-*-linux-gnu
	microblaze*-*-linux-gnu
	mips-*-linux-gnu
	mips64-*-linux-gnu
	powerpc-*-linux-gnu	Hardware or software floating point, BE only.
	powerpc64*-*-linux-gnu	Big-endian and little-endian.
	s390-*-linux-gnu
	s390x-*-linux-gnu
	riscv64-*-linux-gnu
	sh[34]-*-linux-gnu
	sparc*-*-linux-gnu
	sparc64*-*-linux-gnu

If you are interested in doing a port, please contact the glibc
maintainers; see http://www.gnu.org/software/libc/ for more
information.

See the file INSTALL to find out how to configure, build, and install
the GNU C Library.  You might also consider reading the WWW pages for
the C library at http://www.gnu.org/software/libc/.

The GNU C Library is (almost) completely documented by the Texinfo manual
found in the `manual/' subdirectory.  The manual is still being updated
and contains some known errors and omissions; we regret that we do not
have the resources to work on the manual as much as we would like.  For
corrections to the manual, please file a bug in the `manual' component,
following the bug-reporting instructions below.  Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.

Please see http://www.gnu.org/software/libc/bugs.html for bug reporting
information.  We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.

The GNU C Library is free software.  See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
these additional notices to be distributed.  License copyright years may be
listed using range notation, e.g., 1996-2015, indicating that every year in
the range, inclusive, is a copyrightable year that would otherwise be listed
individually.