From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: Re: [BUG] virtio-pci queue allocation not page-aligned Date: Wed, 3 Dec 2008 08:35:53 +1030 Message-ID: <200812030835.54164.rusty@rustcorp.com.au> References: <1228244901.8128.13.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: Anthony Liguori , "kvm-devel" To: Hollis Blanchard Return-path: Received: from ozlabs.org ([203.10.76.45]:52257 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbYLBWF7 (ORCPT ); Tue, 2 Dec 2008 17:05:59 -0500 In-Reply-To: <1228244901.8128.13.camel@localhost.localdomain> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Wednesday 03 December 2008 05:38:21 Hollis Blanchard wrote: > I just spent a number of hours tracking this one down, and I'm not too > thrilled about it. vp_find_vq() does the memory allocation for virtio > PCI rings, and it uses kzalloc() to do it. This is bad because the ring > memory *must* be page-aligned. > > According to Anthony, at the time this code was written, various slab > allocators were checked and all happened to return page-aligned buffers. > So how did I hit a problem? I had enabled CONFIG_SLUB_DEBUG_ON while > investigating an unrelated problem, which offset the address by 64 > bytes. > > One option is to add a BUG_ON(addr & ~PAGE_MASK) to vp_find_vq(). That's > better than nothing, but still stinks. It's a bug, we fix it. I've complained before, but since there was no evidence of it actually breaking, I didn't push. Prepare a patch, I'll try to get it in this release. Thanks, Rusty.