aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2015-05-31 16:59:03 -0400
committerRichard Weinberger <richard@nod.at>2015-05-31 16:59:03 -0400
commit5334cdae407a5778a297a98a75ca61140e37ebfa (patch)
tree8b1c4aaad459fa26fb13b5ef4244d986c831048d
parent30b11ee9ae23d78de66b9ae315880af17a64ba83 (diff)
um: Handle tracehook_report_syscall_entry() result
tracehook_report_syscall_entry() is allowed to fail, in case of failure we have to abort the current syscall. Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--arch/um/include/asm/ptrace-generic.h2
-rw-r--r--arch/um/kernel/ptrace.c6
-rw-r--r--arch/um/kernel/skas/syscall.c6
3 files changed, 9 insertions, 5 deletions
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h
index cb9b3c47ca8e..283480a7ad23 100644
--- a/arch/um/include/asm/ptrace-generic.h
+++ b/arch/um/include/asm/ptrace-generic.h
@@ -37,7 +37,7 @@ extern int putreg(struct task_struct *child, int regno, unsigned long value);
37 37
38extern int arch_copy_tls(struct task_struct *new); 38extern int arch_copy_tls(struct task_struct *new);
39extern void clear_flushed_tls(struct task_struct *task); 39extern void clear_flushed_tls(struct task_struct *task);
40extern void syscall_trace_enter(struct pt_regs *regs); 40extern int syscall_trace_enter(struct pt_regs *regs);
41extern void syscall_trace_leave(struct pt_regs *regs); 41extern void syscall_trace_leave(struct pt_regs *regs);
42 42
43#endif 43#endif
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 174ee5017264..cac2ea058b7a 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -131,7 +131,7 @@ static void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs,
131 * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and 131 * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
132 * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check 132 * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check
133 */ 133 */
134void syscall_trace_enter(struct pt_regs *regs) 134int syscall_trace_enter(struct pt_regs *regs)
135{ 135{
136 audit_syscall_entry(UPT_SYSCALL_NR(&regs->regs), 136 audit_syscall_entry(UPT_SYSCALL_NR(&regs->regs),
137 UPT_SYSCALL_ARG1(&regs->regs), 137 UPT_SYSCALL_ARG1(&regs->regs),
@@ -140,9 +140,9 @@ void syscall_trace_enter(struct pt_regs *regs)
140 UPT_SYSCALL_ARG4(&regs->regs)); 140 UPT_SYSCALL_ARG4(&regs->regs));
141 141
142 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 142 if (!test_thread_flag(TIF_SYSCALL_TRACE))
143 return; 143 return 0;
144 144
145 tracehook_report_syscall_entry(regs); 145 return tracehook_report_syscall_entry(regs);
146} 146}
147 147
148void syscall_trace_leave(struct pt_regs *regs) 148void syscall_trace_leave(struct pt_regs *regs)
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c
index c0681e097432..d9ec0068b623 100644
--- a/arch/um/kernel/skas/syscall.c
+++ b/arch/um/kernel/skas/syscall.c
@@ -18,7 +18,10 @@ void handle_syscall(struct uml_pt_regs *r)
18 long result; 18 long result;
19 int syscall; 19 int syscall;
20 20
21 syscall_trace_enter(regs); 21 if (syscall_trace_enter(regs)) {
22 result = -ENOSYS;
23 goto out;
24 }
22 25
23 /* 26 /*
24 * This should go in the declaration of syscall, but when I do that, 27 * This should go in the declaration of syscall, but when I do that,
@@ -34,6 +37,7 @@ void handle_syscall(struct uml_pt_regs *r)
34 result = -ENOSYS; 37 result = -ENOSYS;
35 else result = EXECUTE_SYSCALL(syscall, regs); 38 else result = EXECUTE_SYSCALL(syscall, regs);
36 39
40out:
37 PT_REGS_SET_SYSCALL_RETURN(regs, result); 41 PT_REGS_SET_SYSCALL_RETURN(regs, result);
38 42
39 syscall_trace_leave(regs); 43 syscall_trace_leave(regs);