Boqun Feng
b862789aa5
kvm/x86: Handle async PF in RCU read-side critical sections
...
Sasha Levin reported a WARNING:
| WARNING: CPU: 0 PID: 6974 at kernel/rcu/tree_plugin.h:329
| rcu_preempt_note_context_switch kernel/rcu/tree_plugin.h:329 [inline]
| WARNING: CPU: 0 PID: 6974 at kernel/rcu/tree_plugin.h:329
| rcu_note_context_switch+0x16c/0x2210 kernel/rcu/tree.c:458
...
| CPU: 0 PID: 6974 Comm: syz-fuzzer Not tainted 4.13.0-next-20170908+ #246
| Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
| 1.10.1-1ubuntu1 04/01/2014
| Call Trace:
...
| RIP: 0010:rcu_preempt_note_context_switch kernel/rcu/tree_plugin.h:329 [inline]
| RIP: 0010:rcu_note_context_switch+0x16c/0x2210 kernel/rcu/tree.c:458
| RSP: 0018:ffff88003b2debc8 EFLAGS: 00010002
| RAX: 0000000000000001 RBX: 1ffff1000765bd85 RCX: 0000000000000000
| RDX: 1ffff100075d7882 RSI: ffffffffb5c7da20 RDI: ffff88003aebc410
| RBP: ffff88003b2def30 R08: dffffc0000000000 R09: 0000000000000001
| R10: 0000000000000000 R11: 0000000000000000 R12: ffff88003b2def08
| R13: 0000000000000000 R14: ffff88003aebc040 R15: ffff88003aebc040
| __schedule+0x201/0x2240 kernel/sched/core.c:3292
| schedule+0x113/0x460 kernel/sched/core.c:3421
| kvm_async_pf_task_wait+0x43f/0x940 arch/x86/kernel/kvm.c:158
| do_async_page_fault+0x72/0x90 arch/x86/kernel/kvm.c:271
| async_page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1069
| RIP: 0010:format_decode+0x240/0x830 lib/vsprintf.c:1996
| RSP: 0018:ffff88003b2df520 EFLAGS: 00010283
| RAX: 000000000000003f RBX: ffffffffb5d1e141 RCX: ffff88003b2df670
| RDX: 0000000000000001 RSI: dffffc0000000000 RDI: ffffffffb5d1e140
| RBP: ffff88003b2df560 R08: dffffc0000000000 R09: 0000000000000000
| R10: ffff88003b2df718 R11: 0000000000000000 R12: ffff88003b2df5d8
| R13: 0000000000000064 R14: ffffffffb5d1e140 R15: 0000000000000000
| vsnprintf+0x173/0x1700 lib/vsprintf.c:2136
| sprintf+0xbe/0xf0 lib/vsprintf.c:2386
| proc_self_get_link+0xfb/0x1c0 fs/proc/self.c:23
| get_link fs/namei.c:1047 [inline]
| link_path_walk+0x1041/0x1490 fs/namei.c:2127
...
This happened when the host hit a page fault, and delivered it as in an
async page fault, while the guest was in an RCU read-side critical
section. The guest then tries to reschedule in kvm_async_pf_task_wait(),
but rcu_preempt_note_context_switch() would treat the reschedule as a
sleep in RCU read-side critical section, which is not allowed (even in
preemptible RCU). Thus the WARN.
To cure this, make kvm_async_pf_task_wait() go to the halt path if the
PF happens in a RCU read-side critical section.
Reported-by: Sasha Levin <levinsasha928@gmail.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-29 17:05:17 +02:00
..
2017-09-14 11:59:30 +02:00
2017-09-12 11:34:39 -07:00
2017-09-13 11:02:26 +02:00
2017-05-15 16:08:56 +02:00
2017-08-10 16:28:53 +02:00
2017-08-10 17:35:19 +02:00
2017-06-28 06:54:46 -07:00
2016-12-25 14:30:04 -08:00
2017-01-28 22:55:22 +01:00
2017-09-14 11:59:30 +02:00
2017-08-24 09:57:28 +02:00
2017-08-31 21:35:10 +02:00
2017-02-07 10:42:10 +01:00
2016-12-12 19:25:04 -08:00
2016-12-24 11:46:01 -08:00
2017-07-12 16:25:59 -07:00
2017-07-21 10:14:15 +02:00
2017-03-02 08:42:34 +01:00
2017-07-18 10:56:23 +02:00
2017-07-18 10:56:23 +02:00
2017-07-30 12:04:41 +02:00
2017-07-18 11:38:01 +02:00
2017-03-21 12:30:16 +01:00
2017-09-05 12:45:03 -07:00
2017-08-31 21:34:48 +02:00
2017-07-18 11:38:00 +02:00
2017-04-21 09:48:16 +02:00
2017-03-24 10:14:08 +01:00
2017-05-26 22:37:02 -04:00
2017-08-29 12:07:26 +02:00
2017-09-04 17:43:56 -07:00
2017-08-31 15:47:02 +02:00
2017-07-18 11:38:00 +02:00
2017-08-01 13:02:37 +02:00
2017-04-14 12:08:51 +02:00
2017-09-01 11:04:56 +02:00
2017-09-14 11:59:30 +02:00
2017-03-04 11:36:19 -08:00
2017-03-02 08:42:36 +01:00
2017-08-29 11:42:30 +02:00
2017-08-29 11:42:29 +02:00
2017-08-29 12:07:28 +02:00
2017-01-19 08:42:37 +01:00
2017-05-26 10:10:45 +02:00
2017-07-18 11:37:58 +02:00
2017-07-05 10:09:02 +02:00
2017-08-26 09:19:13 +02:00
2017-09-29 17:05:17 +02:00
2017-03-02 08:42:27 +01:00
2017-07-27 09:12:57 +02:00
2017-08-29 12:07:26 +02:00
2017-07-30 12:09:12 +02:00
2017-08-29 12:07:25 +02:00
2017-07-26 13:18:20 +02:00
2017-07-18 11:38:02 +02:00
2016-12-25 10:47:41 +01:00
2017-06-20 12:52:43 +02:00
2017-08-16 20:40:09 +02:00
2016-12-22 17:43:35 +01:00
2016-12-22 17:43:35 +01:00
2017-02-22 18:22:53 -08:00
2017-09-13 10:55:15 +02:00
2017-06-28 06:54:46 -07:00
2017-07-18 11:38:03 +02:00
2017-07-18 11:38:03 +02:00
2017-07-18 11:38:03 +02:00
2017-03-02 08:42:36 +01:00
2017-08-24 09:57:28 +02:00
2017-01-28 09:31:13 +01:00
2017-09-04 13:56:37 -07:00
2017-09-04 13:56:37 -07:00
2017-07-18 11:38:04 +02:00
2017-03-20 16:10:32 +01:00
2017-03-02 08:42:30 +01:00
2017-08-03 23:26:22 +02:00
2017-09-14 11:59:30 +02:00
2017-07-30 12:09:12 +02:00
2017-01-28 09:33:16 +01:00
2017-09-08 18:26:48 -07:00
2017-09-13 09:54:43 +02:00
2017-07-24 14:30:28 -05:00
2017-07-30 12:04:41 +02:00
2017-08-29 11:42:29 +02:00
2017-09-13 09:54:43 +02:00
2017-03-08 09:18:02 +01:00
2017-07-30 12:04:41 +02:00
2017-07-21 10:05:18 +02:00
2017-06-15 16:41:10 +02:00
2017-06-13 08:42:09 +02:00
2017-08-29 12:07:25 +02:00
2017-08-29 11:42:29 +02:00
2017-08-29 12:07:27 +02:00
2017-06-04 21:55:53 +02:00
2017-07-03 18:01:50 -07:00
2017-09-04 09:52:57 -07:00
2017-07-26 13:18:20 +02:00
2017-07-26 13:18:20 +02:00
2017-04-26 10:02:06 +02:00
2017-07-26 13:18:20 +02:00
2017-01-28 14:42:26 +01:00