Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:pivot_root Semantics:* Moves the root file system of the current process to the directory put_old,* makes new_root as the new root file system of the current process, and sets* root/cwd of all processes which had them on the current root to new_root

Proto:SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, const char __user *, put_old)

Type:

Parameter:Nothing

3618  If Not Is the caller allowed to modify his namespace? Then Return -EPERM
3621  error = user_path_at(Special value used to indicateopenat should use the currentworking directory. , new_root, llow links at the end | quire a directory , & new)
3623  If error Then Go to out0
3626  error = user_path_at(Special value used to indicateopenat should use the currentworking directory. , put_old, llow links at the end | quire a directory , & old)
3628  If error Then Go to out1
3631  error = security_sb_pivotroot( & old, & new)
3632  If error Then Go to out2
3635  get_fs_root(fs, & root)
3636  old_mp = lock_mount( & old)
3637  error = PTR_ERR(old_mp)
3638  If IS_ERR(old_mp) Then Go to out3
3641  error = -EINVAL
3642  new_mnt = real_mount(mnt)
3643  root_mnt = real_mount(mnt)
3644  old_mnt = real_mount(mnt)
3645  ex_parent = mnt_parent
3646  root_parent = mnt_parent
3647  If IS_MNT_SHARED(old_mnt) || IS_MNT_SHARED(ex_parent) || IS_MNT_SHARED(root_parent) Then Go to out4
3651  If Not check_mnt(root_mnt) || Not check_mnt(new_mnt) Then Go to out4
3653  If mnt_flags & MNT_LOCKED Then Go to out4
3655  error = -ENOENT
3656  If d_unlinked(dentry) Then Go to out4
3658  error = -EBUSY
3659  If new_mnt == root_mnt || old_mnt == root_mnt Then Go to out4
3661  error = -EINVAL
3662  If mnt_root != dentry Then Go to out4
3664  If Not mnt_has_parent(root_mnt) Then Go to out4
3666  If mnt_root != dentry Then Go to out4
3668  If Not mnt_has_parent(new_mnt) Then Go to out4
3671  If Not Return true if path is reachable from root* namespace_sem or mount_lock is held Then Go to out4
3674  If Not Return true if path is reachable from root* namespace_sem or mount_lock is held Then Go to out4
3676  lock_mount_hash()
3677  vfsmount lock must be held for write
3678  root_mp = vfsmount lock must be held for write
3679  If mnt_flags & MNT_LOCKED Then
3680  mnt_flags |= MNT_LOCKED
3681  mnt_flags &= ~MNT_LOCKED
3684  vfsmount lock must be held for write
3686  vfsmount lock must be held for write
3687  vfsmount lock must be held for read
3688  vfsmount lock must be held for write
3690  list_del_init - deletes entry from list and reinitialize it.*@entry: the element to delete from the list.
3691  alled with namespace_lock and vfsmount lock
3692  unlock_mount_hash()
3693  chroot_fs_refs( & root, & new)
3694  error = 0
3695  out4 :
3696  unlock_mount(old_mp)
3697  If Not error Then mntput_no_expire(ex_parent)
3699  out3 :
3700  path_put - put a reference to a path*@path: path to put the reference to* Given a path decrement the reference count to the dentry and the vfsmount.
3701  out2 :
3702  path_put - put a reference to a path*@path: path to put the reference to* Given a path decrement the reference count to the dentry and the vfsmount.
3703  out1 :
3704  path_put - put a reference to a path*@path: path to put the reference to* Given a path decrement the reference count to the dentry and the vfsmount.
3705  out0 :
3706  Return error