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 e7feec374c63 ("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
..
2018-02-21 10:42:48 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-04-04 23:09:37 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-06-27 17:55:56 +02:00
2018-06-12 11:07:56 -04:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-04 18:46:24 +01:00
2018-06-12 23:35:06 -04:00
2018-01-01 00:32:25 +00:00
2018-06-29 17:10:43 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-06-12 09:53:04 -04:00
2018-01-01 00:32:25 +00:00
2018-02-21 10:37:22 +01:00
2018-01-01 00:32:25 +00:00
2018-06-12 09:53:04 -04:00
2018-01-01 00:32:25 +00:00
2018-05-29 06:33:57 -07:00
2018-01-01 00:32:25 +00:00
2018-04-04 23:09:37 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-03-11 13:06:33 +01:00
2018-01-01 00:32:25 +00:00
2018-04-04 23:09:37 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-06-21 20:44:43 +00:00
2018-01-01 00:32:25 +00:00
2016-01-07 04:03:21 -05:00
2018-02-05 14:58:57 -08:00
2016-12-26 10:08:41 +01:00
2016-12-26 10:08:41 +01:00
2016-12-26 10:08:41 +01:00
2016-12-26 10:08:41 +01:00
2016-12-26 10:08:41 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:41:16 +00:00
2018-01-01 00:41:16 +00:00
2018-01-01 00:32:25 +00:00
2017-06-27 17:52:42 +00:00
2018-06-29 17:10:43 +01:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:41:16 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-06-12 09:53:04 -04:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-03-01 20:33:46 -05:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:41:16 +00:00
2018-01-01 00:41:16 +00:00
2018-01-01 00:32:25 +00:00
2017-06-14 10:47:25 +09:30
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-04-04 23:09:37 +01:00
2018-04-04 23:09:37 +01:00
2018-04-04 23:09:37 +01:00
2018-06-29 17:10:43 +01:00
2018-06-29 17:10:43 +01:00
2018-06-29 17:10:43 +01:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-02-16 17:33:18 -05:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-05-05 18:08:27 -07:00
2018-05-05 18:08:27 -07:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-12-15 20:22:29 -08:00
2018-01-04 18:46:24 +01:00
2018-01-04 18:46:24 +01:00
2018-01-04 18:46:24 +01:00
2018-01-04 18:46:24 +01:00
2018-06-29 16:53:47 +02:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2015-11-14 12:00:38 -08:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2017-09-30 01:39:32 -07:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2017-04-05 10:34:58 -03:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-04-05 10:34:58 -03:00
2015-10-19 22:34:20 +00:00
2015-10-19 22:34:20 +00:00
2017-04-05 10:34:58 -03:00
2015-10-19 22:34:20 +00:00
2015-10-19 22:34:20 +00:00
2018-01-04 18:46:24 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00