mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@elte.hu,
	linux-kernel@vger.kernel.org, phan@redhat.com
Subject: Re: [PATCH 1/2] perf,top: fix events overflow in top command
Date: Wed, 9 Mar 2011 15:19:10 +0100	[thread overview]
Message-ID: <20110309141910.GB1929@jolsa.brq.redhat.com> (raw)
In-Reply-To: <20110309140610.GB20188@ghostprotocols.net>

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

  reply	other threads:[~2011-03-09 14:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 20:13 [PATCH 0/2] perf: " Jiri Olsa
2011-03-07 20:13 ` [PATCH 1/2] perf,top: " Jiri Olsa
2011-03-09 13:59   ` Arnaldo Carvalho de Melo
2011-03-09 14:06     ` Arnaldo Carvalho de Melo
2011-03-09 14:19       ` Jiri Olsa [this message]
2011-03-09 14:25         ` Arnaldo Carvalho de Melo
2011-03-11  9:46   ` [tip:perf/core] perf top: Fix " tip-bot for Jiri Olsa
2011-03-07 20:13 ` [PATCH 2/2] perf,top: dont let events to eat up whole header line Jiri Olsa
2011-03-11  9:47   ` [tip:perf/core] perf top: Don't " tip-bot for Jiri Olsa

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=20110309141910.GB1929@jolsa.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=phan@redhat.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

all inboxes | Powered by JetHome®