From: Ankita Garg <ankita@in.ibm.com>
To: Frank Seidel <fseidel@suse.de>
Cc: 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, 2 Mar 2009 09:41:48 +0530 [thread overview]
Message-ID: <20090302041148.GA7410@in.ibm.com> (raw)
In-Reply-To: <49AAE94E.8080308@suse.de>
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.
> 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)
--
Regards,
Ankita Garg (ankita@in.ibm.com)
Linux Technology Center
IBM India Systems & Technology Labs,
Bangalore, India
next prev parent reply other threads:[~2009-03-02 4:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-01 20:00 [PATCH] lkdtm: reduce stack size Frank Seidel
2009-03-02 4:11 ` Ankita Garg [this message]
2009-03-02 8:10 ` Frank Seidel
2009-03-02 9:51 ` Bernd Petrovitsch
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=20090302041148.GA7410@in.ibm.com \
--to=ankita@in.ibm.com \
--cc=akpm@linux-foundation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.