From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5l2E-0006J3-F4 for qemu-devel@nongnu.org; Mon, 09 Jun 2008 13:19:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5l2C-0006HK-LG for qemu-devel@nongnu.org; Mon, 09 Jun 2008 13:19:57 -0400 Received: from [199.232.76.173] (port=36731 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5l2C-0006HA-6W for qemu-devel@nongnu.org; Mon, 09 Jun 2008 13:19:56 -0400 Received: from rv-out-0708.google.com ([209.85.198.247]:41377) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5l2C-00063E-3h for qemu-devel@nongnu.org; Mon, 09 Jun 2008 13:19:56 -0400 Received: by rv-out-0708.google.com with SMTP id f25so1958830rvb.22 for ; Mon, 09 Jun 2008 10:19:54 -0700 (PDT) Message-ID: <761ea48b0806091019y5fc22d27k15e7b316705633ff@mail.gmail.com> Date: Mon, 9 Jun 2008 19:19:53 +0200 From: "Laurent Desnogues" Subject: Re: [Qemu-devel] [4710] Prevent guest reusing host memory allocations. In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mon, Jun 9, 2008 at 3:47 PM, Paul Brook wrote: > Modified: trunk/exec.c > =================================================================== > --- trunk/exec.c 2008-06-09 12:10:22 UTC (rev 4709) > +++ trunk/exec.c 2008-06-09 13:47:45 UTC (rev 4710) > @@ -263,13 +263,33 @@ [...] > +#if defined(CONFIG_USER_ONLY) > + unsigned long addr; > + size_t len = sizeof(PageDesc) * L2_SIZE; > + /* Don't use qemu_malloc because it may recurse. */ > + p = mmap(0, len, PROT_READ | PROT_WRITE, > + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); > *lp = p; > + addr = h2g(p); > + if (addr == (target_ulong)addr) { > + page_set_flags(addr & TARGET_PAGE_MASK, > + TARGET_PAGE_ALIGN(addr + len), > + PAGE_RESERVED); > + } I don't understand what the test is supposed to do, to me it looks like it can't fail since we have: #define h2g(x) ((target_ulong)(x - GUEST_BASE)) Did I miss something? Laurent