NOMMU: implement access_remote_vm

Recent vm changes brought in a new function which the core procfs code
utilizes. So implement it for nommu systems too to avoid link failures.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Simon Horman <horms@verge.net.au>
Tested-by: Ithamar Adema <ithamar.adema@team-embedded.nl>
Acked-by: Greg Ungerer <gerg@uclinux.org>

authored by Mike Frysinger and committed by David Howells f55f199b b554cb42

+39 -13
+39 -13
mm/nommu.c
··· 1971 1971 } 1972 1972 EXPORT_SYMBOL(filemap_fault); 1973 1973 1974 - /* 1975 - * Access another process' address space. 1976 - * - source/target buffer must be kernel space 1977 - */ 1978 - int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write) 1974 + static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm, 1975 + unsigned long addr, void *buf, int len, int write) 1979 1976 { 1980 1977 struct vm_area_struct *vma; 1981 - struct mm_struct *mm; 1982 - 1983 - if (addr + len < addr) 1984 - return 0; 1985 - 1986 - mm = get_task_mm(tsk); 1987 - if (!mm) 1988 - return 0; 1989 1978 1990 1979 down_read(&mm->mmap_sem); 1991 1980 ··· 1999 2010 } 2000 2011 2001 2012 up_read(&mm->mmap_sem); 2013 + 2014 + return len; 2015 + } 2016 + 2017 + /** 2018 + * @access_remote_vm - access another process' address space 2019 + * @mm: the mm_struct of the target address space 2020 + * @addr: start address to access 2021 + * @buf: source or destination buffer 2022 + * @len: number of bytes to transfer 2023 + * @write: whether the access is a write 2024 + * 2025 + * The caller must hold a reference on @mm. 2026 + */ 2027 + int access_remote_vm(struct mm_struct *mm, unsigned long addr, 2028 + void *buf, int len, int write) 2029 + { 2030 + return __access_remote_vm(NULL, mm, addr, buf, len, write); 2031 + } 2032 + 2033 + /* 2034 + * Access another process' address space. 2035 + * - source/target buffer must be kernel space 2036 + */ 2037 + int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write) 2038 + { 2039 + struct mm_struct *mm; 2040 + 2041 + if (addr + len < addr) 2042 + return 0; 2043 + 2044 + mm = get_task_mm(tsk); 2045 + if (!mm) 2046 + return 0; 2047 + 2048 + len = __access_remote_vm(tsk, mm, addr, buf, len, write); 2049 + 2002 2050 mmput(mm); 2003 2051 return len; 2004 2052 }