From: "Laurent Desnogues" <laurent.desnogues@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [4710] Prevent guest reusing host memory allocations.
Date: Tue, 10 Jun 2008 15:40:55 +0200 [thread overview]
Message-ID: <761ea48b0806100640o746cd40fk832540e414e4c9dd@mail.gmail.com> (raw)
In-Reply-To: <761ea48b0806091019y5fc22d27k15e7b316705633ff@mail.gmail.com>
On Mon, Jun 9, 2008 at 7:19 PM, Laurent Desnogues
<laurent.desnogues@gmail.com> wrote:
> On Mon, Jun 9, 2008 at 3:47 PM, Paul Brook <paul@nowt.org> 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?
I guess addr = h2g(p); should be replaced with
addr = (unsigned long)p;
BTW this makes me think that perhaps GUEST_BASE should
be used here and if that's true in some other places as well
(qemu_vmalloc for instance).
These are all *wild guesses* from someone who doesn't fully
understand qemu...
Laurent
next prev parent reply other threads:[~2008-06-10 13:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-09 13:47 [Qemu-devel] [4710] Prevent guest reusing host memory allocations Paul Brook
2008-06-09 17:19 ` Laurent Desnogues
2008-06-10 13:40 ` Laurent Desnogues [this message]
2008-08-08 9:19 ` Laurent Desnogues
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=761ea48b0806100640o746cd40fk832540e414e4c9dd@mail.gmail.com \
--to=laurent.desnogues@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).