account for start offset on largepage aligned-sized memslots
PATCH 1/1 account for start offset on largepage aligned-sized memslots
Account for the case where memslot size is largepage aligned, but does not start on largepage aligned offset.
Otherwise it allocates one lpage_info struct less than what the memslot spans, possibly resulting in memory corruption.
virt/kvm/kvm_main.c +3 -0
@@ -347,6 +347,9 @@ int __kvm_set_memory_region(struct kvm *kvm,int largepages = npages /KVM_PAGES_PER_HPAGE ;if (npages %KVM_PAGES_PER_HPAGE ) largepages++; +if (base_gfn %KVM_PAGES_PER_HPAGE ) + largepages++; + new.lpage_info =vmalloc (largepages *sizeof (*new.lpage_info));if (!new.lpage_info)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Avi Kivity
AppliedQuoted 6 lines · Marcelo Tosatti
Account for the case where memslot size is largepage aligned, but does not start on largepage aligned offset.
Otherwise it allocates one
lpage_infostruct less than what the memslot spans, possibly resulting in memory corruption.
Applied, thanks.
Signature · 8 lines
Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace