On 03/06/16 23:40, Alex Bennée wrote: > This adds calls to the assert_memory_lock for all public APIs which are > documented as holding the mmap_lock for user-mode. > > Signed-off-by: Alex Bennée <alex.ben...@linaro.org> > --- > linux-user/elfload.c | 4 ++++ > translate-all.c | 20 ++++++++++++++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/linux-user/elfload.c b/linux-user/elfload.c > index bb2558f..f72c275 100644 > --- a/linux-user/elfload.c > +++ b/linux-user/elfload.c > @@ -1839,6 +1839,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; > @@ -1999,6 +2001,8 @@ static void load_elf_image(const char *image_name, int > image_fd, > load_symbols(ehdr, image_fd, load_bias); > } > > + mmap_unlock(); > +
This change is out of scope of this patch, I think. > close(image_fd); > return; > > diff --git a/translate-all.c b/translate-all.c > index 8b162ff..aba6cb6 100644 > --- a/translate-all.c > +++ b/translate-all.c > @@ -453,6 +453,10 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, > int alloc) > void **lp; > int i; > > + if (alloc) { > + assert_memory_lock(); > + } > + > /* Level 1. Always allocated. */ > lp = l1_map + ((index >> V_L1_SHIFT) & (V_L1_SIZE - 1)); > > @@ -819,6 +823,8 @@ static TranslationBlock *tb_alloc(target_ulong pc) > { > TranslationBlock *tb; > > + assert_tb_lock(); > + Hmm, the patch subject doesn't mention tb_lock... > if (tcg_ctx.tb_ctx.nb_tbs >= tcg_ctx.code_gen_max_blocks) { > return NULL; > } Kind regards, Sergey