From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.org>
Cc: J?rn Engel <joern@wohnheim.fh-wedel.de>,
arjanv@redhat.com, benh@kernel.crashing.org,
kronos@kronoz.cjb.net, linux-kernel@vger.kernel.org
Subject: Re: [4KSTACK][2.6.6] Stack overflow in radeonfb
Date: Mon, 17 May 2004 18:35:15 -0500 [thread overview]
Message-ID: <20040517233515.GR5414@waste.org> (raw)
In-Reply-To: <20040514151520.65b31f62.akpm@osdl.org>
On Fri, May 14, 2004 at 03:15:20PM -0700, Andrew Morton wrote:
> J?rn Engel <joern@wohnheim.fh-wedel.de> wrote:
> >
> > On Fri, 14 May 2004 11:49:23 +0200, Arjan van de Ven wrote:
> > > On Fri, May 14, 2004 at 11:47:39AM +0200, Andrew Morton wrote:
> > > > There's a `make buildcheck' target in -mm (from Arjan) into which we could
> > > > integrate such a tool. Although probably it should be a different make
> > > > target.
> > >
> > > I added it to buildcheck for now, based on Keith Owens' check-stack.sh
> > > script. I added a tiny bit of perl (shudder) to it to
> > > 1) Make it print in decimal not hex
> > > 2) Filter the stack users to users of 400 bytes and higher
> > >
> > > I arbitrarily used 400; that surely is debatable.
> >
> > Keith' script has the major disadvantage of not working on anything
> > but i386. Here is my old script that works on a few more.
>
> That's nice and simple. All due respect to Keith, this is something
> which humans have a chance of understanding too ;)
I have a cleaned up version of this script in -tiny which is a bit
nicer for adding new arches to and produces simpler output:
1428 huft_build
1292 inflate_dynamic
1168 inflate_fixed
528 ip_setsockopt
496 tcp_check_req
496 tcp_v4_conn_request
484 tcp_timewait_state_process
440 ip_getsockopt
408 extract_entropy
364 shrink_zone
324 do_execve
...
#!/usr/bin/perl
# Check the stack usage of functions
#
# Copyright Joern Engel <joern@wh.fh-wedel.de>
# Inspired by Linus Torvalds
# Original idea maybe from Keith Owens
# s390 port and big speedup by Arnd Bergmann <arnd@bergmann-dalldorf.de>
# Mips port by Juan Quintela <quintela@mandrakesoft.com>
# Rewritten for -tiny - Matt Mackall <mpm@selenic.com>
#
# Usage:
# objdump -d vmlinux | checkstack.pl i386
#
# TODO : Port to all architectures (one regex per arch)
$arch = shift;
$x = "[0-9a-f]"; # hex character
$xs = "[0-9a-f ]"; # hex character or space
$funcre = qr/^$x* \<(.*)\>:$/;
%stack_re =
(
#c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp
"^i386\$" => qr/^.*sub \$(0x$x{3,5}),\%esp$/o,
#c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64
"^arm\$" => qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o,
#8800402c: 67bdfff0 daddiu sp,sp,-16
"^mips64\$" => qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o,
#88003254: 27bdffe0 addiu sp,sp,-32
"^mips\$" => qr/.*addiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o,
#c00029f4: 94 21 ff 30 stwu r1,-208(r1)
"^ppc\$" => qr/.*stwu.*r1,-($x{3,5})\(r1\)/o,
# 11160: a7 fb ff 60 aghi %r15,-160
"^s390x?\$" => qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o
);
for $arch_re (keys(%stack_re)) {
$re = $stack_re{$arch_re} if ($arch =~ /$arch_re/);
}
die "Unknown architecture $arch!\n" if !$re;
while ($line = <STDIN>) {
$func = $1 if ($line =~ m/$funcre/);
$size{$func} = hex($1) if ($line =~ m/$re/);
}
for $func (sort {$size{$b} <=> $size{$a}} keys(%size)) {
printf "% 5d $func\n", $size{$func};
}
--
Matt Mackall : http://www.selenic.com : Linux development and consulting
next prev parent reply other threads:[~2004-05-17 23:35 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-13 13:48 [4KSTACK][2.6.6] Stack overflow in radeonfb Kronos
2004-05-13 14:03 ` Kronos
2004-05-13 14:56 ` Kronos
2004-05-13 15:15 ` Jörn Engel
2004-05-13 15:36 ` Valdis.Kletnieks
2004-05-13 16:02 ` Jörn Engel
2004-05-13 22:56 ` Benjamin Herrenschmidt
2004-05-14 10:00 ` Jörn Engel
2004-05-13 22:55 ` Benjamin Herrenschmidt
2004-05-14 1:21 ` Andrew Morton
2004-05-14 3:26 ` Randy.Dunlap
2004-05-14 9:49 ` Arjan van de Ven
2004-05-14 11:47 ` Jörn Engel
2004-05-14 22:15 ` Andrew Morton
2004-05-14 22:56 ` Chris Wright
2004-05-14 23:18 ` Andrew Morton
2004-05-14 23:19 ` Chris Wright
2004-05-14 23:48 ` Andrew Morton
2004-05-17 10:53 ` Jörn Engel
2004-05-15 7:19 ` Arjan van de Ven
2004-05-17 23:35 ` Matt Mackall [this message]
2004-05-17 23:59 ` Andrew Morton
2004-05-26 10:06 ` Jörn Engel
2004-05-26 10:08 ` Jörn Engel
2004-05-19 10:28 ` William Lee Irwin III
2004-05-19 12:01 ` William Lee Irwin III
2004-05-26 10:17 ` Jörn Engel
[not found] ` <20040518051745.GK2151@krispykreme>
[not found] ` <20040518171136.GC28735@waste.org>
[not found] ` <20040518171959.GQ2151@krispykreme>
[not found] ` <20040518174734.GE28735@waste.org>
2004-05-26 10:14 ` Jörn Engel
2004-05-14 16:41 ` Kronos
2004-05-14 21:48 ` Benjamin Herrenschmidt
2004-05-14 22:34 ` Andrew Morton
2004-05-14 22:36 ` Benjamin Herrenschmidt
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=20040517233515.GR5414@waste.org \
--to=mpm@selenic.com \
--cc=akpm@osdl.org \
--cc=arjanv@redhat.com \
--cc=benh@kernel.crashing.org \
--cc=joern@wohnheim.fh-wedel.de \
--cc=kronos@kronoz.cjb.net \
--cc=linux-kernel@vger.kernel.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