]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: set_memory_region: Disallow changing read-only attribute later
authorTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Wed, 30 Jan 2013 10:40:41 +0000 (19:40 +0900)
committerMarcelo Tosatti <mtosatti@redhat.com>
Tue, 5 Feb 2013 00:56:47 +0000 (22:56 -0200)
commitbc082fa7ed366e4b42beca7cae9de4d152a6e235
tree8835d8a5cf79704569f568675792672c930746ae
parent70fc75985a92e215461cc8de9bb9b6d3e0a012c3
KVM: set_memory_region: Disallow changing read-only attribute later

As Xiao pointed out, there are a few problems with it:
 - kvm_arch_commit_memory_region() write protects the memory slot only
   for GET_DIRTY_LOG when modifying the flags.
 - FNAME(sync_page) uses the old spte value to set a new one without
   checking KVM_MEM_READONLY flag.

Since we flush all shadow pages when creating a new slot, the simplest
fix is to disallow such problematic flag changes: this is safe because
no one is doing such things.

Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Documentation/virtual/kvm/api.txt
virt/kvm/kvm_main.c