qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH v2 10/10] linux-user: completely re-write init_guest_space
Date: Thu, 2 Apr 2020 15:03:11 -0700	[thread overview]
Message-ID: <57e11cc4-8d65-415b-0d08-1a6b38298dca@linaro.org> (raw)
In-Reply-To: <20200401094759.5835-11-alex.bennee@linaro.org>

On 4/1/20 2:47 AM, Alex Bennée wrote:
> +    /*
> +     * Now we are going to try and map something, we start by trying
> +     * to satisfy exactly what the guest wants. This is unlikely to
> +     * succeed but will make the code generators job easier if it can
> +     * be done.
> +     *
> +     * If the commpage check isn't happy after we allocate we need to
> +     * fall back to finding a big enough hole in the address space.
>       */
> +    map_addr = (void *) guest_start;
> +    if (mmap(map_addr, host_size, PROT_NONE, flags, -1, 0) == map_addr) {

Not recording the result of the mmap is wrong.

There are not just two options, as implied by your "== map_addr" check: you are
missing out on the mmap succeeds (!= MAP_FAILED) but still not equal to map_addr.

If the kernel gives us a different address than the one requested, we can
either decide to use it, or unmap it again.  We can't do either with the above.

This is definitely going to have to wait for 5.1.


r~


      parent reply	other threads:[~2020-04-02 22:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01  9:47 [PATCH for 5.0 v2 00/10] A selection of sanitiser fixes Alex Bennée
2020-04-01  9:47 ` [PATCH v2 01/10] elf-ops: bail out if we have no function symbols Alex Bennée
2020-04-01  9:47 ` [PATCH v2 02/10] linux-user: protect fcntl64 with an #ifdef Alex Bennée
2020-04-01  9:47 ` [PATCH v2 03/10] tests/tcg: remove extraneous pasting macros Alex Bennée
2020-04-01  9:47 ` [PATCH v2 04/10] linux-user: more debug for init_guest_space Alex Bennée
2020-04-01  9:47 ` [PATCH v2 05/10] target/xtensa: add FIXME for translation memory leak Alex Bennée
2020-04-01 22:58   ` Max Filippov
2020-04-01  9:47 ` [PATCH v2 06/10] gdbstub: fix compiler complaining Alex Bennée
2020-04-01  9:47 ` [PATCH v2 07/10] softfloat: Fix BAD_SHIFT from normalizeFloatx80Subnormal Alex Bennée
2020-04-01  9:47 ` [PATCH v2 08/10] linux-user: factor out reading of /proc/self/maps Alex Bennée
2020-04-02 16:58   ` Richard Henderson
2020-04-03 12:35     ` Alex Bennée
2020-04-01  9:47 ` [PATCH v2 09/10] linux-user: clean-up padding on /proc/self/maps Alex Bennée
2020-04-02 16:59   ` Richard Henderson
2020-04-01  9:47 ` [PATCH v2 10/10] linux-user: completely re-write init_guest_space Alex Bennée
2020-04-02  9:10   ` Alex Bennée
2020-04-02 22:03   ` Richard Henderson [this message]

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=57e11cc4-8d65-415b-0d08-1a6b38298dca@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).