← Back to team overview

maria-developers team mailing list archive

Re: 0c37211c2a2: Fixed my_addr_resolve



On Sun, Mar 28, 2021 at 2:54 PM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
> Hi, Michael!
> On Mar 28, Michael Widenius wrote:
> > revision-id: 0c37211c2a2 (mariadb-10.5.2-517-g0c37211c2a2)
> > parent(s): 555c4470130
> > author: Michael Widenius <michael.widenius@xxxxxxxxx>
> > committer: Michael Widenius <michael.widenius@xxxxxxxxx>
> > timestamp: 2021-03-24 14:31:53 +0200
> > message:
> >
> > Fixed my_addr_resolve
> >
> > At least on openSUSE Leap 15.1 one should not use the dli_fbase offset
> > provided by dladdr() for addresses in the main program.
> > Without this patch the stack traces from sf_report_leaked_memory()
> > are not usable.
> This is very strange. First, the whole purpose of this code is to use
> dli_fbase offset for the main program. That's why it was added in the
> first place. PIE binaries can be loaded at any address in memory and the
> address you see with addr2line or nm or readelf is not the same address
> you'll see in gdb or in a strack trace. We have to subtract the base
> address first.
> But may be openSUSE is different?
> So, I built on openSUSE Leap and the stack trace was perfectly usable
> without your patch. I tried both `kill -ABRT` and an artificially
> introduced memory leak.
> So I suspect there was some misunderstanding and the problem was
> somewhere else (I cannot know what, of course, but just as an example -
> the build was bad and recompilation fixed it).

This was checked extensively by both me and Vicentiu (both looking at
the assembler and the examining the output).
Without the patch I get constantly wrong stack traces for the main program.
We also tried to find exactly how dli_fbase exactly should be used on
the internet, but could not find any
good documentation for it.

The simple fact is that I am using this patch on my 10.6 tree and
stack traces are good with it and has been
for several months, so it is impossible that this is related to a bad
binary or bad build but something that is
required on my system


Follow ups