From: Paul Mackerras <paulus@ozlabs.org>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH kernel] KVM: PPC: Protect memslots while validating user address
Date: Tue, 30 Apr 2019 10:01:59 +0000 [thread overview]
Message-ID: <20190430100159.GC32205@blackberry> (raw)
On Fri, Mar 29, 2019 at 04:41:13PM +1100, Alexey Kardashevskiy wrote:
> 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>
Thanks, patch applied to my kvm-ppc-fixes tree.
Paul.
next reply other threads:[~2019-04-30 10:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 10:01 Paul Mackerras [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-03-29 5:41 [PATCH kernel] KVM: PPC: Protect memslots while validating user address Alexey Kardashevskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190430100159.GC32205@blackberry \
--to=paulus@ozlabs.org \
--cc=kvm-ppc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox