1 From d52bcb0a807dde87057f330dbe95aa6d221a4b85 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Mon, 9 Apr 2007 17:13:02 +0700
4 Subject: [PATCH 060/134] [ARM] Add code to prevent system calls from being restarted muliple times before returning from the kernel.
6 Fixes crashes with thumb syscalls.
8 arch/arm/kernel/signal.c | 9 +++++++++
9 1 files changed, 9 insertions(+), 0 deletions(-)
11 --- a/arch/arm/kernel/signal.c
12 +++ b/arch/arm/kernel/signal.c
13 @@ -534,6 +534,14 @@ setup_rt_frame(int usig, struct k_sigact
15 static inline void restart_syscall(struct pt_regs *regs)
17 + if (regs->ARM_ORIG_r0 == -ERESTARTNOHAND ||
18 + regs->ARM_ORIG_r0 == -ERESTARTSYS ||
19 + regs->ARM_ORIG_r0 == -ERESTARTNOINTR ||
20 + regs->ARM_ORIG_r0 == -ERESTART_RESTARTBLOCK) {
21 + /* the syscall cannot be safely restarted, return -EINTR instead */
22 + regs->ARM_r0 = -EINTR;
25 regs->ARM_r0 = regs->ARM_ORIG_r0;
26 regs->ARM_pc -= thumb_mode(regs) ? 2 : 4;
28 @@ -650,6 +658,7 @@ static int do_signal(sigset_t *oldset, s
31 if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) {
32 + regs->ARM_r0 = -EAGAIN; /* prevent multiple restarts */
33 if (thumb_mode(regs)) {
34 regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE;