Age | Commit message (Collapse) | Author |
|
Conflicts:
ChangeLog
src/rtld/dl-lookupX.h
testsuite/functions.sh
testsuite/order.sh
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
before the commit (a89297f08cda5ca48d21088891150e7ccc9ddac3) the system would
report:
COPY relocations don't point into .bss or .sbss section
Now, it often reports:
file offsets not monotonically increasing
This was tracked down (using this debug code) to the .gnu.conflict section
being added. In one example the offset ranges ended up being:
../src/prelink: section 15 .fini file offset range 000012f4 and 000012fd
../src/prelink: section 16 .gnu.conflict file offset range 00001300 and 00002080
../src/prelink: section 17 .rodata file offset range 00002000 and 000020a3
../src/prelink: section 18 .eh_frame_hdr file offset range 000020a4 and 00002118
This indicates that the new .gnu.conflict section overwrites .rodata by 0x80
bytes.
This commit includes a check and error return for this condition.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Otherwise, there's no way to validate whether or not the operation
was actually successful without rescanning.
Signed-off-by: Kyle Russell <bkylerussell@gmail.com>
Added ChangeLog entry
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Many host ld.so seem to have a broken 'depth-first' search, not 'breadth-first'
as required by the ELF spec. See:
http://refspecs.linuxbase.org/elf/gabi4+/ch5.dynamic.html
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
If the compiler and don't support protected symbols in certain relocations,
and error may occur such as:
relocation R_X86_64_PC32 against protected symbol `foo' can not be used when making a shared object
Detect this and skip the test if it is not possible to run.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
The info->resolvetls might be NULL according to src/prelink.c:
[snip]
/* Dynamic linker does not depend on any other library,
all symbols resolve to themselves with the exception
of SHN_UNDEF symbols which resolve to 0. */
if (info->symtab[r_sym].st_shndx == SHN_UNDEF)
{
info->resolveent = NULL;
info->resolvetls = NULL;
[snip]
So we must check it before use its members, otherwise, there might be
Segmentation fault error.
Fixed:
MACHINE = "qemumips"
IMAGE_INSTALL_append = " qemu"
$ bitbake core-image-minimal
[snip]
| /path/to/qemumips-poky-linux/core-image-minimal/1.0-r0/temp/run.prelink_image.1000: line 111: 1010 Segmentation fault (core dumped) /path/to/qemumips-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/sbin/prelink --root /path/to/qemumips-poky-linux/core-image-minimal/1.0-r0/rootfs -amR -N -c /etc/prelink.conf --dynamic-linker $dynamic_loader
[snip]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Added ChangeLog
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
COPY relocs are fine to have in PIE executables (as opposed to
shared libraries).
By enabling prelink on PIEs we achieve a few goals:
- prelink more PIE files on system: nicer for uniformity,
- avoid spurious warnings about shared libraries with COPY relocs
It's usefult to prelink PIEs when kernel ASLR is disabled:
kernel.randomize_va_space=0 + PIE-randomization patches.
I have gcc built as `--enable-default-pie` (generates PIE
executables by default).
Testsute results before the change:
PASS: 14
FAIL: 31
After the change:
PASS: 32
FAIL: 13
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Added ChangeLog entry
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Before the change one test failed due to timestamp drift:
FAIL: shuffle7.sh
This happens because prelinking takes time on the file
and timestamp differs slightly.
Avoid timestamp drift by overriding real timestamp
with PRELINK_TIMESTAMP variable.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Added ChangeLog entry
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Prelink testsuite/unprel1.sh needs to use $RUN to work correctly for cross
testing.
mhatle changes:
Added ChangeLog to Joseph's commit.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
binutils-2.28 (17026142ef35b62ac88bfe517b4160614902cb28) adds support
for copying read-only dynamic symbols into .data.rel.ro instead of .bss
since .bss is technically writable. This causes prelink to error out on
any binary containing COPY relocations in .data.rel.ro.
Read-only variables defined in shared libraries should be copied directly
into the space allocated for them in .data.rel.ro by the linker.
To achieve this, we determine whether either of the two sections
containing copy relocations is .data.rel.ro. If so, we relocate the
symbol memory directly into the existing section instead of constructing
a new .(s)dynbss section once prelink_build_conflicts() returns.
Fixes cxx1.sh, cxx2.sh, and cxx3.sh on Fedora 28 (which uses
binutils-2.29).
Signed-off-by: Kyle Russell <bkylerussell@gmail.com>
DCO for Kyle added per email on YP list.
Added ChangeLog entry.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Avoids rtld segfault when _dl_lookup_symbol_x is called with NULL
for skip_map on a protected symbol relocation.
Global protected symbols may not actually require a copy relocaton,
in which case skip_map is undefined, so use the undef_map to determine
the symbol arch.
Signed-off-by: Kyle Russell <bkylerussell@gmail.com>
DCO for Kyle added per email on YP list.
Added ChangeLog entry.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Conflicts:
src/elf.h
src/rtld/dl-tls.c
src/rtld/rtld.c
|
|
2018-08-29 Khem Raj <raj.khem@gmail.com>
* src/elf.h: Add RISC-V defines
* src/rtld/dl-tls.c: Add RISC-V support
* src/rtld/rtld.c: Add RISC-V support
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
According to struct elf32_hd, the e_shnum is section header number, and the
index is e_shstrndx, not e_shnum.
This can fix segmention fault when handle libqb.so.0.18.2 from libqb_1.0.3.
It fails to handle libqb.so.0.18.2 and get errors:
Symbol section index outside of section numbers
Then segmentation fault, this is because the e_shnum is 34, while e_shstrndx is
27 (it would be 33 when no errors), I've checked several elf files to confirm
that the ones after e_shstrndx is NULL, so use e_shstrndx should be correct.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Conflicts:
src/rtld/rtld.c
|
|
The layout1 test case currently fails for x32 because there is
insufficient address space for all the libraries.
There's two ways to fix this:
1. Increase mmap_end such that there's more space.
2. Reduce max_page_size so that less space is wasted.
I'm not sure what the implications of option 2 would be, so the attached
patch implements option 1.
This still limits the number of possible libraries somewhat severely,
but it's more than enough to pass the layout1 test.
Andrew
2016-12-16 Andrew Stubbs <ams@codesourcery.com>
* src/arch-x86_64.c (PL_ARCH(x32)): Set mmap_end to 0x60000000.
|
|
The ifunc1, ifunc2, and ifunc3 tests currently fail on x86_64 x32 ABI
because the testcase crashes at runtime. The testcases run fine when not
prelinked.
In the case of ifunc1, the test tries to call the "lib2t2" function
directly, instead of using it as an indirect call, which leads to the
testcase aborting. In real code this would not cause an immediate crash,
but presumably would lead to undefined behaviour.
The attached patch fixes the problem by converting R_X86_64_32 conflict
relocations to R_X86_64_IRELATIVE (in the same way as R_X86_64_64
relocations are).
I've tested this with the cross_prelink branch and a suitably configured
cross-toolchain. I expect it would be fine on the master branch also,
but I can't test that.
Andrew Stubbs
Mentor Graphics/CodeSourcery
2016-12-09 Andrew Stubbs <ams@codesourcery.com>
* src/arch-x86_64.c (x86_64_prelink_conflict_rela): Also convert
R_X86_64_32 conflicts to R_X86_64_IRELATIVE for ifuncs.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Cross-prelink's prelink-rtld is missing suport for the /libx32
directory used with the x86_64 x32 ABI. This patch adds such support.
2016-09-14 Joseph Myers <joseph@codesourcery.com>
* src/rtld/rtld.c (load_ld_so_conf): Add argument use_x32.
(main): Update call to load_ld_so_conf.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
prelink-rtld may report an "error while loading shared libraries" for
the wrong library.
If some set of DT_NEEDED DSOs are not in the default search path, they
may have a dso_list entry added, but no matching entry is added to the
needed_list. This causes the linker to miscalculate the max number of
dsos during build_local_scope(), which later causes find_needed() to not
search the entire l_local_scope[0]->r_list during
_dl_check_map_versions() (since the max from build_local_scope() becomes
l_local_scope[0]->r_nlist).
Since find_needed() searches through the r_list, which would have the
dso_list entries for the libraries that weren't found earlier, this cuts
the search short, meaning libraries near the end of the local scope don't
get included in the map version search.
As the comment in _dl_check_map_versions() suggests, if needed is NULL,
that means a dependency was not found and no stub entry created, which
should never happen.
Signed-off-by: Kyle Russell <bkylerussell@gmail.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Conflicts:
src/rtld/dl-tls.c
src/rtld/rtld.c
testsuite/reloc8.sh
testsuite/reloc9.sh
|
|
On modern Linux hosts, the prelink.pdf doesn't seem to work reliably.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Add definitions/config to support MicroBlaze, using glibc-2.24 as
reference.
Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Added ChangeLog entry.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-08-19 Mark Hatle <mark.hatle@windriver.com>
* README, testsuite/reloc8.sh, testsuite/reloc9.sh:
update to expand on reloc8 and reloc9 failures
Reloc8/9 failures appear to be as a result of a binutils failure. The change
to the test suite shows that the reloc8/9 did not work before prelinking.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-08-17 Mark Hatle <mark.hatle@windriver.com>
* README: Update to include a few known issues
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-08-17 Mark Hatle <mark.hatle@windriver.com>
* src/rtld/dl-open.c: Change to work with older compilers
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Some linkers create a binary which has a section header table that is
not in section header offset order. However, as noted in check_dso(),
several routines in prelink and in libelf-0.7.0 too rely on sh_offsets
monotonically increasing, and if that fails then prelink quits. But
the check is only on dso's, not binaries. For binaries, fdopen_dso()
reorders the section headers to section header offset order prior to
work on the section data, so that the new prelinked binary is written
in section order.
However, on subsequent prelinks of a prelinked binary, the
prelink_exec() works on the undone section, not the fdopen_dso()
reordered sections, and may construct a section header table with
section orders different than the first prelink of the binary.
The function below tests for that case and resets the section header
order to the offset order by enforcing the binutils linker change:
'The net effect is .shstrab section is now placed after .symtab and
.strtab sections'. See binutils-gdb.git commit 3e19fb8f990e4c.
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
2016-06-03 Dave Lerner <dave.lerner@windriver.com>
* src/exec.c: New check_reorder_needed, section_reorder_fix functions
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-03-22 Mark Hatle <mark.hatle@windriver.com>
* src/gather.c, src/get.c: Fix LD_PRELOAD
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-03-18 Donn Seeley <donn.seeley@windriver.com>
* src/rtld/rtld.c: rewrite build_local_scope to ensure breadth-first
processing
* testsuite/order: Add test to verify prelink/prelink-rtld resolution
order
This problem was causing a conflict in the Yocto Project between 'fork'
from libc and libpthread. See Yocto Project bug 9131.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-03-18 Mark Hatle <mark.hatle@windriver.com>
* src/rtld/rtld.h, src/dso.c: Fix compilation warning
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-03-18 Mark Hatle <mark.hatle@windriver.com>
* dl-open.c, rtld.h, Makefile.am: Add _dl_show_scope function
* rtld.c: Use _dl_show_scope if RTLD_DEBUG=scopes defined
Generate a scope for the exectuable
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-03-10 Mark Hatle <mark.hatle@windriver.com>
* dl-load.c: Fix segfault on empty dso entry
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2016-03-10 Mark Hatle <mark.hatle@windriver.com>
* rtld/: Rsync to glibc-2.23 (no functional changes)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Resolves an issue:
configure.ac:8: warning: AM_INIT_AUTOMAKE: two- and three-arguments
change based on a patch from Vaneet Narang <v.narang@samsung.com>
and Maninder Singh <maninder1.s@samsung.com>
Add AC_CONFIG_MACRO_DIR([m4]) to configure.ac to resolve warning.
Quote AC_LIBELF_SXWORD in m4/libelf.m4 to resolve:
warning: underquoted definition of AC_LIBELF_SXWORD in m4/libelf.m4
In Makefile.am files, replace INCLUDES w/ AM_CPPFLAGS as appropriate.
Remove 'AUTOMAKE_OPTIONS = 1.4 gnu', no longer necessary.
2016-03-10 Mark Hatle <mark.hatle@windriver.com>
* configure.ac, m4/libelf.m4, doc/Makefile.am, gelf/Makefile.am,
gelfx/Makefile.am, gelfx32/Makefile.am, patches/Makefile.am,
src/Makefile.am, src/rtld/Makefile.am, testsuite/Makefile.am:
Update to avoid autoconf/automake warnings
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Add back missing preload1 test, and remove $RUN from reloc4.sh
Also correct prior ChangeLog entries that should have been
sanitized.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
In the original ARM IFUNC support, it appears a small chunk of code in the
arm_prelink_conflict_rela function was missed. This commit adds the missing
code from the original work.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1009601
2015-10-29 Mark Hatle <mark.hatle@windriver.com>
Kyle McMartin <kmcmartin@redhat.com>
Jakub Jelinek <jakub@redhat.com>
Julian Brown <julian@codesourcery.com>
* testsuite/ifunc.h: Fix missing #
* src/arch-arm.c (arm_prelink_conflict_rela): Add missing hunk
that implemented R_ARM_IRELATIVE, and ifunc conflicts.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1009601
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
|
|
2015-10-28 Mark Hatle <mark.hatle@windriver.com>
* Merge with cross_prelink
* Strip out the cross compilation bits to generate a standalone
prelink project
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
MIPS has added a new SHT_MIPS_ABIFLAGS section, which the prelinker did not
know it could skip. Add this to the list of items to be OK to skip.
2015-10-29 Mark Hatle <mark.hatle@windriver.com>
* prelink.h: Define SHT_MIPS_ABIFLAGS if not set
* prelink.c: OK to skip SHT_MIPS_ABIFLAGS
optimize the loop to stop on the first bad entry
adjust the error to give us more info on the bad section
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
No actual change in the defined value occurs, but the format on both sides
of the interface (rtld and prelinker) are now using the same define.
2015-10-28 Mark Hatle <mark.hatle@windriver.com>
* get.c: Sync rtld/prelink type_class values
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2015-10-28 Mark Hatle <mark.hatle@windriver.com>
* dl-lookupX.h: Sync with glibc fix for ld.so / prelink mismatch
2015-10-28 H.J. Lu <hongjiu.lu@intel.com>
[BZ #19178]
* elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
(RTYPE_CLASS_PLT): Likewise.
(RTYPE_CLASS_COPY): Likewise.
(RTYPE_CLASS_TLS): Likewise.
(_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
to set relocation type class for DL_DEBUG_PRELINK. Clear the
ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit for DL_DEBUG_PRELINK.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
The upstream project appears to be dead now. So switch to a more git friendly
directory, no reason to maintain the SVN trunk any longer.
2015-10-22 Mark Hatle <mark.hatle@windriver.com>
* Upstream project appears to have been abandoned
* Update the project to remove the SVN like 'trunk' dir
* Adjust the AUTHORS file
* Move the README.cross to replace README and update it
* Move the previous ChangeLog to ChangeLog.1
* Move the current ChangeLog.cross to ChangeLog
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2015-10-21 Mark Hatle <mark.hatle@windriver.com>
* get.c, prelink.h: Add symname to conflict structure
* conflict.c: Provide more debuggign on a conflict (symname)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
2015-10-21 Mark Hatle <mark.hatle@windriver.com>
* rtld/rtld.c:
Update debug msg
Fix missing dso_list->map = NULL
* rtld/dl-lookupX.h:
update debug msgs
* rtld/dl-load.c: (create_map_object_from_dso_ent) Add ld.so like debug
When an executable sets a load address use it
Update the load address calculation, prevents visual overlaps
* rtld/dl-version.c: update debug msgs
* rtld/rtld.h: define _dl_debug_printf to act like ld.so debug
define RTLD_DEBUG_PID to set the debug prefix
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|