[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fixing gnumachs vm_map
From: |
Samuel Thibault |
Subject: |
Re: Fixing gnumachs vm_map |
Date: |
Sat, 6 Sep 2014 11:39:35 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
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