Commit 98c1076c authored by Alex Bennée's avatar Alex Bennée Committed by Paolo Bonzini
Browse files

linux-user/elfload: ensure mmap_lock() held while setting up



Future patches will enforce the holding of mmap_lock() when we are
manipulating internal memory structures. Technically it doesn't matter
in the case of elfload as we haven't started executing yet. However it
is easier to grab the lock when required than special case the
translate-all API.

Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Reviewed-by: default avatarRichard Henderson <rth@twiddle.net>
Message-Id: <20161027151030.20863-8-alex.bennee@linaro.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 7d7500d9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1842,6 +1842,8 @@ static void load_elf_image(const char *image_name, int image_fd,
    info->pt_dynamic_addr = 0;
#endif

    mmap_lock();

    /* Find the maximum size of the image and allocate an appropriate
       amount of memory to handle that.  */
    loaddr = -1, hiaddr = 0;
@@ -2002,6 +2004,8 @@ static void load_elf_image(const char *image_name, int image_fd,
        load_symbols(ehdr, image_fd, load_bias);
    }

    mmap_unlock();

    close(image_fd);
    return;