From db5e7a79e7a8402d3be07b6b8fd02052df5f71f6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Brucker Date: Sat, 29 May 2021 07:03:29 +0000 Subject: [PATCH] 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: Jean-Philippe Brucker Signed-off-by: Lijun Fang Reviewed-by: Weilong Chen Signed-off-by: Zheng Zengkai --- kernel/fork.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/fork.c b/kernel/fork.c index 7c044d377926..f7f467d55a65 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -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) { -- GitLab