函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\fork.c Create Date:2022-07-27 09:58:31
Last Modify:2020-03-17 11:04:53 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:share allows a process to 'unshare' part of the process* context which was originally shared using clone. copy_** functions used by do_fork() cannot be used here directly* because they modify an inactive task_struct that is being* constructed

函数原型:int ksys_unshare(unsigned long unshare_flags)

返回类型:int

参数:

类型参数名称
unsigned longunshare_flags
2897  struct fs_struct * fs, * new_fs = NULL
2898  struct files_struct * fd, * new_fd = NULL
2899  struct cred * new_cred = NULL
2900  struct nsproxy * new_nsproxy = NULL
2901  do_sysvsem等于0
2908  如果unshare_flags按位与新用户空间unshare_flags或等于属于同一个线程组按位或共享文件系统
2913  如果unshare_flags按位与共享虚拟内存unshare_flags或等于共享信号处理
2918  如果unshare_flags按位与共享信号处理unshare_flags或等于属于同一个线程组
2923  如果unshare_flags按位与在新的namespace启动子进程unshare_flags或等于共享文件系统
2926  err等于Check constraints on flags passed to the unshare system call.
2927  如果err则转到:bad_unshare_out
2934  如果unshare_flags按位与新消息空间按位或share system V SEM_UNDO semantics 的值则do_sysvsem等于1
2936  err等于Unshare the filesystem structure if it is being shared
2937  如果err则转到:bad_unshare_out
2939  err等于Unshare file descriptor table if it is being shared
2940  如果err则转到:bad_unshare_cleanup_fs
2942  err等于unshare_userns(unshare_flags, & new_cred)
2943  如果err则转到:bad_unshare_cleanup_fd
2945  err等于unshare_nsproxy_namespaces(unshare_flags, & new_nsproxy, new_cred, new_fs)
2947  如果err则转到:bad_unshare_cleanup_cred
2950  如果new_fsnew_fddo_sysvsemnew_crednew_nsproxy
2951  如果do_sysvsem
2957  如果unshare_flags按位与新消息空间
2963  如果new_nsproxyswitch_task_namespaces(当前进程, new_nsproxy)
2966  Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring* subscriptions and synchronises with wait4(). Also used in procfs. Also* pins the final release of task.io_context. Also protects ->cpuset and* ->cgroup.subsys[]. And ->vfork_done.
2968  如果new_fs
2969  fs等于fs
2970  加自旋锁
2971  fs等于new_fs
2972  如果users先自减则new_fs = NULL
2974  否则new_fs等于fs
2979  如果new_fd
2980  fd等于files
2981  files等于new_fd
2982  new_fd等于fd
2985  task_unlock(当前进程)
2987  如果new_cred
2990  new_cred = NULL
2994  perf_event_namespaces(当前进程)
2996  bad_unshare_cleanup_cred :
2997  如果new_credput_cred - Release a reference to a set of credentials*@cred: The credentials to release* Release a reference to a set of credentials, deleting them when the last ref* is released
2999  bad_unshare_cleanup_fd :
3000  如果new_fdput_files_struct(new_fd)
3003  bad_unshare_cleanup_fs :
3004  如果new_fsfree_fs_struct(new_fs)
3007  bad_unshare_out :
3008  返回:err
调用者
名称描述
SYSCALL_DEFINE1
init_linuxrc