Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\process_vm_access.c Create Date:2022-07-28 15:01:21
Last Modify:2020-03-17 21:52:24 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:process_vm_rw_single_vec - read/write pages from task specified*@addr: start memory address of target process*@len: size of area to copy to/from*@iter: where to copy to/from locally*@process_pages: struct pages area that can store at least*

Proto:static int process_vm_rw_single_vec(unsigned long addr, unsigned long len, struct iov_iter *iter, struct page **process_pages, struct mm_struct *mm, struct task_struct *task, int vm_write)

Type:int

Parameter:

TypeParameterName
unsigned longaddr
unsigned longlen
struct iov_iter *iter
struct page **process_pages
struct mm_struct *mm
struct task_struct *task
intvm_write
82  pa = addr & PAGE_MASK
83  start_offset = addr - pa
85  rc = 0
86  max_pages_per_loop = Maximum number of pages kmalloc'd to hold struct page's during copy / sizeof(structpages * )
88  flags = 0
91  If len == 0 Then Return 0
93  nr_pages = ( addr + len - 1) / PAGE_SIZE - addr / PAGE_SIZE + 1
95  If vm_write Then flags |= check pte is writable
98  When Not rc && nr_pages && iov_iter_count(iter) cycle
99  pages = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(nr_pages, max_pages_per_loop)
100  locked = 1
108  lock for reading
109  pages = get_user_pages_remote() - pin user pages in memory*@tsk: the task_struct to use for page fault accounting, or* NULL if faults are not to be recorded
111  If locked Then lease a read lock
113  If pages <= 0 Then Return -EFAULT
116  bytes = pages * PAGE_SIZE - start_offset
117  If bytes > len Then bytes = len
120  rc = process_vm_rw_pages - read/write pages from task specified*@pages: array of pointers to pages we want to copy*@offset: offset in page to start copying from/to*@len: number of bytes to copy*@iter: where to copy to/from locally*@vm_write: 0 means copy from,
123  len -= bytes
124  start_offset = 0
125  nr_pages -= pages
126  pa += pages * PAGE_SIZE
127  When pages cycle
128  put_page(process_pages[--pages])
131  Return rc
Caller
NameDescribe
process_vm_rw_coreprocess_vm_rw_core - core of reading/writing pages from task specified*@pid: PID of process to read/write from/to*@iter: where to copy to/from locally*@rvec: iovec array specifying where to copy to/from in the other process*@riovcnt: size of rvec