Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:userfaultfd_unregister

Proto:static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, unsigned long arg)

Type:int

Parameter:

TypeParameterName
struct userfaultfd_ctx *ctx
unsigned longarg
1518  mm = mm with one ore more vmas attached to this userfaultfd_ctx
1525  __user * buf = arg
1527  ret = -EFAULT
1528  If copy_from_user( & uffdio_unregister, buf, size of uffdio_unregister ) Then Go to out
1531  ret = validate_range(mm, & start, len)
1533  If ret Then Go to out
1536  start = start
1537  end = start + len
1539  ret = -ENOMEM
1540  If Not mmget_not_zero(mm) Then Go to out
1543  lock for writing
1544  If Not This has to be called after a get_task_mm()/mmget_not_zero()* followed by taking the mmap_sem for writing before modifying the* vmas or anything the coredump pretends not to change from under it Then Go to out_unlock
1546  vma = Same as find_vma, but also return a pointer to the previous VMA in *pprev.
1547  If Not vma Then Go to out_unlock
1551  ret = -EINVAL
1552  If Our start address within vm_mm. >= end Then Go to out_unlock
1559  If is_vm_hugetlb_page(vma) Then
1560  vma_hpagesize = Return the size of the pages allocated when backing a VMA. In the majority* cases this will be same size as used by the page table entries.
1562  If start & vma_hpagesize - 1 Then Go to out_unlock
1569  found = false
1570  ret = -EINVAL
1571  When cur && Our start address within vm_mm. < end cycle
1572  cond_resched()
1574  BUG_ON(!!ctx ^ !!(Flags, see mm.h. & (missing pages tracking | wrprotect pages tracking )))
1584  If Not vma_can_userfault(cur) Then Go to out_unlock
1587  found = true
1589  BUG_ON(!found)
1591  If Our start address within vm_mm. < start Then prev = vma
1594  ret = 0
1595  Do
1596  cond_resched()
1598  BUG_ON(!vma_can_userfault(vma))
1604  If Not ctx Then Go to skip
1607  WARN_ON(!(Flags, see mm.h. & VM_MAYWRITE))
1609  If Our start address within vm_mm. > start Then start = Our start address within vm_mm.
1611  vma_end = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(end, The first byte after our end addresswithin vm_mm. )
1613  If userfaultfd_missing(vma) Then
1621  start = start
1622  len = vma_end - start
1623  wake_userfault(ctx, & range)
1626  new_flags = Flags, see mm.h. & ~(missing pages tracking | wrprotect pages tracking )
1627  prev = Given a mapping request (addr,end,vm_flags,file,pgoff), figure out* whether that can be merged with its predecessor or its successor
1631  If prev Then
1632  vma = prev
1633  Go to next
1637  If ret Then Break
1642  If ret Then Break
1645  :
1651  Flags, see mm.h. = new_flags
1652  vm_userfaultfd_ctx = NULL_VM_UFFD_CTX
1654  :
1655  prev = vma
1656  start = The first byte after our end addresswithin vm_mm.
1657  vma = linked list of VM areas per task, sorted by address
1658  When vma && Our start address within vm_mm. < end cycle
1659  out_unlock :
1660  lease a write lock
1661  Decrement the use count and release all resources for an mm.
1662  out :
1663  Return ret
Caller
NameDescribe
userfaultfd_ioctl