summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-02-17 23:47:16 +0000
committerkib <kib@FreeBSD.org>2012-02-17 23:47:16 +0000
commitabd1094f175810ed5ec686a897d27fae63d1ca87 (patch)
tree8d01d9dbb96b87e94aed60c4fc7d2b35c530a0c8 /sys/i386/ibcs2
parentb7cff9346353517bc204fe45512c010fcab10186 (diff)
downloadFreeBSD-src-abd1094f175810ed5ec686a897d27fae63d1ca87.zip
FreeBSD-src-abd1094f175810ed5ec686a897d27fae63d1ca87.tar.gz
Fix misuse of the kernel map in miscellaneous image activators.
Vnode-backed mappings cannot be put into the kernel map, since it is a system map. Use exec_map for transient mappings, and remove the mappings with kmem_free_wakeup() to notify the waiters on available map space. Do not map the whole executable into KVA at all to copy it out into usermode. Directly use vn_rdwr() for the case of not page aligned binary. There is one place left where the potentially unbounded amount of data is mapped into exec_map, namely, in the COFF image activator enumeration of the needed shared libraries. Reviewed by: alc MFC after: 2 weeks
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r--sys/i386/ibcs2/imgact_coff.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c
index abafe54..a28ba52 100644
--- a/sys/i386/ibcs2/imgact_coff.c
+++ b/sys/i386/ibcs2/imgact_coff.c
@@ -146,10 +146,7 @@ load_coff_section(struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset,
error = copyout(data_buf, (caddr_t) map_addr, copy_len);
- if (vm_map_remove(exec_map,
- (vm_offset_t) data_buf,
- (vm_offset_t) data_buf + PAGE_SIZE))
- panic("load_coff_section vm_map_remove failed");
+ kmem_free_wakeup(exec_map, (vm_offset_t)data_buf, PAGE_SIZE);
return error;
}
@@ -280,11 +277,7 @@ coff_load_file(struct thread *td, char *name)
error = 0;
dealloc_and_fail:
- if (vm_map_remove(exec_map,
- (vm_offset_t) ptr,
- (vm_offset_t) ptr + PAGE_SIZE))
- panic("%s vm_map_remove failed", __func__);
-
+ kmem_free_wakeup(exec_map, (vm_offset_t)ptr, PAGE_SIZE);
fail:
VOP_UNLOCK(vp, 0);
unlocked_fail:
@@ -421,10 +414,7 @@ exec_coff_imgact(imgp)
}
free(libbuf, M_TEMP);
}
- if (vm_map_remove(exec_map,
- (vm_offset_t) buf,
- (vm_offset_t) buf + len))
- panic("exec_coff_imgact vm_map_remove failed");
+ kmem_free_wakeup(exec_map, (vm_offset_t)buf, len);
if (error)
goto fail;
}
OpenPOWER on IntegriCloud