aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2003-01-13 23:04:32 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2003-01-13 23:04:32 +0000
commit3db161e07937ad130a89eb68afb1967c9ee5c7dd (patch)
tree3c875a6ad9627d4125943a71834883e1b354baa5 /sys/vm/vm_map.c
parent1c33791c803faa43fbeb6f015372f05a3bd3d962 (diff)
downloadsrc-3db161e07937ad130a89eb68afb1967c9ee5c7dd.tar.gz
src-3db161e07937ad130a89eb68afb1967c9ee5c7dd.zip
It is possible for an active aio to prevent shared memory from being
dereferenced when a process exits due to the vmspace ref-count being bumped. Change shmexit() and shmexit_myhook() to take a vmspace instead of a process and call it in vmspace_dofree(). This way if it is missed in exit1()'s early-resource-free it will still be caught when the zombie is reaped. Also fix a potential race in shmexit_myhook() by NULLing out vmspace->vm_shm prior to calling shm_delete_mapping() and free(). MFC after: 7 days
Notes
Notes: svn path=/head/; revision=109205
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 97d7c6d7725e..6c53b7fd49ac 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -80,6 +80,7 @@
#include <sys/resourcevar.h>
#include <sys/sysent.h>
#include <sys/stdint.h>
+#include <sys/shm.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -284,6 +285,13 @@ static __inline void
vmspace_dofree(struct vmspace *vm)
{
CTR1(KTR_VM, "vmspace_free: %p", vm);
+
+ /*
+ * Make sure any SysV shm is freed, it might not have been in
+ * exit1().
+ */
+ shmexit(vm);
+
/*
* Lock the map, to wait out all other references to it.
* Delete all of the mappings and pages they hold, then call