From: Ingo Molnar Subject: Re: [kvm-devel] [PATCH] KVM: MMU: Fix host memory corruption on i386 with >= 4GB ram Date: Sun, 11 Mar 2007 11:33:34 +0100 Message-ID: <20070311103334.GB23396@elte.hu> References: <11736076283998-git-send-email-avi@qumranet.com> <11736076282800-git-send-email-avi@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org To: Avi Kivity Return-path: Content-Disposition: inline In-Reply-To: <11736076282800-git-send-email-avi@qumranet.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org * Avi Kivity wrote: > PAGE_MASK is an unsigned long, so using it to mask physical addresses > on i386 (which are 64-bit wide) leads to truncation. This can result > in page->private of unrelated memory pages being modified, with > disasterous results. > > Fix by not using PAGE_MASK for physical addresses; instead calculate > the correct value directly from PAGE_SIZE. Also fix a similar > BUG_ON(). > > Signed-off-by: Avi Kivity i have tested this, albeit with less than 4GB RAM. Acked-by: Ingo Molnar Ingo