Changeset 10881


Ignore:
Timestamp:
Sep 26, 2008, 1:42:45 PM (11 years ago)
Author:
gb
Message:

In the extremely troublesome SONAME-PTR-FROM-LINK-MAP: dynamic entries
may be in the high end of the address space, so be careful about signedness.
There were/are issues with Linux's use of the Elf*_Dyn_D_un union: sometimes
(when a vdso is involved) the DT_STRTAB is a signed displacement relative
to to the link map's l_addr value, most other times its an absolute address,
(The ELF spec that I've seen says that it should always be an absolute
address; both FreeBSD and Solaris seem to always set it to a relative
offset.) If, when interpreted as an address, it's between the l_addr of
the map and the dynamic entry, treat it as an address, otherwise, fall
back on the older heuristic based on the apparent sign.

I don't like any of this (guessing), but this seems to allow the shared
lib init stuff to work on the 2.6.24 sytem that I have access to and
hopefully closes ticket:338.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-cfm-support.lisp

    r10873 r10881  
    175175                                 (%inc-ptr (pref map :link_map.l_addr) disp)
    176176                                 #-(or freebsd-target solaris-target)
    177                                  (%int-to-ptr
    178                                   (if (< disp 0)
    179                                     (+ disp (pref map :link_map.l_addr))
    180                                     disp))))))
     177                                 (let* ((udisp #+32-bit-target (pref dynamic-entries
     178                                                                     :<E>lf32_<D>yn.d_un.d_val)
     179                                               #+64-bit-target (pref dynamic-entries
     180                                                                     :<E>lf64_<D>yn.d_un.d_val)))
     181                                   (if (and (> udisp (pref map :link_map.l_addr))
     182                                            (< udisp (%ptr-to-int dynamic-entries)))
     183                                     (%int-to-ptr udisp)
     184                                     (%int-to-ptr
     185                                      (if (< disp 0)
     186                                        (+ disp (pref map :link_map.l_addr))
     187                                        disp))))))))
    181188          (%setf-macptr dynamic-entries
    182189                        (%inc-ptr dynamic-entries
Note: See TracChangeset for help on using the changeset viewer.