vppinfra: fix map_lock issue
The release of the map_lock is a bit too early, it needs to wrap
mprotect(), otherwise the access rights of hdr may be deprived of
other worker threads.
Type: fix
@@ -461,8 +461,6 @@ clib_mem_vm_map_internal (void *base, clib_mem_page_sz_t log2_page_sz,
snprintf (hdr->name, CLIB_VM_MAP_HDR_NAME_MAX_LEN - 1, "%s", (char *) name);
mm->last_map = hdr;
- map_unlock ();
-
hdr->base_addr = (uword) base;
hdr->log2_page_sz = log2_page_sz;
hdr->num_pages = size >> log2_page_sz;
@@ -470,6 +468,8 @@ clib_mem_vm_map_internal (void *base, clib_mem_page_sz_t log2_page_sz,
hdr->name[CLIB_VM_MAP_HDR_NAME_MAX_LEN - 1] = 0;
mprotect (hdr, sys_page_sz, PROT_NONE);
+ map_unlock ();
+
CLIB_MEM_UNPOISON (base, size);
return base;
}
