From: Bernd Petrovitsch <bernd@firmix.at>
To: Ankita Garg <ankita@in.ibm.com>
Cc: Frank Seidel <fseidel@suse.de>,
linux kernel <linux-kernel@vger.kernel.org>,
akpm@linux-foundation.org, Adrian Bunk <bunk@kernel.org>,
Randy Dunlap <randy.dunlap@oracle.com>,
Frank Seidel <frank@f-seidel.de>,
kernalert.de@gmail.com
Subject: Re: [PATCH] lkdtm: reduce stack size
Date: Mon, 02 Mar 2009 10:51:30 +0100 [thread overview]
Message-ID: <1235987490.19757.4.camel@spike.firmix.at> (raw)
In-Reply-To: <20090302041148.GA7410@in.ibm.com>
Hi!
On Mon, 2009-03-02 at 09:41 +0530, Ankita Garg wrote:
> Hi Frank,
>
> On Sun, Mar 01, 2009 at 09:00:14PM +0100, Frank Seidel wrote:
> > From: Frank Seidel <frank@f-seidel.de>
> >
> > Reduce stack memory footprint of lkdtm
> > (recursive_loop). From 1024 bytes on i386 down
> > to <10.
> >
>
> The intention here is infact to trigger a stack overflow. This module is
> used to test kernel dumping mechanism like kdump. So the expectation is
> that the kernel will dump as soon as the stack overflows.
That answers why the variable exists at all. It is only zeroed and never
else used.
Hmm, adding the above as a comment makes probably sense.
> > Signed-off-by: Frank Seidel <frank@f-seidel.de>
> > ---
> > drivers/misc/lkdtm.c | 16 +++++++++++++---
> > 1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > --- a/drivers/misc/lkdtm.c
> > +++ b/drivers/misc/lkdtm.c
> > @@ -225,14 +225,24 @@ static int lkdtm_parse_commandline(void)
> >
> > static int recursive_loop(int a)
> > {
> > - char buf[1024];
> > + char *buf;
> > + int ret;
> > +
> > + buf = kmalloc(1024, GFP_KERNEL);
> > + if (!buf) {
> > + printk(KERN_ERR "lkdtm : couldn't allocate buffer\n");
> > + return -ENOMEM;
> > + }
> >
> > memset(buf,0xFF,1024);
> > recur_count--;
> > if (!recur_count)
> > - return 0;
> > + ret = 0;
> > else
> > - return recursive_loop(a);
> > + ret = recursive_loop(a);
> > +
> > + kfree(buf);
> > + return ret;
> > }
> >
> > void lkdtm_handler(void)
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
next prev parent reply other threads:[~2009-03-02 10:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-01 20:00 Frank Seidel
2009-03-02 4:11 ` Ankita Garg
2009-03-02 8:10 ` Frank Seidel
2009-03-02 9:51 ` Bernd Petrovitsch [this message]
2009-03-02 10:12 ` Ankita Garg
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=1235987490.19757.4.camel@spike.firmix.at \
--to=bernd@firmix.at \
--cc=akpm@linux-foundation.org \
--cc=ankita@in.ibm.com \
--cc=bunk@kernel.org \
--cc=frank@f-seidel.de \
--cc=fseidel@suse.de \
--cc=kernalert.de@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.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®