All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: Stefan Seefeld <stefan_seefeld@mentor.com>
Cc: lttng-dev@lists.lttng.org
Subject: Re: [PATCH lttng-ust] Add trace support for calloc and realloc.
Date: Thu, 1 Aug 2013 21:57:28 +0400	[thread overview]
Message-ID: <CABtfrpDg_NOi+yP5GABmjBv6G9Zj+rvTwc1OdQ1s_9DM7uzeZg__37845.4732629054$1375379911$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <51FA9AD8.4010502@mentor.com>

On Thu, Aug 1, 2013 at 9:28 PM, Stefan Seefeld
<stefan_seefeld@mentor.com> wrote:
> I don't think any of this works. The ultimate problem is the one Jérémie
> reported initially: dlsym will eventually call free() on the memory
> calloc() returned, so my calloc fallback needs to return something that
> can actually be freed.

I pointed out how free() will be safe specifically:

>> dlsym stores pointer to calloc'ed buffer, overwriting the pointer to mmap'ed
>> buffer, completing initialization for the second time and making the
>> subsequent free() safe.

Besides, you're intercepting free() in your LD_PRELOAD module as well,
so you can just catch attempts to free your mmap'ed buffers there and
munmap them safely.

Alexander

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

  parent reply	other threads:[~2013-08-01 17:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51F3585E.20705@mentor.com>
2013-07-29 23:19 ` [PATCH lttng-ust] Add trace support for calloc and realloc Jérémie Galarneau
     [not found] ` <CA+jJMxtn-DsBjzunLNE3_7KS4RCqAFLJfPL7fVkH3z62r0jPxw@mail.gmail.com>
2013-07-30 21:12   ` Stefan Seefeld
     [not found]   ` <51F82C45.6020502@mentor.com>
2013-07-31  2:14     ` Jérémie Galarneau
     [not found]     ` <CA+jJMxtMH5Ajgoszg8pO8dq-KsrTg9NwS2YcYOz=FbLr0ijaEQ@mail.gmail.com>
2013-08-01 16:26       ` Alexander Monakov
     [not found]       ` <alpine.LNX.2.00.1308012013380.9574@monopod.intra.ispras.ru>
2013-08-01 16:32         ` Stefan Seefeld
     [not found]         ` <51FA8DAE.3070409@mentor.com>
2013-08-01 17:08           ` Alexander Monakov
     [not found]           ` <alpine.LNX.2.00.1308012045570.9574@monopod.intra.ispras.ru>
2013-08-01 17:19             ` Alexander Monakov
     [not found]             ` <alpine.LNX.2.00.1308012115300.9574@monopod.intra.ispras.ru>
2013-08-01 17:28               ` Stefan Seefeld
     [not found]               ` <51FA9AD8.4010502@mentor.com>
2013-08-01 17:57                 ` Alexander Monakov [this message]
     [not found]                 ` <CABtfrpDg_NOi+yP5GABmjBv6G9Zj+rvTwc1OdQ1s_9DM7uzeZg@mail.gmail.com>
2013-08-03  1:18                   ` Mathieu Desnoyers
     [not found]                   ` <20130803011841.GE9033@Krystal>
2013-08-05 14:57                     ` Stefan Seefeld
2013-08-05 15:29                     ` Stefan Seefeld
     [not found]                     ` <51FFBD46.5030105@mentor.com>
2013-08-07  1:42                       ` Mathieu Desnoyers
     [not found]                       ` <20130807014241.GH19407@Krystal>
2013-08-07 13:37                         ` Stefan Seefeld
     [not found]                         ` <52024D88.8090409@seefeld.name>
2013-08-07 13:57                           ` Mathieu Desnoyers
     [not found]                           ` <20130807135757.GA32387@Krystal>
2013-08-07 14:01                             ` Stefan Seefeld
     [not found]                     ` <51FFC4DB.7080905@mentor.com>
2013-08-07 14:47                       ` Stefan Seefeld
     [not found]                       ` <52025E03.7090201@mentor.com>
2013-08-07 15:50                         ` Mathieu Desnoyers
     [not found]                         ` <20130807155057.GB1035@Krystal>
2013-08-07 15:56                           ` Stefan Seefeld
2013-08-07 17:07                           ` Stefan Seefeld
     [not found]                           ` <52027EE6.60704@mentor.com>
2013-08-07 18:35                             ` Mathieu Desnoyers
2013-07-27  5:19 Stefan Seefeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABtfrpDg_NOi+yP5GABmjBv6G9Zj+rvTwc1OdQ1s_9DM7uzeZg__37845.4732629054$1375379911$gmane$org@mail.gmail.com' \
    --to=amonakov@ispras.ru \
    --cc=lttng-dev@lists.lttng.org \
    --cc=stefan_seefeld@mentor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.