svn commit: r319318 - in head/sys/compat/linuxkpi/common: include/linux src
Hans Petter Selasky
hselasky at FreeBSD.org
Wed May 31 13:01:28 UTC 2017
Author: hselasky
Date: Wed May 31 13:01:27 2017
New Revision: 319318
URL: https://svnweb.freebsd.org/changeset/base/319318
Log:
Don't acquire a reference on the VM-space when allocating the LinuxKPI
task structure to avoid deadlock when tearing down the VM object
during a process exit.
Found by: markj @
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/compat/linuxkpi/common/include/linux/mm_types.h
head/sys/compat/linuxkpi/common/src/linux_current.c
head/sys/compat/linuxkpi/common/src/linux_page.c
Modified: head/sys/compat/linuxkpi/common/include/linux/mm_types.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/mm_types.h Wed May 31 12:08:25 2017 (r319317)
+++ head/sys/compat/linuxkpi/common/include/linux/mm_types.h Wed May 31 13:01:27 2017 (r319318)
@@ -38,11 +38,9 @@
struct vm_area_struct;
struct task_struct;
-struct vmspace;
struct mm_struct {
struct vm_area_struct *mmap;
- struct vmspace *vmspace;
atomic_t mm_count;
atomic_t mm_users;
size_t pinned_vm;
Modified: head/sys/compat/linuxkpi/common/src/linux_current.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_current.c Wed May 31 12:08:25 2017 (r319317)
+++ head/sys/compat/linuxkpi/common/src/linux_current.c Wed May 31 13:01:27 2017 (r319318)
@@ -96,7 +96,6 @@ linux_alloc_current(struct thread *td, int flags)
init_rwsem(&mm->mmap_sem);
atomic_set(&mm->mm_count, 1);
atomic_set(&mm->mm_users, 1);
- mm->vmspace = vmspace_acquire_ref(proc);
/* set mm_struct pointer */
ts->mm = mm;
/* clear pointer to not free memory */
@@ -119,7 +118,7 @@ linux_get_task_mm(struct task_struct *task)
struct mm_struct *mm;
mm = task->mm;
- if (mm != NULL && mm->vmspace != NULL) {
+ if (mm != NULL) {
atomic_inc(&mm->mm_users);
return (mm);
}
@@ -129,8 +128,6 @@ linux_get_task_mm(struct task_struct *task)
void
linux_mm_dtor(struct mm_struct *mm)
{
- if (mm->vmspace != NULL)
- vmspace_free(mm->vmspace);
free(mm, M_LINUX_CURRENT);
}
Modified: head/sys/compat/linuxkpi/common/src/linux_page.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_page.c Wed May 31 12:08:25 2017 (r319317)
+++ head/sys/compat/linuxkpi/common/src/linux_page.c Wed May 31 13:01:27 2017 (r319318)
@@ -268,7 +268,7 @@ get_user_pages_remote(struct task_struct *task, struct
{
vm_map_t map;
- map = &mm->vmspace->vm_map;
+ map = &task->task_thread->td_proc->p_vmspace->vm_map;
return (linux_get_user_pages_internal(map, start, nr_pages,
!!(gup_flags & FOLL_WRITE), pages));
}
More information about the svn-src-head
mailing list