提交 cb06199b 编写于 作者: R Rabin Vincent 提交者: Russell King

ARM: 6654/1: perf/oprofile: fix off-by-one in stack check

Since tail is the previous fp - 1, we need to compare the new fp with tail + 1
to ensure that we don't end up passing in the same tail again, in order to
avoid a potential infinite loop in the perf interrupt handler (which has been
observed to occur).  A similar fix seems to be needed in the OProfile code.
Acked-by: NWill Deacon <will.deacon@arm.com>
Signed-off-by: NRabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 4a9cb360
...@@ -700,7 +700,7 @@ user_backtrace(struct frame_tail __user *tail, ...@@ -700,7 +700,7 @@ user_backtrace(struct frame_tail __user *tail,
* Frame pointers should strictly progress back up the stack * Frame pointers should strictly progress back up the stack
* (towards higher addresses). * (towards higher addresses).
*/ */
if (tail >= buftail.fp) if (tail + 1 >= buftail.fp)
return NULL; return NULL;
return buftail.fp - 1; return buftail.fp - 1;
......
...@@ -85,7 +85,7 @@ static struct frame_tail* user_backtrace(struct frame_tail *tail) ...@@ -85,7 +85,7 @@ static struct frame_tail* user_backtrace(struct frame_tail *tail)
/* frame pointers should strictly progress back up the stack /* frame pointers should strictly progress back up the stack
* (towards higher addresses) */ * (towards higher addresses) */
if (tail >= buftail[0].fp) if (tail + 1 >= buftail[0].fp)
return NULL; return NULL;
return buftail[0].fp-1; return buftail[0].fp-1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册