[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [4710] Prevent guest reusing host memory allocations.
From: |
Laurent Desnogues |
Subject: |
Re: [Qemu-devel] [4710] Prevent guest reusing host memory allocations. |
Date: |
Mon, 9 Jun 2008 19:19:53 +0200 |
On Mon, Jun 9, 2008 at 3:47 PM, Paul Brook <address@hidden> 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