about summary refs log tree commit diff
path: root/elf/tst-pldd.c
Commit message (Collapse)AuthorAgeFilesLines
* elf: Fix tst-pldd for non-default --prefix and/or --bindir (BZ#24544)Adhemerval Zanella2019-05-141-1/+5
| | | | | | | | | | | | | | Use a new libsupport support_bindir_prefix instead of a hardcoded /usr/bin to create the pldd path on container directory. Checked on x86_64-linux-gnu with default and non-default --prefix and --bindir paths, as well with --enable-hardcoded-path-in-tests. [BZ #24544] * elf/tst-pldd.c (do_test): Use support_bindir_prefix instead of pre-defined value. Reviewed-by: DJ Delorie <dj@redhat.com>
* elf: Fix elf/tst-pldd with --enable-hardcoded-path-in-tests (BZ#24506)Adhemerval Zanella2019-05-021-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | The elf/tst-pldd (added by 1a4c27355e146 to fix BZ#18035) test does not expect the hardcoded paths that are output by pldd when the test is built with --enable-hardcoded-path-in-tests. Instead of showing the ABI installed library names for loader and libc (such as ld-linux-x86-64.so.2 and libc.so.6 for x86_64), pldd shows the default built ld.so and libc.so. It makes the tests fail with an invalid expected loader/libc name. This patch fixes the elf-pldd test by adding the canonical ld.so and libc.so names in the expected list of possible outputs when parsing the result output from pldd. The test now handles both default build and --enable-hardcoded-path-in-tests option. Checked on x86_64-linux-gnu (built with and without --enable-hardcoded-path-in-tests) and i686-linux-gnu. * elf/tst-pldd.c (in_str_list): New function. (do_test): Add default names for ld and libc as one option. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* elf: Fix pldd (BZ#18035)Adhemerval Zanella2019-04-231-0/+118
Since 9182aa67994 (Fix vDSO l_name for GDB's, BZ#387) the initial link_map for executable itself and loader will have both l_name and l_libname->name holding the same value due: elf/dl-object.c 95 new->l_name = *realname ? realname : (char *) newname->name + libname_len - 1; Since newname->name points to new->l_libname->name. This leads to pldd to an infinite call at: elf/pldd-xx.c 203 again: 204 while (1) 205 { 206 ssize_t n = pread64 (memfd, tmpbuf.data, tmpbuf.length, name_offset); 228 /* Try the l_libname element. */ 229 struct E(libname_list) ln; 230 if (pread64 (memfd, &ln, sizeof (ln), m.l_libname) == sizeof (ln)) 231 { 232 name_offset = ln.name; 233 goto again; 234 } Since the value at ln.name (l_libname->name) will be the same as previously read. The straightforward fix is just avoid the check and read the new list entry. I checked also against binaries issues with old loaders with fix for BZ#387, and pldd could dump the shared objects. Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, and powerpc64le-linux-gnu. [BZ #18035] * elf/Makefile (tests-container): Add tst-pldd. * elf/pldd-xx.c: Use _Static_assert in of pldd_assert. (E(find_maps)): Avoid use alloca, use default read file operations instead of explicit LFS names, and fix infinite loop. * elf/pldd.c: Explicit set _FILE_OFFSET_BITS, cleanup headers. (get_process_info): Use _Static_assert instead of assert, use default directory operations instead of explicit LFS names, and free some leadek pointers. * elf/tst-pldd.c: New file.