refresh patch
[openwrt.git] / target / linux / goldfish / patches-2.6.30 / 0060--ARM-Add-code-to-prevent-system-calls-from-being-re.patch
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.
5
6 Fixes crashes with thumb syscalls.
7 ---
8 arch/arm/kernel/signal.c | 9 +++++++++
9 1 files changed, 9 insertions(+), 0 deletions(-)
10
11 --- a/arch/arm/kernel/signal.c
12 +++ b/arch/arm/kernel/signal.c
13 @@ -499,6 +499,14 @@ setup_rt_frame(int usig, struct k_sigact
14
15 static inline void restart_syscall(struct pt_regs *regs)
16 {
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;
23 + return;
24 + }
25 regs->ARM_r0 = regs->ARM_ORIG_r0;
26 regs->ARM_pc -= thumb_mode(regs) ? 2 : 4;
27 }
28 @@ -631,6 +639,7 @@ static void do_signal(struct pt_regs *re
29 */
30 if (syscall) {
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;
35 regs->ARM_pc -= 2;
This page took 0.04912 seconds and 5 git commands to generate.