lkml.org 
[lkml]   [2011]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] perf,top: fix events overflow in top command
    On Wed, Mar 09, 2011 at 11:06:10AM -0300, Arnaldo Carvalho de Melo wrote:
    > Em Wed, Mar 09, 2011 at 10:59:25AM -0300, Arnaldo Carvalho de Melo escreveu:
    > > Em Mon, Mar 07, 2011 at 09:13:40PM +0100, Jiri Olsa escreveu:
    > > > The snprintf function returns number of printed characters even
    > > > if it cross the size parameter. So passing enough events via '-e'
    > > > parameter will cause segmentation fault.
    > > >
    > > > It's reproduced by following command:
    > > >
    > > > perf top -e `perf list | grep Tracepoint | awk -F'[' '\
    > > > {gsub(/[[:space:]]+/,"",$1);array[FNR]=$1}END{outputs=array[1];\
    > > > for (i=2;i<=FNR;i++){ outputs=outputs "," array[i];};print outputs}'`
    > > >
    > > > Attached patch is adding SNPRINTF macro that provides the
    > > > overflow check and returns actuall number of printed characters.
    > >
    > > Good catch, applying to perf/urgent.
    >
    > Tried but it doesn't apply nor can I reproduce the overflow (albeit
    > granted the long line of events is annoying).

    patches were based on tip tree

    hm, it crashes for me on tip tree,
    but I haven't checked the perf/core tree..

    not sure if it's any help, but while debugging I could see the sigsegv happened
    when the pointer was far beyond the 160 chars buffer size,
    maybe the buffer got bigger in the perf tree..

    jirka

    >
    > So I'm applying both patches to perf/core instead.
    >
    > - Arnaldo


    \
     
     \ /
      Last update: 2011-03-09 15:21    [W:0.021 / U:33.852 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site