linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: k.khlebnikov@samsung.com (Konstantin Khlebnikov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: fix framepointer check in unwind_frame
Date: Thu, 05 Dec 2013 12:34:30 +0400	[thread overview]
Message-ID: <20131205083430.32632.11103.stgit@buzz> (raw)
In-Reply-To: <20131205083424.32632.51618.stgit@buzz>

This patch fixes corner case when (fp + 4) overflows unsigned long,
for example: fp = 0xFFFFFFFF -> fp + 4 == 3.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
---
 arch/arm/kernel/stacktrace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 00f79e5..af4e8c8 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 */

  reply	other threads:[~2013-12-05  8:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05  8:34 [PATCH 1/2] ARM: check stack pointer in get_wchan Konstantin Khlebnikov
2013-12-05  8:34 ` Konstantin Khlebnikov [this message]
2013-12-05 12:45   ` [PATCH 2/2] ARM: fix framepointer check in unwind_frame Jean Pihet
2013-12-05 13:10     ` Konstantin Khlebnikov
2013-12-05 11:33 ` [PATCH 1/2] ARM: check stack pointer in get_wchan Russell King - ARM Linux

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=20131205083430.32632.11103.stgit@buzz \
    --to=k.khlebnikov@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).