From 55bb9480f9159b229ac3c3454c97b62d1e0a7e80 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Fri, 18 Jan 2013 15:12:19 +0530 Subject: ARC: [Review] Prevent incorrect syscall restarts Per Al Viro's "signals for dummies" https://lkml.org/lkml/2012/12/6/366 there are 3 golden rules for (not) restarting syscalls: " What we need to guarantee is * restarts do not happen on signals caught in interrupts or exceptions * restarts do not happen on signals caught in sigreturn() * restart should happen only once, even if we get through do_signal() many times." ARC Port already handled #1, this patch fixes #2 and #3. We use the additional state in pt_regs->orig_r8 to ckh if restarting has already been done once. Thanks to Al Viro for spotting this. Signed-off-by: Vineet Gupta Cc: Al Viro --- arch/arc/include/asm/ptrace.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch/arc/include') diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h index 3ec89f467ac3..a98957a95fb3 100644 --- a/arch/arc/include/asm/ptrace.h +++ b/arch/arc/include/asm/ptrace.h @@ -100,6 +100,9 @@ struct callee_regs { #define in_syscall(regs) (regs->event & orig_r8_IS_SCALL) #define in_brkpt_trap(regs) (regs->event & orig_r8_IS_BRKPT) +#define syscall_wont_restart(regs) (regs->event |= orig_r8_IS_SCALL_RESTARTED) +#define syscall_restartable(regs) !(regs->event & orig_r8_IS_SCALL_RESTARTED) + #define current_pt_regs() \ ({ \ /* open-coded current_thread_info() */ \ -- cgit v1.2.3