Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Create a kernel mount representation for a new, prepared superblock* (specified by fs_fd) and attach to an open_tree-like file descriptor.

Proto:SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags, unsigned int, attr_flags)

Type:

Parameter:Nothing

3375  mnt_flags = 0
3378  If Not Is the caller allowed to modify his namespace? Then Return -EPERM
3381  If (flags & ~smount() flags.) != 0 Then Return -EINVAL
3384  If attr_flags & ~( Mount read-only | Ignore suid and sgid bits | Disallow access to device special files | Disallow program execution | Setting on how atime should be updated | Do not update directory access times ) Then Return -EINVAL
3392  If attr_flags & Mount read-only Then mnt_flags |= does the user want this to be r/o?
3394  If attr_flags & Ignore suid and sgid bits Then mnt_flags |= MNT_NOSUID
3396  If attr_flags & Disallow access to device special files Then mnt_flags |= MNT_NODEV
3398  If attr_flags & Disallow program execution Then mnt_flags |= MNT_NOEXEC
3400  If attr_flags & Do not update directory access times Then mnt_flags |= MNT_NODIRATIME
3404  Case & == - Always perform atime updates
3405  Break
3406  Case & == - Do not update access times.
3407  mnt_flags |= MNT_NOATIME
3408  Break
3409  Case & == - Update atime relative to mtime/ctime.
3410  mnt_flags |= MNT_RELATIME
3411  Break
3412  Default
3413  Return -EINVAL
3416  f = fdget(fs_fd)
3417  If Not file Then Return -EBADF
3420  ret = -EINVAL
3421  If f_op != fscontext_fops Then Go to err_fsfd
3424  fc = needed for tty driver, and maybe others
3426  ret = mutex_lock_interruptible( & uapi_mutex)
3427  If ret < 0 Then Go to err_fsfd
3431  ret = -EINVAL
3432  If Not root Then Go to err_unlock
3435  ret = -EPERM
3436  If mount_too_revealing(d_sb, & mnt_flags) Then
3437  pr_warn("VFS: Mount too revealing\n")
3438  Go to err_unlock
3441  ret = -EBUSY
3442  If phase != FS_CONTEXT_AWAITING_MOUNT Then Go to err_unlock
3445  ret = -EPERM
3446  If sb_flags & Allow mandatory locks on an FS && Not may_mandlock() Then Go to err_unlock
3449  mnt = vfs_create_mount - Create a mount for a configured superblock*@fc: The configuration context with the superblock attached* Create a mount to an already configured superblock. If necessary, the* caller should invoke vfs_get_tree() before calling this.
3450  If IS_ERR(mnt) Then
3451  ret = PTR_ERR(mnt)
3452  Go to err_unlock
3454  dentry = get a reference to a dentry
3455  mnt_flags = mnt_flags
3462  vfs_clean_context(fc)
3464  ns = alloc_mnt_ns(user_ns, true)
3465  If IS_ERR(ns) Then
3466  ret = PTR_ERR(ns)
3467  Go to err_path
3469  mnt = real_mount(mnt)
3470  containing namespace = ns
3471  root = mnt
3472  # of mounts in the namespace = 1
3473  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
3474  mntget(mnt)
3479  file = dentry_open( & newmount, O_PATH, cred)
3480  If IS_ERR(file) Then
3481  dissolve_on_fput(mnt)
3482  ret = PTR_ERR(file)
3483  Go to err_path
3485  f_mode |= File represents mount that needs unmounting
3487  ret = get_unused_fd_flags((flags & smount() flags.) ? O_CLOEXEC : 0)
3488  If ret >= 0 Then fd_install(ret, file)
3490  Else fput(file)
3493  err_path :
3494  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.
3495  err_unlock :
3496  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
3497  err_fsfd :
3498  fdput(f)
3499  Return ret