aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/i386/sys_machdep.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2008-09-12 09:53:29 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2008-09-12 09:53:29 +0000
commit9719da13e74fefffb3f4a298dd63dae2ebd1bee3 (patch)
tree928284f471409dceb4fede36aa66ab053e0d40f9 /sys/i386/i386/sys_machdep.c
parentcb1d78d09abae4fdf8b868b81ea5dc11def5acaa (diff)
downloadsrc-9719da13e74fefffb3f4a298dd63dae2ebd1bee3.tar.gz
src-9719da13e74fefffb3f4a298dd63dae2ebd1bee3.zip
When doing rfork(0), i.e. separating curproc VM from any other user of
the same vmspace, decrement the reference count of the shared LDT instead of a newly-made copy. Code factually removed LDT from the process that did rfork(0). Introduce user_ldt_deref() function that does decrement of refcount for the struct proc_ldt, and call it in the rfork(0) case on the shared LDT. Reviewed by: jhb MFC after: 1 week
Notes
Notes: svn path=/head/; revision=182961
Diffstat (limited to 'sys/i386/i386/sys_machdep.c')
-rw-r--r--sys/i386/i386/sys_machdep.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c
index f6aca9cd7497..7619db7c22da 100644
--- a/sys/i386/i386/sys_machdep.c
+++ b/sys/i386/i386/sys_machdep.c
@@ -526,6 +526,14 @@ user_ldt_free(struct thread *td)
}
mdp->md_ldt = NULL;
+ user_ldt_deref(pldt);
+}
+
+void
+user_ldt_deref(struct proc_ldt *pldt)
+{
+
+ mtx_assert(&dt_lock, MA_OWNED);
if (--pldt->ldt_refcnt == 0) {
mtx_unlock_spin(&dt_lock);
kmem_free(kernel_map, (vm_offset_t)pldt->ldt_base,