Alexey Kardashevskiy
345077c8e1
KVM: PPC: Book3S: Protect memslots while validating user address
...
Guest physical to user address translation uses KVM memslots and reading
these requires holding the kvm->srcu lock. However recently introduced
kvmppc_tce_validate() broke the rule (see the lockdep warning below).
This moves srcu_read_lock(&vcpu->kvm->srcu) earlier to protect
kvmppc_tce_validate() as well.
=============================
WARNING: suspicious RCU usage
5.1.0-rc2-le_nv2_aikATfstn1-p1 #380 Not tainted
-----------------------------
include/linux/kvm_host.h:605 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by qemu-system-ppc/8020:
#0 : 0000000094972fe9 (&vcpu->mutex){+.+.}, at: kvm_vcpu_ioctl+0xdc/0x850 [kvm]
stack backtrace:
CPU: 44 PID: 8020 Comm: qemu-system-ppc Not tainted 5.1.0-rc2-le_nv2_aikATfstn1-p1 #380
Call Trace:
[c000003fece8f740] [c000000000bcc134] dump_stack+0xe8/0x164 (unreliable)
[c000003fece8f790] [c000000000181be0] lockdep_rcu_suspicious+0x130/0x170
[c000003fece8f810] [c0000000000d5f50] kvmppc_tce_to_ua+0x280/0x290
[c000003fece8f870] [c00800001a7e2c78] kvmppc_tce_validate+0x80/0x1b0 [kvm]
[c000003fece8f8e0] [c00800001a7e3fac] kvmppc_h_put_tce+0x94/0x3e4 [kvm]
[c000003fece8f9a0] [c00800001a8baac4] kvmppc_pseries_do_hcall+0x30c/0xce0 [kvm_hv]
[c000003fece8fa10] [c00800001a8bd89c] kvmppc_vcpu_run_hv+0x694/0xec0 [kvm_hv]
[c000003fece8fae0] [c00800001a7d95dc] kvmppc_vcpu_run+0x34/0x48 [kvm]
[c000003fece8fb00] [c00800001a7d56bc] kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm]
[c000003fece8fb90] [c00800001a7c3618] kvm_vcpu_ioctl+0x460/0x850 [kvm]
[c000003fece8fd00] [c00000000041c4f4] do_vfs_ioctl+0xe4/0x930
[c000003fece8fdb0] [c00000000041ce04] ksys_ioctl+0xc4/0x110
[c000003fece8fe00] [c00000000041ce78] sys_ioctl+0x28/0x80
[c000003fece8fe20] [c00000000000b5a4] system_call+0x5c/0x70
Fixes: 42de7b9e2167 ("KVM: PPC: Validate TCEs against preregistered memory page sizes", 2018-09-10)
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2019-04-05 14:37:24 +11:00
..
2016-03-03 21:19:21 +11:00
2019-02-19 14:25:52 +11:00
2017-05-08 12:37:56 -07:00
2019-02-19 16:00:15 +11:00
2019-02-19 16:00:15 +11:00
2019-02-19 14:25:52 +11:00
2018-07-30 22:48:17 +10:00
2018-10-20 20:47:02 +11:00
2019-04-05 14:37:24 +11:00
2019-02-19 14:25:52 +11:00
2014-05-30 14:26:21 +02:00
2019-02-19 16:00:15 +11:00
2019-02-23 22:31:39 +11:00
2018-10-09 16:04:27 +11:00
2018-12-21 14:39:35 +11:00
2019-02-21 23:16:44 +11:00
2018-12-17 10:58:43 +11:00
2019-02-19 16:00:15 +11:00
2017-11-02 11:10:55 +01:00
2019-02-22 13:52:30 +11:00
2018-10-09 16:04:27 +11:00
2018-10-09 16:04:27 +11:00
2019-04-05 14:37:24 +11:00
2018-07-30 22:48:16 +10:00
2017-03-02 08:42:38 +01:00
2015-12-01 13:52:25 +11:00
2017-10-14 16:38:19 +11:00
2018-12-17 10:57:27 +11:00
2018-07-30 22:48:16 +10:00
2019-02-19 16:00:15 +11:00
2018-07-30 22:48:17 +10:00
2018-12-14 15:39:47 +11:00
2017-04-27 21:37:29 +10:00
2018-10-09 16:04:27 +11:00
2018-12-14 15:39:47 +11:00
2018-01-19 12:10:21 +11:00
2019-02-22 13:52:30 +11:00
2018-06-01 10:30:39 +10:00
2018-05-18 15:38:23 +10:00
2014-07-28 15:23:15 +02:00
2018-12-17 10:57:27 +11:00
2014-09-22 10:11:32 +02:00
2018-12-20 22:59:03 +11:00
2018-12-20 22:59:03 +11:00
2018-12-21 11:28:41 +01:00
2018-05-18 15:38:23 +10:00
2018-07-30 22:48:20 +10:00
2018-12-04 19:45:01 +11:00
2018-07-30 22:48:20 +10:00
2018-10-09 16:04:27 +11:00
2018-10-26 21:58:58 +11:00
2017-11-02 11:10:55 +01:00
2018-12-22 00:25:54 +09:00
2019-02-19 16:00:15 +11:00
2016-12-24 11:46:01 -08:00
2019-03-01 15:11:14 +11:00
2018-01-11 20:36:06 +11:00
2014-07-28 19:29:15 +02:00
2018-10-09 16:04:27 +11:00
2018-10-09 16:04:27 +11:00
2018-11-07 23:04:38 +11:00
2018-11-07 23:04:38 +11:00
2018-11-07 23:04:38 +11:00
2018-11-07 23:04:38 +11:00