Received: from eggs.gnu.org ([208.118.235.92]:60426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEVF6-0005SO-9V for qemu-devel@nongnu.org; Wed, 19 Sep 2012 21:07:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEVF4-0004Ih-W9 for qemu-devel@nongnu.org; Wed, 19 Sep 2012 21:07:48 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:59674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEVF4-0004IU-Fh for qemu-devel@nongnu.org; Wed, 19 Sep 2012 21:07:46 -0400 Received: from m4.gw.fujitsu.co.jp (unknown [10.0.50.74]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id A0F653EE0B5 for ; Thu, 20 Sep 2012 10:07:44 +0900 (JST) Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 8A4E645DE50 for ; Thu, 20 Sep 2012 10:07:44 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 7383E45DE4D for ; Thu, 20 Sep 2012 10:07:44 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 6564E1DB803E for ; Thu, 20 Sep 2012 10:07:44 +0900 (JST) Received: from m023.s.css.fujitsu.com (m023.s.css.fujitsu.com [10.0.81.63]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 23AE21DB8037 for ; Thu, 20 Sep 2012 10:07:44 +0900 (JST) Date: Thu, 20 Sep 2012 10:06:51 +0900 (JST) Message-Id: <20120920.100651.77660352.d.hatayama@jp.fujitsu.com> From: HATAYAMA Daisuke In-Reply-To: <20120919102326.54f7a921@doriath.home> References: <505928C8.9060801@cn.fujitsu.com> <20120919.112651.385607604.d.hatayama@jp.fujitsu.com> <20120919102326.54f7a921@doriath.home> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] qmp: dump-guest-memory: -p option has issues, fix it or drop it? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: lcapitulino@redhat.com Cc: jan.kiszka@siemens.com, mtosatti@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws, eblake@redhat.com From: Luiz Capitulino Subject: Re: [Qemu-devel] qmp: dump-guest-memory: -p option has issues, fix it or drop it? Date: Wed, 19 Sep 2012 10:23:26 -0300 > On Wed, 19 Sep 2012 11:26:51 +0900 (JST) > HATAYAMA Daisuke wrote: > >> From: Wen Congyang >> Subject: Re: [Qemu-devel] qmp: dump-guest-memory: -p option has issues, fix it or drop it? >> Date: Wed, 19 Sep 2012 10:07:04 +0800 >> >> > At 09/19/2012 08:18 AM, Luiz Capitulino Wrote: >> >> On Tue, 18 Sep 2012 16:13:30 -0500 >> >> Anthony Liguori wrote: >> >> >> >>> Markus Armbruster writes: >> >>> >> >>>> Jan Kiszka writes: >> >>>> >> How about dropping making a whole list of memory maps at the same >> time, and how about rewriting the code so that it always has at most >> one memory mapping by merging virtually consequtive chunks? If >> possible, only 40 bytes is needed. > > It already merges contiguous addresses and addresses that fall in > the same range. It can also skip addresses due to a few reasons (I/O > page, not present page, etc), which makes the problem very unlikely > in practice. > I've noticed this locally, thanks. > Our concern is with guests intentionally trying to make qemu allocate > more memory. My idea is not to create a list of a whole memory mapping. This needs O(n), which can be a target of attackers. If possible to drop this list, memory consumption is O(1), and there's no room for any guest to attack. Concretely, the processing becomes: first walking page tables to identify a memory mapping corresponding to a PT_LOAD entry, then write it when reaching the part belonging to a next PT_LOAD entry. But the problem I've noticed just now..., is that then we need to walk page tables twice: first for writing program header tables and second for writing memory part. Code becomes not clean. Thanks. HATAYAMA, Daisuke