calloc interposing issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • reachanil@gmail.com

    calloc interposing issue

    Hi,

    We've interposed malloc/calloc/realloc/memalign/valloc in our
    application. While all of our application calls our own implementation
    of these functions, there seems to be some issue with the dl.so shared
    library (Windriver, ppc, linux 32 bit). The dl.so library defines a
    function called - _dl_tls_setup and another one - _dl_deallocate_ tls.
    When our application that linked in -ldl and -lpthread, was shutting
    down, we saw a crash with the backtrace pointing to
    _dl_deallocate_ tls. Upon further investigation we found that
    _dl_tls_dealloc ate was calling 'free' which was our own implementation
    (Not libc's) However, the chunk was got using malloc/calloc from
    libc!!!!!. I put a breakpoint at _dl_tls_setup and found that it was
    getting memory from the libc calloc.

    I'm not sure how the dl library could have got calloc from libc and
    free from our application. Please help!!!

    thanks,
    -Anil
  • Nick Keighley

    #2
    Re: calloc interposing issue

    On 22 Feb, 10:30, reacha...@gmail .com wrote:
    Hi,
    >
    We've interposed malloc/calloc/realloc/memalign/valloc in our
    application. While all of our application calls our own implementation
    of these functions, there seems to be some issue with the dl.so shared
    library (Windriver, ppc, linux 32 bit). The dl.so library defines a
    function called - _dl_tls_setup and another one - _dl_deallocate_ tls.
    When our application that linked in -ldl and -lpthread, was shutting
    down, we saw a crash with the backtrace pointing to
    _dl_deallocate_ tls. Upon further investigation we found that
    _dl_tls_dealloc ate was calling 'free' which was our own implementation
    (Not libc's) However, the chunk was got using malloc/calloc from
    libc!!!!!. I put a breakpoint at _dl_tls_setup and found that it was
    getting memory from the libc calloc.
    >
    I'm not sure how the dl library could have got calloc from libc and
    free from our application. Please help!!!
    >
    thanks,
    -Anil

    Comment

    • Nick Keighley

      #3
      Re: calloc interposing issue

      sorry for previous message. hit the wrong key

      On 22 Feb, 10:30, reacha...@gmail .com wrote:
      We've interposed malloc/calloc/realloc/
      not sure what "interposed " means...
      memalign/valloc
      I'm not familiar with these. Are they new to C99?

      in our
      application. While all of our application calls our own implementation
      of these functions,
      I'm pretty sure that puts you firmly in implementation defined
      territory.
      I don't think you can (portable) redefine standard library functions.

      there seems to be some issue with the dl.so shared
      library (Windriver, ppc, linux 32 bit).
      thats *really* implementaion defined! You need to try
      a windows programming news group

      <snip>


      --
      Nick Keighley

      Comment

      • Richard Heathfield

        #4
        Re: calloc interposing issue

        Nick Keighley said:
        sorry for previous message. hit the wrong key
        >
        On 22 Feb, 10:30, reacha...@gmail .com wrote:
        >
        >We've interposed malloc/calloc/realloc/
        >
        not sure what "interposed " means...
        "Interpositioni ng" means "replacing a library routine (typically but not
        necessarily a standard library function) with your own function".

        <snip>

        --
        Richard Heathfield <http://www.cpax.org.uk >
        Email: -http://www. +rjh@
        Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
        "Usenet is a strange place" - dmr 29 July 1999

        Comment

        • Richard Tobin

          #5
          Re: calloc interposing issue

          In article <8176072b-4517-44a5-b1ec-5bca6c45ebb7@b2 9g2000hsa.googl egroups.com>,
          <reachanil@gmai l.comwrote:
          >I'm not sure how the dl library could have got calloc from libc and
          >free from our application. Please help!!!
          You really need to ask about this on a group related to Linux;
          this stuff is very OS-dependent.

          -- Richard

          --
          :wq

          Comment

          • Flash Gordon

            #6
            Re: calloc interposing issue

            Nick Keighley wrote, On 22/02/08 10:47:
            On 22 Feb, 10:30, reacha...@gmail .com wrote:
            <snip>
            >there seems to be some issue with the dl.so shared
            >library (Windriver, ppc, linux 32 bit).
            >
            thats *really* implementaion defined!
            As far as the standard is concerned it is undefined, so the
            implementation may well not define it. In this case though I believe
            that Linux does provide mechanisms to do this.
            You need to try
            a windows programming news group
            I think you meant Linux programming group.
            --
            Flash Gordon

            Comment

            Working...