#2754 closed defect (fixed)

no .strtab section

Reported by: Patrick Gauvin Owned by: Chris Johns
Priority: normal Milestone: 5.1
Component: lib/dl Version: 4.11
Severity: major Keywords:
Cc: Ryan Slabaugh Blocked By:
Blocking:

Description

dlopen on the object generated by libfoo.cpp in the attached test case fails and results in the error no .strtab section. readelf shows that the section is present, though:

readelf -S libfoo.o | grep strtab
(standard input):97:  [92] .shstrtab         STRTAB          00000000 001fb0 00040c 00      0   0  1
(standard input):99:  [94] .strtab           STRTAB          00000000 0018b0 00019e 00      0   0  1

Steps to Reproduce (you may have to edit BSP_DIR in the Makefile):

make clean all
qemu-system-arm -m 256M -M xilinx-zynq-a9 -serial null -serial mon:stdio \
    -nographic -no-reboot -kernel libdl-strtab-test.exe

Expected Output:

TEST BEGIN
dlopen: no .strtab section
assertion "handle != NULL" failed: file "libdl-strtab-test.c", line 46, function: POSIX_Init

Development Environment:

  • RTEMS Version: 4.11 (Branch "4.11", commit 3f72dda6ee518d3ea04341ad4df079ecb1895ef7) with the dlerror patches from #2747, and the attached ARM PREL31 support patch (I will be making a separate ticket for this with test code soon).
  • System Type: ARM Cortex-A9, xilinx_zynq_a9_qemu BSP
  • GCC Version:

arm-rtems4.11-gcc (GCC) 4.9.3 20150626 (RTEMS 4.11, RSB 1675a733536d1aec2020011e5e522497a442561a (HEAD, origin/4.11, 4.11), Newlib 2.2.0.20150423)

  • RTEMS Configure Options:

--target=arm-rtems4.11 --enable-rtemsbsp="xilinx_zynq_a9_qemu xilinx_zynq_zedboard xilinx_zynq_csp_cots xilinx_zynq_csp_hybrid" --enable-tests=samples --enable-posix --prefix=$HOME/development/rtems/4.11 --disable-networking

Attachments (3)

libdl-prel31-arm.patch (2.3 KB) - added by Patrick Gauvin on Jul 11, 2016 at 12:12:28 AM.
libdl-strtab-test.tar.gz (1.9 KB) - added by Patrick Gauvin on Jul 20, 2016 at 8:17:07 PM.
fixed linking and made sure all symbols resolved
rtems-libdl-obj-cache-disable.patch (1.2 KB) - added by Patrick Gauvin on Jul 20, 2016 at 8:17:38 PM.
workaround for this issue

Download all attachments as: .zip

Change History (10)

Changed on Jul 11, 2016 at 12:12:28 AM by Patrick Gauvin

Attachment: libdl-prel31-arm.patch added

Changed on Jul 20, 2016 at 8:17:07 PM by Patrick Gauvin

Attachment: libdl-strtab-test.tar.gz added

fixed linking and made sure all symbols resolved

Changed on Jul 20, 2016 at 8:17:38 PM by Patrick Gauvin

workaround for this issue

comment:1 Changed on Jul 20, 2016 at 8:26:35 PM by Patrick Gauvin

I've narrowed down the problem to a corrupted section name for .strtab being retrieved by rtems_rtl_obj_cache_read in rtems_rtl_elf_parse_sections. The offset to the name in the file was correct, but garbage was returned. The attached patch effectively disables the caching functionality of rtems_rtl_obj_cache_read, allowing the test to load the object successfully and generate this output:

TEST BEGIN
dlopen:
TEST END

comment:2 Changed on Aug 12, 2016 at 9:31:12 AM by Chris Johns

Is this to be fixed on the 4.11 branch as well?

comment:3 Changed on Aug 12, 2016 at 3:58:59 PM by Joel Sherrill

Patrick should answer from their perspective. But I think it should.

But from what I know of Patrick's application, we would strongly encourage them to move to the master to get greater stability on the SMP and maturity on rtems-libbsd.

comment:4 in reply to:  2 Changed on Aug 13, 2016 at 6:07:54 PM by Patrick Gauvin

chrisj:

Is this to be fixed on the 4.11 branch as well?

It is desirable, especially if the patches for master don't apply cleanly to 4.11.

joel.sherrill:

Patrick should answer from their perspective. But I think it should.

But from what I know of Patrick's application, we would strongly encourage them to move to the master to get greater stability on the SMP and maturity on rtems-libbsd.

This project is likely locked to 4.11, but I will recommend it.

comment:5 Changed on Aug 15, 2016 at 8:09:16 AM by Chris Johns <chrisj@…>

Resolution: fixed
Status: newclosed

In 35edf82463f33d30e6bbbbbbafe3aadd80acffbb/rtems:

libdl: Fix cache corruption bugs.

This patch fixes a number of bugs in the cache when requests are
made to read close to the end of the file and the data is copied
from the top of the cache buffer to the bottom of the buffer. This
was compounded by attempting to read past the end of the file.

Closes #2754.

comment:6 Changed on Mar 27, 2017 at 6:50:20 AM by Chris Johns

Milestone: 4.12.0

comment:7 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.