Commit db5e7a79 authored by Jean-Philippe Brucker's avatar Jean-Philippe Brucker Committed by Zheng Zengkai
Browse files

mm: export symbol mm_access

maillist inclusion
category: feature
bugzilla: 51855
CVE: NA

Reference: https://jpbrucker.net/git/linux/commit/?h=sva/2021-03-01&id=17c99c238dbfb453256f2a85a9f0c48dbc976814



---------------------------------------------

Some devices can access process address spaces directly. When creating
such bond, to check that a process controlling the device is allowed to
access the target address space, the device driver uses mm_access(). Since
the drivers (in this case VFIO) can be built as a module, export the
mm_access symbol.

Signed-off-by: default avatarJean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: default avatarLijun Fang <fanglijun3@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 7ca84842
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1225,6 +1225,19 @@ struct mm_struct *get_task_mm(struct task_struct *task)
}
EXPORT_SYMBOL_GPL(get_task_mm);

/**
 * mm_access - check access permission to a task and acquire a reference to
 * its mm.
 * @task: target task
 * @mode: selects type of access and caller credentials
 *
 * Return the task's mm on success, or %NULL if it cannot be accessed.
 *
 * Check if the caller is allowed to read or write the target task's pages.
 * @mode describes the access mode and credentials using ptrace access flags.
 * See ptrace_may_access() for more details. On success, a reference to the mm
 * is taken.
 */
struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
{
	struct mm_struct *mm;
@@ -1244,6 +1257,7 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)

	return mm;
}
EXPORT_SYMBOL_GPL(mm_access);

static void complete_vfork_done(struct task_struct *tsk)
{