From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH 8/9] x86: kvm_hv_set_msr(): use __put_user() instead of 32bit __clear_user()
Date: Sat, 30 May 2020 20:42:32 +0100 [thread overview]
Message-ID: <20200530194232.GU23230@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAHk-=wg03AwbLH0zLRbOOQR_cZD89dM0KMU-uLMkG2sG9K_yag@mail.gmail.com>
On Sat, May 30, 2020 at 12:20:54PM -0700, Linus Torvalds wrote:
> On Sat, May 30, 2020 at 12:14 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > > And none of that code verifies that the end result is a user address.
> >
> > kvm_is_error_hva() is
> > return addr >= PAGE_OFFSET;
>
> Ahh, that's what I missed. It won't work on other architectures, but
> within x86 it's fine.
FWIW, we use virt/kvm on x86, powerpc, mips, s390 and arm64.
For x86 and powerpc the check is, AFAICS, OK (ppc kernel might start
higher than PAGE_OFFSET, but not lower than it). For arm64... not
sure - I'm not familiar with the virtual address space layout we use
there. mips does *NOT* get that protection at all - there kvm_is_error_hva()
is IS_ERR_VALUE() (thus the "at least on non-mips" upthread). And
for s390 it's also IS_ERR_VALUE(), but that's an separate can of worms -
there access_ok() is constant true; if we ever hit any of that code in
virt/kvm while under KERNEL_DS, we are well and truly fucked there.
next prev parent reply other threads:[~2020-05-30 19:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200528234025.GT23230@ZenIV.linux.org.uk>
[not found] ` <20200529232723.44942-1-viro@ZenIV.linux.org.uk>
[not found] ` <20200529232723.44942-8-viro@ZenIV.linux.org.uk>
2020-05-29 23:52 ` [PATCH 8/9] x86: kvm_hv_set_msr(): use __put_user() instead of 32bit __clear_user() Linus Torvalds
2020-05-30 14:31 ` Al Viro
2020-05-30 14:52 ` Al Viro
2020-05-30 16:20 ` Paolo Bonzini
2020-05-30 17:57 ` Linus Torvalds
2020-05-30 18:38 ` Al Viro
2020-05-30 18:52 ` Linus Torvalds
2020-05-30 19:14 ` Al Viro
2020-05-30 19:20 ` Linus Torvalds
2020-05-30 19:42 ` Al Viro [this message]
2020-05-30 20:43 ` Al Viro
2020-05-30 19:19 ` Al Viro
2020-05-30 19:27 ` Al Viro
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=20200530194232.GU23230@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=kvm@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=torvalds@linux-foundation.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