Justus Winter, le Fri 05 Sep 2014 14:53:52 +0200, a écrit :
> there is a bug affecting vm_map. Contrary to the documentation,
> address is not ignored if anywhere is given, leading to spurious
> KERN_NO_SPACE errors.
Uh, that's bad indeed.
Apparently most of our source code copes with that by explicitly setting
address to 0, but some places such as pager_memcpy don't.
I'm tempted to rather fix the behavior according to the documentation,
and go with something like this:
diff --git a/vm/vm_user.c b/vm/vm_user.c
index f7c87cc..f741705 100644
--- a/vm/vm_user.c
+++ b/vm/vm_user.c
@@ -336,6 +336,9 @@ kern_return_t vm_map(
if (size == 0)
return KERN_INVALID_ARGUMENT;
+ if (anywhere)
+ *address = 0;
+
*address = trunc_page(*address);
size = round_page(size);
I don't see any place in our source code which would depend on 'address'
being a hint for the map address. glibc's mmap() copes with the kernel
behavior for instance.
Samuel