summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-11-09 22:31:21 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-11-09 22:31:21 +0100
commit94b2c453829b3aebdaccf7d3d252136b283002b3 (patch)
tree741fc5b14a62a18f66e349b8234088f59e5c171f
parent9480792609c779516ac465ac5a038101032be77d (diff)
Deal with odd kernel behavior
Some versions of gnumach actually take address as a mapping hint, and would fail if the hint is bogus. Make sure to pass 0 for those versions. * console/pager.c (user_pager_create): Make sure to set *user to 0 before calling vm_map. * libdiskfs/disk-pager.c (diskfs_start_disk_pager): Make sure to set *image to 0 before calling vm_map. * libpager/pager-memcpy.c (pager_memcpy): Set window to 0 before calling vm_map. * tmpfs/node.c (diskfs_get_filemap): Make sure to set np->dn->u.reg.memref to 0 before calling vm_map.
-rw-r--r--console/pager.c1
-rw-r--r--libdiskfs/disk-pager.c1
-rw-r--r--libpager/pager-memcpy.c2
-rw-r--r--tmpfs/node.c1
4 files changed, 4 insertions, 1 deletions
diff --git a/console/pager.c b/console/pager.c
index 3568211e..5e13ba48 100644
--- a/console/pager.c
+++ b/console/pager.c
@@ -169,6 +169,7 @@ user_pager_create (struct user_pager *user_pager, unsigned int npages,
mach_port_insert_right (mach_task_self (), user_pager->memobj,
user_pager->memobj, MACH_MSG_TYPE_MAKE_SEND);
+ *user = 0;
err = vm_map (mach_task_self (),
(vm_address_t *) user,
(vm_size_t) npages * vm_page_size,
diff --git a/libdiskfs/disk-pager.c b/libdiskfs/disk-pager.c
index 4083ef27..008aa2dc 100644
--- a/libdiskfs/disk-pager.c
+++ b/libdiskfs/disk-pager.c
@@ -60,6 +60,7 @@ diskfs_start_disk_pager (struct user_pager_info *upi,
MACH_MSG_TYPE_MAKE_SEND);
/* Now map the disk image. */
+ *image = 0;
err = vm_map (mach_task_self (), (vm_address_t *)image, size,
0, 1, disk_pager_port, 0, 0,
VM_PROT_READ | (diskfs_readonly ? 0 : VM_PROT_WRITE),
diff --git a/libpager/pager-memcpy.c b/libpager/pager-memcpy.c
index f2be5585..479c06f0 100644
--- a/libpager/pager-memcpy.c
+++ b/libpager/pager-memcpy.c
@@ -45,7 +45,7 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
#define VMCOPY_WINDOW_DEFAULT_SIZE (32 * vm_page_size)
#define MEMCPY_WINDOW_DEFAULT_SIZE (32 * vm_page_size)
- vm_address_t window;
+ vm_address_t window = 0;
vm_size_t window_size;
error_t do_vm_copy (void)
diff --git a/tmpfs/node.c b/tmpfs/node.c
index acc029ae..8835e3fd 100644
--- a/tmpfs/node.c
+++ b/tmpfs/node.c
@@ -508,6 +508,7 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot)
/* XXX we need to keep a reference to the object, or GNU Mach
will terminate it when we release the map. */
+ np->dn->u.reg.memref = 0;
vm_map (mach_task_self (), &np->dn->u.reg.memref, 4096, 0, 1,
np->dn->u.reg.memobj, 0, 0, VM_PROT_NONE, VM_PROT_NONE,
VM_INHERIT_NONE);