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:28
Last Modify:2020-03-17 21:52:24 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:process_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

Proto:static ssize_t process_vm_rw_core(pid_t pid, struct iov_iter *iter, const struct iovec *rvec, unsigned long riovcnt, unsigned long flags, int vm_write)

Type:ssize_t

Parameter:

TypeParameterName
pid_tpid
struct iov_iter *iter
const struct iovec *rvec
unsigned longriovcnt
unsigned longflags
intvm_write
158  process_pages = pp_stack
161  rc = 0
162  nr_pages = 0
165  total_len = iov_iter_count(iter)
171  When i < riovcnt cycle
172  iov_len = Must be size_t (1003.1g)
173  If iov_len > 0 Then
182  If nr_pages == 0 Then Return 0
185  If nr_pages > Maximum number of entries for process pages arraywhich lives on stack Then
188  process_pages = kmalloc(min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, Maximum number of pages kmalloc'd to hold struct page's during copy , sizeof(structpages * ) * nr_pages), GFP_KERNEL)
192  If Not process_pages Then Return -ENOMEM
197  task = find_get_task_by_vpid(pid)
198  If Not task Then
199  rc = -ESRCH
200  Go to free_proc_pages
203  mm = mm_access(task, PTRACE_MODE_ATTACH_REALCREDS)
204  If Not mm || IS_ERR(mm) Then
205  rc = If IS_ERR(mm) Then PTR_ERR(mm) Else -ESRCH
210  If rc == -EACCES Then rc = -EPERM
212  Go to put_task_struct
215  When i < riovcnt && iov_iter_count(iter) && Not rc cycle rc = 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*
221  total_len -= iov_iter_count(iter)
226  If total_len Then rc = total_len
229  Decrement the use count and release all resources for an mm.
231  put_task_struct :
232  put_task_struct(task)
234  free_proc_pages :
235  If process_pages != pp_stack Then kfree(process_pages)
237  Return rc
Caller
NameDescribe
process_vm_rwprocess_vm_rw - check iovecs before calling core routine*@pid: PID of process to read/write from/to*@lvec: iovec array specifying where to copy to/from locally*@liovcnt: size of lvec array*@rvec: iovec array specifying where to copy to/from in the other
compat_process_vm_rw