Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] ltt channel thread safe?
Date: Fri, 6 Aug 2010 17:02:43 -0400	[thread overview]
Message-ID: <20100806210243.GA19813@Krystal> (raw)
In-Reply-To: <AANLkTik74itmo8kgx3oT0GpyLg0PnAUPDmeW_ZYvY2mT@mail.gmail.com>

* chris meyers (chris.meyers.fsu at gmail.com) wrote:
> Forget any mention of threading being the reason.  After trying way too many
> things, removal of the __FUNCTION__ macro seems to "fix" the problem.  Does
> the  __FUNCTION__ macro not play well with ltt?  The binary trace file
> seemed void of any error.  It seemed as if the __FUNCTION__ macro had some
> indirect influence on how the lttv -m textDump behaved.
> 
> -Chris
> 

Can you try applying this patch to UST and see if it fixes your problem ?

You'll have to apply the patch by hand to UST, because it is originally
made for the Linux kernel marker code (it's a one-liner).


markers fix out of bound array

While creating my own probes, I've observed that I get format mismatch error...
While digging into the executed code I observe that my format (stored in a
marker_entry) was overwritten by a new allocated structure. Finally I found
that in add_marker function the format pointer seems to be set to the wrong
position:

e->format = &e->name[channel_len + name_len];
while the proper assignment should be
e->format = &e->name[name_len];

indead:

size_t channel_len = strlen(channel) + 1;
size_t name_len = strlen(name) + 1;
...
size_t format_len ...= strlen(format) + 1;

and

struct marker_entry {
....
    char channel[0];        /* Contains channel'\0'name'\0'format'\0' *     /

};

...

e = kmalloc(sizeof(struct marker_entry)
      + channel_len + name_len + format_len,
      GFP_KERNEL);
....
e->name = &e->channel[channel_len];

Rgds,
Damien COTTIER.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 kernel/marker.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6-lttng/kernel/marker.c
===================================================================
--- linux-2.6-lttng.orig/kernel/marker.c	2010-08-02 15:44:51.000000000 -0400
+++ linux-2.6-lttng/kernel/marker.c	2010-08-02 15:45:55.000000000 -0400
@@ -436,7 +436,7 @@ static struct marker_entry *add_marker(c
 	e->name = &e->channel[channel_len];
 	memcpy(e->name, name, name_len);
 	if (format) {
-		e->format = &e->name[channel_len + name_len];
+		e->format = &e->name[name_len];
 		memcpy(e->format, format, format_len);
 		if (strcmp(e->format, MARK_NOARGS) == 0)
 			e->call = marker_probe_cb_noarg;

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




  parent reply	other threads:[~2010-08-06 21:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04  6:12 chris meyers
2010-08-04  6:12 ` chris meyers
2010-08-04  6:12 ` chris meyers
2010-08-06 20:55 ` chris meyers
2010-08-06 20:55   ` chris meyers
2010-08-06 20:55   ` chris meyers
2010-08-06 21:02   ` Mathieu Desnoyers [this message]
2010-08-10  4:29     ` Pierre-Marc Fournier
2010-08-10  4:28 ` Pierre-Marc Fournier

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=20100806210243.GA19813@Krystal \
    --to=compudj@krystal.dyndns.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox