From: Jan Kiszka <jan.kiszka@web.de>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: KVM <kvm@vger.kernel.org>, Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, Kevin O'Connor <kevin@koconnor.net>,
Avi Kivity <avi@redhat.com>,
Anthony Liguori <anthony@codemonkey.ws>,
Liu Sheng <liusheng@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/5] Qemu: do not mark bios readonly
Date: Wed, 31 Oct 2012 07:46:36 +0100 [thread overview]
Message-ID: <5090C94C.8080808@web.de> (raw)
In-Reply-To: <5090C6C9.2070403@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 2154 bytes --]
On 2012-10-31 07:35, Xiao Guangrong wrote:
>>>>> We can not do that for pflash is a RD device which can not be directly written,
>>>>> kvm can not emulate the instruction which implicitly write the memory. (e.g:
>>>>> using this area as stack).
>>>>
>>>> Isn't enabling ROMD support for KVM that whole point of your patches? I
>>>
>>> It can generate MMIO exit if ROMD be written, that means the instruction
>>> needs kvm's help to be finished if it explicitly/implicitly write the memory.
>>
>> I was assuming that this is what you already do. If you trap write
>> accesses, why not allowing user space to handle them?
>
> Already have done that, guest write ROMD -> vmexit -> return to userspace with
> MMIO Exit.
Great.
>
>>
>>>
>>>> do not see yet what prevents this still, but it should be fixed first.
>>>
>>> For the explicitly write memory access, it is easy to be fixed - we just need
>>> to fetch the instruction from EIP and emulate it. But for the implicitly memory
>>> access, fixing its emulation is really hard work. Really worth doing it?
>>
>> Aren't the read-only regions also marked read-only on the host side to
>> avoid that the guest writes to it? Or how is this implemented?
>>
>> Support for flash emulation in KVM mode is increasingly important, for
>> embedded platform virtualization but also for classic x86 server-like
>> targets. The pflash-backed system firmware device was added for a reason...
>
> Please allow me to clarify it more clearly.
>
> The flash is ROMD device means guest can not write it, any kinds of guest write
> access on this device can cause vmexit to kvm and return to userspace.
>
> We should pay more attention on it if we execute the code in ROMD since we
> can not use ROMD as stack/page table/IDT table and all other implicitly write access.
> Of course, if you do not use ROM as those purposes, it is okay. :)
So the problem is that there is KVM code that still blindly writes to
guest memory and does not take the memory regions' protection flag into
account? And we cannot mark those regions read only in the host's page
table?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
next prev parent reply other threads:[~2012-10-31 6:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-25 9:20 [Qemu-devel] [PATCH v2 0/5] Qemu: implement readonly memory Xiao Guangrong
2012-10-25 9:21 ` [Qemu-devel] [PATCH v2 1/5] KVM: define KVM_CAP_READONLY_MEM unconditionally Xiao Guangrong
2012-10-25 12:14 ` Jan Kiszka
2012-10-25 9:21 ` [Qemu-devel] [PATCH v2 2/5] Qemu: update header files Xiao Guangrong
2012-10-25 11:03 ` Peter Maydell
2012-10-25 9:22 ` [Qemu-devel] [PATCH v2 3/5] Qemu: do not mark bios readonly Xiao Guangrong
2012-10-26 10:35 ` Jan Kiszka
2012-10-29 7:09 ` Xiao Guangrong
2012-10-29 7:44 ` Jan Kiszka
2012-10-29 8:31 ` Xiao Guangrong
2012-10-31 6:03 ` Jan Kiszka
2012-10-31 6:35 ` Xiao Guangrong
2012-10-31 6:46 ` Jan Kiszka [this message]
2012-10-31 7:01 ` Xiao Guangrong
2012-10-31 7:21 ` Jan Kiszka
2012-10-25 9:22 ` [Qemu-devel] [PATCH v2 4/5] Qemu: implement readonly memory Xiao Guangrong
2012-10-25 9:23 ` [Qemu-devel] [PATCH v2 5/5] Qemu: mark pci rom readonly Xiao Guangrong
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=5090C94C.8080808@web.de \
--to=jan.kiszka@web.de \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=kevin@koconnor.net \
--cc=kvm@vger.kernel.org \
--cc=liusheng@linux.vnet.ibm.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xiaoguangrong@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).