From 0e75bf544461bf7ec23022180f99809821f3b93d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Brucker Date: Sat, 18 May 2019 22:09:26 +0800 Subject: [PATCH] mm: export symbol mm_access hulk inclusion category: feature bugzilla: 14369 CVE: NA ------------------- 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. Cc: felix.kuehling@amd.com Cc: akpm@linux-foundation.org Signed-off-by: Jean-Philippe Brucker Signed-off-by: Fang Lijun Reviewed-by: Hanjun Guo Reviewed-by: Zhen Lei Signed-off-by: Yang Yingliang --- kernel/fork.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/fork.c b/kernel/fork.c index 487f392c5cef..e044517f2a30 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1196,6 +1196,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 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; @@ -1215,6 +1228,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) { -- GitLab