From mboxrd@z Thu Jan 1 00:00:00 1970 From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers) Date: Tue, 9 Oct 2012 12:52:38 -0400 Subject: [lttng-dev] UST segfault: memcpy too big In-Reply-To: <50735E53.1010104@mentor.com> References: <50735E53.1010104@mentor.com> Message-ID: <20121009165238.GA5195@Krystal> * 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 Date: Tue Oct 9 12:47:31 2012 -0400 Fix: memcpy of string is larger than source Hollis Blanchard 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 Signed-off-by: Mathieu Desnoyers stable-2.0: commit 7a673d9947d11a37d08be89a5c157afdfd377f9f Author: Mathieu Desnoyers Date: Tue Oct 9 12:47:31 2012 -0400 Fix: memcpy of string is larger than source Hollis Blanchard 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 Signed-off-by: Mathieu Desnoyers Thanks! Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com