Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] UST segfault: memcpy too big
Date: Tue, 9 Oct 2012 12:52:38 -0400	[thread overview]
Message-ID: <20121009165238.GA5195@Krystal> (raw)
In-Reply-To: <50735E53.1010104@mentor.com>

* Hollis Blanchard (hollis_blanchard at mentor.com) wrote:
> I seem to have hit a little problem with a "hello world" test app and  
> lttng-ust 2.0.3. lttng-ust.git seems to be affected as well. Basically,  
> I created a single UST tracepoint, but as soon as I run "lttng  
> enable-event -u -a", my app segfaults. The problem seems to be that when  
> creating the event to pass to ltt_event_create(), we try to memcpy the  
> full 256 bytes of name. However, the name might be shorter, and if we  
> get unlucky it falls within 256 bytes of the segment boundary...

Good catch !!

Fixed by commit:

master:

commit 1c7b4a9b7cc83f750a7d58d5e2f4894a2559f583
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date:   Tue Oct 9 12:47:31 2012 -0400

    Fix: memcpy of string is larger than source
    
    Hollis Blanchard <hollis_blanchard at mentor.com> wrote:
    > I seem to have hit a little problem with a "hello world" test app and
    > lttng-ust 2.0.3. lttng-ust.git seems to be affected as well. Basically,
    > I created a single UST tracepoint, but as soon as I run "lttng
    > enable-event -u -a", my app segfaults. The problem seems to be that when
    > creating the event to pass to ltt_event_create(), we try to memcpy the
    > full 256 bytes of name. However, the name might be shorter, and if we
    > get unlucky it falls within 256 bytes of the segment boundary...
    
    Fixing the 3 sites where this issue arise. Manually inspecting all
    memcpy in the UST code returned by grep did the job.
    
    Reported-by: Hollis Blanchard <hollis_blanchard at mentor.com>
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

stable-2.0:

commit 7a673d9947d11a37d08be89a5c157afdfd377f9f
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date:   Tue Oct 9 12:47:31 2012 -0400

    Fix: memcpy of string is larger than source
    
    Hollis Blanchard <hollis_blanchard at mentor.com> wrote:
    > I seem to have hit a little problem with a "hello world" test app and
    > lttng-ust 2.0.3. lttng-ust.git seems to be affected as well. Basically,
    > I created a single UST tracepoint, but as soon as I run "lttng
    > enable-event -u -a", my app segfaults. The problem seems to be that when
    > creating the event to pass to ltt_event_create(), we try to memcpy the
    > full 256 bytes of name. However, the name might be shorter, and if we
    > get unlucky it falls within 256 bytes of the segment boundary...
    
    Fixing the 3 sites where this issue arise. Manually inspecting all
    memcpy in the UST code returned by grep did the job.
    
    Reported-by: Hollis Blanchard <hollis_blanchard at mentor.com>
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

Thanks!

Mathieu

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



      reply	other threads:[~2012-10-09 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08 23:14 Hollis Blanchard
2012-10-09 16:52 ` Mathieu Desnoyers [this message]

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=20121009165238.GA5195@Krystal \
    --to=mathieu.desnoyers@efficios.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox