linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: backtrace: avoid crash on large invalid fp value
@ 2012-10-10  6:46 Todd Poynor
  2012-10-10 11:15 ` Dave Martin
  0 siblings, 1 reply; 9+ messages in thread
From: Todd Poynor @ 2012-10-10  6:46 UTC (permalink / raw)
  To: linux-arm-kernel

Invalid frame pointer (signed) -4 <= fp <= -1 defeats check for too high
on overflow.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
---
 arch/arm/kernel/stacktrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 00f79e5..6315162 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -31,7 +31,7 @@ int notrace unwind_frame(struct stackframe *frame)
 	high = ALIGN(low, THREAD_SIZE);
 
 	/* check current frame pointer is within bounds */
-	if (fp < (low + 12) || fp + 4 >= high)
+	if (fp < (low + 12) || fp >= high - 4)
 		return -EINVAL;
 
 	/* restore the registers from the stack frame */
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] ARM: backtrace: avoid crash on large invalid fp value
@ 2012-05-08  7:49 Todd Poynor
  0 siblings, 0 replies; 9+ messages in thread
From: Todd Poynor @ 2012-05-08  7:49 UTC (permalink / raw)
  To: linux-arm-kernel

Wraparound on invalid frame pointer (signed) -4 <= fp <= -1
defeats check for too high.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
---
 arch/arm/kernel/stacktrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 00f79e5..6315162 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -31,7 +31,7 @@ int notrace unwind_frame(struct stackframe *frame)
 	high = ALIGN(low, THREAD_SIZE);
 
 	/* check current frame pointer is within bounds */
-	if (fp < (low + 12) || fp + 4 >= high)
+	if (fp < (low + 12) || fp >= high - 4)
 		return -EINVAL;
 
 	/* restore the registers from the stack frame */
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-11-13  9:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10  6:46 [PATCH] ARM: backtrace: avoid crash on large invalid fp value Todd Poynor
2012-10-10 11:15 ` Dave Martin
2012-11-02 23:47   ` Colin Cross
2012-11-05 10:54     ` Dave Martin
2012-11-09  2:05       ` Colin Cross
2012-11-09 10:56         ` Dave Martin
2012-11-09 18:17           ` Colin Cross
2012-11-13  9:49             ` Dave Martin
  -- strict thread matches above, loose matches on Subject: below --
2012-05-08  7:49 Todd Poynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).