[RTEMS Project] #3741: libdl loadinf ELF objects from libbsd NFS file system ends in a deadlock (was: libdl load of ELF objects on NFS file system lock up)

RTEMS trac trac at rtems.org
Thu May 2 01:45:27 UTC 2019


#3741: libdl loadinf ELF objects from libbsd NFS file system ends in a deadlock
-----------------------------------+--------------------------
 Reporter:  dufault                |       Owner:  Chris Johns
     Type:  defect                 |      Status:  accepted
 Priority:  normal                 |   Milestone:  5.1
Component:  lib/dl                 |     Version:  5
 Severity:  normal                 |  Resolution:
 Keywords:  run-time-loader libdl  |  Blocked By:
 Blocking:                         |
-----------------------------------+--------------------------

Comment (by Chris Johns):

 I have:

 1. Implemented caching any reloc record that could result in a trampoline
 using the unresolved table. This table is suitable for the purpose. I have
 not refactored the unresolved code to relabel the code to be common to
 unresolved and trampolines at this point in time, I have simply added the
 trampoline code to the unresolved code with a separate RTL internal header
 to isolate the interface.
 1. Increased the block size for the unresolved table from 64 to 256 and a
 block is allocated when in the resolved table is opened and one block is
 always held. It is not clear to me how many tramp reloc records a large
 object file or an incrementally link object file could have.
 1. Added per object file trampoline stats to help track what is happening.

 The output for the PowerPC psim BSP for test `dl09` with the test hacked
 to show the trampoline stats is:
 {{{
 RTL List:
  /dl09-o1.o
   trampolines:
       slots     : 3
       size      : 48
       slot size : 16
       used      : 1
       relocs    : 0
       unresolved: 3
       yield     : 33%
  /dl09-o2.o
   trampolines:
       slots     : 7
       size      : 112
       slot size : 16
       used      : 7
       relocs    : 6
       unresolved: 1
       yield     : 100%
  /dl09-o5.o
   trampolines:
       slots     : 6
       size      : 96
       slot size : 16
       used      : 6
       relocs    : 6
       unresolved: 0
       yield     : 100%
  /dl09-o3.o
   trampolines:
       slots     : 37
       size      : 592
       slot size : 16
       used      : 13
       relocs    : 12
       unresolved: 25
       yield     : 35%
  /dl09-o4.o
   trampolines:
       slots     : 8
       size      : 128
       slot size : 16
       used      : 8
       relocs    : 7
       unresolved: 1
       yield     : 100%
 }}}
 The `dl09` test is a bit special because it does a large heap allocation
 between the loading of each  object modules so the yields are close to
 100%. The yield indicates how successful the slot usage is. There is an
 element of estimation in the allocation size of the table.

 Note, ` /dl09-o3.o` exposes a new issue related to the way the unresolved
 external trampoline slots are managed. This file has a yield of 35%
 because there are 25 unresolved relocation records. Most of these turn out
 to be small data (SDATA) relocations and do not need trampolines because
 they are in the small data section which is limited in size and these are
 for data which can be jumped too.

 If we look at test `dl08` we get:
 {{{
 RTL List:
  /dl08-o1.o
   trampolines:
       slots     : 1
       size      : 16
       slot size : 16
       used      : 0
       relocs    : 0
       unresolved: 1
       yield     : 0%
  /libdl08_1.a:dl08-o2.o
   trampolines:
       slots     : 1
       size      : 16
       slot size : 16
       used      : 0
       relocs    : 0
       unresolved: 1
       yield     : 0%
  /libdl08_2.a:dl08-o3.o
   trampolines:
       slots     : 25
       size      : 400
       slot size : 16
       used      : 0
       relocs    : 0
       unresolved: 25
       yield     : 0%
  /libdl08_1.a:dl08-o4.o
   trampolines:
       slots     : 1
       size      : 16
       slot size : 16
       used      : 0
       relocs    : 0
       unresolved: 1
       yield     : 0%
  /libdl08_2.a:dl08-o6-123456789-123456789.o
   trampolines: no slots allocated
  /libdl08_2.a:dl08-o5.o
   trampolines:
       slots     : 1
       size      : 16
       slot size : 16
       used      : 0
       relocs    : 0
       unresolved: 1
       yield     : 0%
 }}}
 Notice we have a yield of 0% because no trampolines are needed and
 everything is within range. Again we have the same issue noted above with
 `/libdl08_2.a:dl08-o3.o`.

--
Ticket URL: <http://devel.rtems.org/ticket/3741#comment:3>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list