提交 c824498d 编写于 作者: B Bernd Schmidt 提交者: Linus Torvalds

Blackfin arch: fix signal handling bug

There's a forum thread at
https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&_forum_action=MessageReply&message_id=24741

which has a testcase involving signal handling that crashes quite readily.
Inspecting the code I believe what happens is that signal handling can become
confused when it is invoked on return from an interrupt, if the contents of
P0 and R0 at the time of the interrupt happen to be such that P0 is larger
than zero (indicating to the signal code that we're in a syscall), and R0
happens to have a value of something like -EINTR or -ERESTARTSYS.
Fixed by setting orig_p0 to -1 if we're returning from an interrupt.  The
testcase now seems to run without problems.
Signed-off-by: NBernd Schmidt <bernd.schmidt@analog.com>
Signed-off-by: NBryan Wu <bryan.wu@analog.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 a9c59c27
...@@ -712,6 +712,11 @@ _schedule_and_signal_from_int: ...@@ -712,6 +712,11 @@ _schedule_and_signal_from_int:
p1.h = _evt_system_call; p1.h = _evt_system_call;
[p0] = p1; [p0] = p1;
csync; csync;
/* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */
r0 = -1 (x);
[sp + PT_ORIG_P0] = r0;
p1 = rets; p1 = rets;
[sp + PT_RESERVED] = p1; [sp + PT_RESERVED] = p1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册