diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2012-10-26 05:40:28 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-10-27 18:42:00 -0400 |
commit | 2c5594df344cd1ff0cc9bf007dea3235582b3acf (patch) | |
tree | c41a0f3ca974f722d517ee87b956c716b2c69a11 /arch | |
parent | 6f0c0580b70c89094b3422ba81118c7b959c7556 (diff) |
rcu: Fix unrecovered RCU user mode in syscall_trace_leave()
On x86-64 syscall exit, 3 non exclusive events may happen
looping in the following order:
1) Check if we need resched for user preemption, if so call
schedule_user()
2) Check if we have pending signals, if so call do_notify_resume()
3) Check if we do syscall tracing, if so call syscall_trace_leave()
However syscall_trace_leave() has been written assuming it directly
follows the syscall and forget about the above possible 1st and 2nd
steps.
Now schedule_user() and do_notify_resume() exit in RCU user mode
because they have most chances to resume userspace immediately and
this avoids an rcu_user_enter() call in the syscall fast path.
So by the time we call syscall_trace_leave(), we may well be in RCU
user mode. To fix this up, simply call rcu_user_exit() in the beginning
of this function.
This fixes some reported RCU uses in extended quiescent state.
Reported-by: Dave Jones <davej@redhat.com>
Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index b00b33a18390..eff5b8c68652 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -1511,6 +1511,13 @@ void syscall_trace_leave(struct pt_regs *regs) | |||
1511 | { | 1511 | { |
1512 | bool step; | 1512 | bool step; |
1513 | 1513 | ||
1514 | /* | ||
1515 | * We may come here right after calling schedule_user() | ||
1516 | * or do_notify_resume(), in which case we can be in RCU | ||
1517 | * user mode. | ||
1518 | */ | ||
1519 | rcu_user_exit(); | ||
1520 | |||
1514 | audit_syscall_exit(regs); | 1521 | audit_syscall_exit(regs); |
1515 | 1522 | ||
1516 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) | 1523 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) |