mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-16 01:54:04 +02:00
36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
|
From d52bcb0a807dde87057f330dbe95aa6d221a4b85 Mon Sep 17 00:00:00 2001
|
||
|
From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
|
||
|
Date: Mon, 9 Apr 2007 17:13:02 +0700
|
||
|
Subject: [PATCH 060/134] [ARM] Add code to prevent system calls from being restarted muliple times before returning from the kernel.
|
||
|
|
||
|
Fixes crashes with thumb syscalls.
|
||
|
---
|
||
|
arch/arm/kernel/signal.c | 9 +++++++++
|
||
|
1 files changed, 9 insertions(+), 0 deletions(-)
|
||
|
|
||
|
--- a/arch/arm/kernel/signal.c
|
||
|
+++ b/arch/arm/kernel/signal.c
|
||
|
@@ -534,6 +534,14 @@ setup_rt_frame(int usig, struct k_sigact
|
||
|
|
||
|
static inline void restart_syscall(struct pt_regs *regs)
|
||
|
{
|
||
|
+ if (regs->ARM_ORIG_r0 == -ERESTARTNOHAND ||
|
||
|
+ regs->ARM_ORIG_r0 == -ERESTARTSYS ||
|
||
|
+ regs->ARM_ORIG_r0 == -ERESTARTNOINTR ||
|
||
|
+ regs->ARM_ORIG_r0 == -ERESTART_RESTARTBLOCK) {
|
||
|
+ /* the syscall cannot be safely restarted, return -EINTR instead */
|
||
|
+ regs->ARM_r0 = -EINTR;
|
||
|
+ return;
|
||
|
+ }
|
||
|
regs->ARM_r0 = regs->ARM_ORIG_r0;
|
||
|
regs->ARM_pc -= thumb_mode(regs) ? 2 : 4;
|
||
|
}
|
||
|
@@ -650,6 +658,7 @@ static int do_signal(sigset_t *oldset, s
|
||
|
*/
|
||
|
if (syscall) {
|
||
|
if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) {
|
||
|
+ regs->ARM_r0 = -EAGAIN; /* prevent multiple restarts */
|
||
|
if (thumb_mode(regs)) {
|
||
|
regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE;
|
||
|
regs->ARM_pc -= 2;
|