This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR10000: emit _stp_relocate* calculations correctly for kernel/module global $data (Was: [SCM] systemtap: system-wide probe/trace tool branch, master, updated. release-0.9-238-g432f054)


Hi Frank,

On Fri, 2009-03-27 at 15:55 +0000, fche@sourceware.org wrote:
> commit 432f054fc20511d487d18234b6408b5df89a8c4d
> Author: Frank Ch. Eigler <fche@elastic.org>
> Date:   Fri Mar 27 11:54:42 2009 -0400
> 
>     PR10000: emit _stp_relocate* calculations correctly for kernel/module global $data
>     
>     * translate.cxx (dump_unwindsyms): Also emit STT_OBJECT symbols,
>       therefore .data etc. sections into stap-symbols.h.

Allowing STT_OBJECTS also allowed in some odd creatures that don't seem
to be real symbols. In my case in libc.so the following things got
really malformed (negative) addresses leading to the infamous "error:
integer constant is too large for âlongâ type" in stap-symbols.h:

  { 0xffffffffffeda000, "__evoke_link_warning_fdetach" },
  { 0xffffffffffeda040, "__evoke_link_warning_getwd" },

This is turning in a wake-the-mole game, but I am now also filtering out
symbols with apparently bogus (before base) addresses:

        commit dc31eb39ab70d9d6b81d1ab02fd49795a4d8f2d0
        Author: Mark Wielaard <mjw@redhat.com>
        Date:   Wed Apr 8 12:35:01 2009 +0200
        
        Omit symbols that have suspicious addresses (before base) from
        symbol table.
            
        * translate.cxx (dump_unwindsyms): Filter out sym.st_value <
        base values.

The only "symbols" this gets rid of (in my local libc.so) are the
__evoke_link_warning_* symbols. Which indeed seem like they aren't
actually real but just hints to the linker.

If there is a better way to recognize these (they have a "normal"
st_shndx as far as I can tell) please let me know.

Cheers,

Mark

diff --git a/translate.cxx b/translate.cxx
index c42097b..3442703 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4576,10 +4576,13 @@ dump_unwindsyms (Dwfl_Module *m,
           // PC's, so we omit undefined or "fake" absolute addresses.
           // These fake absolute addresses occur in some older i386
           // kernels to indicate they are vDSO symbols, not real
-          // functions in the kernel.
+          // functions in the kernel. We also omit symbols that have
+          // suspicious addresses (before base).
           if ((GELF_ST_TYPE (sym.st_info) == STT_FUNC ||
                GELF_ST_TYPE (sym.st_info) == STT_OBJECT) // PR10000: also need .data
-               && !(sym.st_shndx == SHN_UNDEF || sym.st_shndx == SHN_ABS))
+               && !(sym.st_shndx == SHN_UNDEF
+                   || sym.st_shndx == SHN_ABS
+                   || sym.st_value < base))
             {
               Dwarf_Addr sym_addr = sym.st_value;
               const char *secname = NULL;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]