Commit 5ddd36b9c59887c6416e21daf984fbdd9b1818df
Committed by
Al Viro
1 parent
206cb63657
Exists in
master
and in
4 other branches
mm: implement access_remote_vm
Provide an alternative to access_process_vm that allows the caller to obtain a reference to the supplied mm_struct. Signed-off-by: Stephen Wilson <wilsons@start.ca> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 2 changed files with 18 additions and 0 deletions Side-by-side Diff
include/linux/mm.h
... | ... | @@ -971,6 +971,8 @@ |
971 | 971 | |
972 | 972 | extern int make_pages_present(unsigned long addr, unsigned long end); |
973 | 973 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); |
974 | +extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, | |
975 | + void *buf, int len, int write); | |
974 | 976 | |
975 | 977 | int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, |
976 | 978 | unsigned long start, int len, unsigned int foll_flags, |
mm/memory.c
... | ... | @@ -3711,6 +3711,22 @@ |
3711 | 3711 | return buf - old_buf; |
3712 | 3712 | } |
3713 | 3713 | |
3714 | +/** | |
3715 | + * @access_remote_vm - access another process' address space | |
3716 | + * @mm: the mm_struct of the target address space | |
3717 | + * @addr: start address to access | |
3718 | + * @buf: source or destination buffer | |
3719 | + * @len: number of bytes to transfer | |
3720 | + * @write: whether the access is a write | |
3721 | + * | |
3722 | + * The caller must hold a reference on @mm. | |
3723 | + */ | |
3724 | +int access_remote_vm(struct mm_struct *mm, unsigned long addr, | |
3725 | + void *buf, int len, int write) | |
3726 | +{ | |
3727 | + return __access_remote_vm(NULL, mm, addr, buf, len, write); | |
3728 | +} | |
3729 | + | |
3714 | 3730 | /* |
3715 | 3731 | * Access another process' address space. |
3716 | 3732 | * Source/target buffer must be kernel space, |