public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm.com>
To: Anurag Aggarwal <anurag19aggarwal@gmail.com>
Cc: Anurag Aggarwal <a.anurag@samsung.com>,
	Naveen Kumar <naveen.sel@samsung.com>,
	Narendra Meher <narendra.m1@samsung.com>,
	"nico@linaro.org" <nico@linaro.org>,
	Ashish Kalra <ashish.kalra@samsung.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Will Deacon <Will.Deacon@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"cpgs ." <cpgs@samsung.com>,
	"naveenkrishna.ch@gmail.com" <naveenkrishna.ch@gmail.com>,
	Rajat Suri <rajat.suri@samsung.com>,
	Poorva Srivastava <poorva.s@samsung.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Mohammad Irfan Ansari <mohammad.a2@samsung.com>
Subject: Re: [PATCH V6] ARM : unwinder : Prevent data abort due to stack overflow
Date: Tue, 7 Jan 2014 13:53:14 +0000	[thread overview]
Message-ID: <20140107135254.GA3241@e103592.cambridge.arm.com> (raw)

On Sat, Dec 14, 2013 at 03:47:49PM +0530, Anurag Aggarwal wrote:
> >You could try adding some debug printks to see how the backtrace fails.
> >You could also try adding a few hand-crafted assembler functions
> >with appropriate code and unwind directives to trigger different kinds
> >of backtrace failure.  You might have to add a way to artificially limit
> >sp_high to check the cases where you run out of stack in the middle of
> >popping multiple registers.
> 
> I added a a printk statement
> +               if (*vsp >= (unsigned long *)ctrl->sp_high) {
> +                       printk(KERN_ERR "Stack Overflow Detected, vsp = %lx",
> +                               (unsigned long)*vsp);
> +                       return -URC_FAILURE;
> +               }
> 
> I ran a many test cases to try and get the above print in the dmesg log.
> 
> I tried the following things :
> 
> 1) Calling unwind_backtrace from diffrenet locations in the kernel, I
> added the unwind call
> in some irq, fork, exit and some sysfs entries call.
> 2) I limited the value of sp_high in unwind_frame() itself, I tried
> many values of sp_high,
> varrying from (low + sizeof(ctrl.vrs)/4) to (low + 4*sizeof(ctrl.vrs)).
> 
> When running the above cases I was able to see the above printk quiet
> a few times in dmesg log.
> 
> So, the error condition is being handled.
> 
> If you have some test cases for verifying the unwinder, please share
> the same. They might help
> in thorough testing of unwinder.

I think that sounds OK to give us reasonable confidence that the code is
working correctly.

Go ahead and add my Reviewed-by on the patch, if you're still waiting
for it.

Cheers
---Dave

             reply	other threads:[~2014-01-07 13:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 13:53 Dave Martin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-12-11  9:40 [PATCH V6] ARM : unwinder : Prevent data abort due to stack overflow Anurag Aggarwal
2013-12-14 10:17 ` Anurag Aggarwal
2013-12-10 17:31 Dave Martin
2013-12-10  3:54 Anurag Aggarwal
2013-12-10 16:19 ` Anurag Aggarwal
2013-12-09 10:47 Anurag Aggarwal
2013-12-09 17:56 ` Dave Martin

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=20140107135254.GA3241@e103592.cambridge.arm.com \
    --to=dave.martin@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=a.anurag@samsung.com \
    --cc=anurag19aggarwal@gmail.com \
    --cc=ashish.kalra@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mohammad.a2@samsung.com \
    --cc=narendra.m1@samsung.com \
    --cc=naveen.sel@samsung.com \
    --cc=naveenkrishna.ch@gmail.com \
    --cc=nico@linaro.org \
    --cc=poorva.s@samsung.com \
    --cc=rajat.suri@samsung.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