From: "Scott Parish" Subject: [patch] unwanted sign extending Date: Tue, 21 Jun 2005 20:10:30 +0000 Message-ID: <20050621201030.GB16276@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="FL5UXtIhxfXey3p5" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline static int alloc_l3_table(struct pfn_info *page) { ... unsigned long vaddr; unsigned int i; ... for ( i = 0; i < L3_PAGETABLE_ENTRIES; i++ ) { vaddr = i << L3_PAGETABLE_SHIFT; ... } ... } "i" gets sign extended when its shifted, so vaddr has all its high bits set. Because of that some l2 page_type's come out looking like PGT_writable instead of PGT_l2. Eventually this leads to an attempt to call put_page_type on the page twice, once when cleaning up recursively from l4, and once from walking the raw frames list. The second put_page_type hits the ASSERT that the type count isn't 0. With the attached patch, i can completely run a simple "hello world" domu, and its cleanup. Linux domu still probably doesn't work. sRp -- Scott Parish Signed-off-by: srparish@us.ibm.com --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="no-sign-extension.diff" --- old-xen-build/xen/arch/x86/mm.c 2005-06-14 15:55:34.000000000 +0000 +++ new-xen-build/xen/arch/x86/mm.c 2005-06-21 20:35:09.000000000 +0000 @@ -814,7 +814,7 @@ static int alloc_l3_table(struct pfn_inf unsigned long pfn = page_to_pfn(page); unsigned long vaddr; l3_pgentry_t *pl3e; - int i; + unsigned int i; ASSERT(!shadow_mode_refcounts(d)); --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --FL5UXtIhxfXey3p5--