libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] ptrace-unwind not working at head


From: Humberto Abdelnur
Subject: Re: [Libunwind-devel] ptrace-unwind not working at head
Date: Wed, 24 Mar 2010 13:34:35 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hello all,

I looked at this some more. The unw_cursor_t keeps track of the previous elf image mapped. Before mapping a new image, it unmaps the previous image, so there is no leak.

But in poc.c:

    unw_init_remote(&orig_cursor, as, upt);
    curr_cursor = orig_cursor;

This assignment makes the cursor lose track of what was previously mapped. I'll let David comment on if a separate API call is needed to cleanup the cursor or the implementation could unmap the last mmap when the end of call chain is reached.
I was just checking and there is no need to create a new API for it, actually the problems come with the function

src/ptrace/_UPT_destroy.c:_UPT_destroy

which frees the structure but it does not check whether the ei.image is NULL or not.
So, I modified the function to be as follow:

void
_UPT_destroy (void *arg)
{
 struct UPT_info *ui = arg;
 if (ui->ei.image)
   {
     munmap (ui->ei.image, ui->ei.size);
 }
 free (ui);

}


now, it works like a charm :)
I hope it helps, thank to all for the help.

Humberto




reply via email to

[Prev in Thread] Current Thread [Next in Thread]