Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\memory.c Create Date:2022-07-28 14:43:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Access another process' address space as given in mm. If non-NULL, use the* given task for page fault accounting.

Proto:int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm, unsigned long addr, void *buf, int len, unsigned int gup_flags)

Type:int

Parameter:

TypeParameterName
struct task_struct *tsk
struct mm_struct *mm
unsigned longaddr
void *buf
intlen
unsigned intgup_flags
4466  old_buf = buf
4467  write = gup_flags & check pte is writable
4469  If down_read_killable( & mmap_sem) Then Return 0
4473  When len cycle
4476  struct page * page = NULL
4478  ret = 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
4480  If ret <= 0 Then
4482  Break
4498  Else
4499  bytes = len
4500  offset = addr & PAGE_SIZE - 1
4501  If bytes > PAGE_SIZE - offset Then bytes = PAGE_SIZE - offset
4504  maddr = kmap(page)
4505  If write Then
4509  Else
4513  kunmap(page)
4514  put_page(page)
4516  len -= bytes
4517  buf += bytes
4518  addr += bytes
4520  lease a read lock
4522  Return buf - old_buf
Caller
NameDescribe
access_remote_vmaccess_remote_vm - access another process' address space*@mm: the mm_struct of the target address space*@addr: start address to access*@buf: source or destination buffer*@len: number of bytes to transfer*@gup_flags: flags modifying lookup behaviour
access_process_vmAccess another process' address space.* Source/target buffer must be kernel space,* Do not walk the page table directly, use get_user_pages