qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC v4 07/28] linux-user/elfload: ensure mmap_lock() held


From: Alex Bennée
Subject: [Qemu-devel] [RFC v4 07/28] linux-user/elfload: ensure mmap_lock() held while setting up
Date: Thu, 11 Aug 2016 16:24:03 +0100

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: Alex Bennée <address@hidden>

---
v4
  - split from assert patch
---
 linux-user/elfload.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index f807baf..4b125b9 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1838,6 +1838,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;
@@ -1998,6 +2000,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;
 
-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]