vm/map: disable sharing of amaps between same process' map entries
This interacts badly with sharing between forked processes and currently
leads to use-after-free and accidental sharing of anons.
@@ -322,6 +322,7 @@ static void *_map_map(vm_map_t *map, void *vaddr, process_t *proc, size_t size,
e->amap = NULL;
e->aoffs = 0;
+#if 0
if (o == NULL) {
/* Try to use existing amap */
if (next != NULL && next->amap != NULL && next->aoffs >= (next->vaddr - e->vaddr)) {
@@ -333,6 +334,7 @@ static void *_map_map(vm_map_t *map, void *vaddr, process_t *proc, size_t size,
e->aoffs = prev->aoffs + (e->vaddr - prev->vaddr);
}
}
+#endif
_map_add(proc, map, e);
}
