函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\tomoyo\mount.c Create Date:2022-07-27 21:13:12
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:moyo_mount_acl - Check permission for mount() operation.*@r: Pointer to "struct tomoyo_request_info".*@dev_name: Name of device file. Maybe NULL.*@dir: Pointer to "struct path".*@type: Name of filesystem type.*@flags: Mount options.

函数原型:static int tomoyo_mount_acl(struct tomoyo_request_info *r, const char *dev_name, const struct path *dir, const char *type, unsigned long flags)

返回类型:int

参数:

类型参数名称
struct tomoyo_request_info *r
const char *dev_name
const struct path *dir
const char *type
unsigned longflags
82  struct tomoyo_obj_info obj = {}
84  struct file_system_type * fstype = NULL
85  const char * requested_type = NULL
86  const char * requested_dir_name = NULL
87  const char * requested_dev_name = NULL
91  need_dev等于0
92  error等于负ENOMEM
94  For holding parameters specific to operations which deal files.* NULL if not dealing files.等于obj
97  requested_type等于tomoyo_encode(type)
98  如果非requested_type则转到:out
100  name等于requested_type
101  tomoyo_fill_path_info( & rtype)
104  Second pathname. Initialized with { NULL, NULL } if no path. 等于dir
105  requested_dir_name等于moyo_realpath_from_path - Returns realpath(3) of the given pathname but ignores chroot'ed root
106  如果非requested_dir_name
107  error等于负ENOMEM
108  转到:out
110  name等于requested_dir_name
111  tomoyo_fill_path_info( & rdir)
114  如果type恒等于String table for special mount operations. [mount -o remount /dir ]则否则如果type恒等于String table for special mount operations. [mount --make-unbindable /dir ]或type恒等于String table for special mount operations. [mount --make-private /dir ]或type恒等于String table for special mount operations. [mount --make-slave /dir ]或type恒等于String table for special mount operations. [mount --make-shared /dir ]则
121  否则如果type恒等于String table for special mount operations. [mount --bind /source /dest ]或type恒等于String table for special mount operations. [mount --move /old /new ]则
123  need_dev等于负1
124  否则
125  fstype等于get_fs_type(type)
126  如果非fstype
127  error等于负ENODEV
128  转到:out
130  如果fs_flags按位与FS_REQUIRES_DEVneed_dev等于1
134  如果need_dev
137  error等于负ENOENT
138  转到:out
140  First pathname. Initialized with { NULL, NULL } if no path. 等于path
141  requested_dev_name等于moyo_realpath_from_path - Returns realpath(3) of the given pathname but ignores chroot'ed root
142  如果非requested_dev_name
143  error等于负ENOENT
144  转到:out
146  否则
148  如果非dev_namedev_name等于"<NULL>"
150  requested_dev_name等于tomoyo_encode(dev_name)
151  如果非requested_dev_name
152  error等于负ENOMEM
153  转到:out
156  name等于requested_dev_name
157  tomoyo_fill_path_info( & rdev)
158  param_type等于TOMOYO_TYPE_MOUNT_ACL
159  need_dev等于need_dev
160  dev等于rdev
161  dir等于rdir
162  type等于rtype
163  flags等于flags
164  循环
165  moyo_check_acl - Do permission check.*@r: Pointer to "struct tomoyo_request_info".*@check_entry: Callback function to check type specific parameters.* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
166  error等于moyo_audit_mount_log - Audit mount log.*@r: Pointer to "struct tomoyo_request_info".* Returns 0 on success, negative value otherwise.
167 error恒等于Retry this request. Returned by tomoyo_supervisor() if policy violation has* occurred in enforcing mode and the userspace daemon decided to retry.* We must choose a positive value in order to distinguish "granted" (which is循环
168  out :
169  释放内存
170  释放内存
171  如果fstypeput_filesystem(fstype)
173  释放内存
175  如果dentrypath_put( & First pathname. Initialized with { NULL, NULL } if no path. )
177  返回:error
调用者
名称描述
tomoyo_mount_permissionmoyo_mount_permission - Check permission for mount() operation.*@dev_name: Name of device file. Maybe NULL.*@path: Pointer to "struct path".*@type: Name of filesystem type. Maybe NULL.*@flags: Mount options.*@data_page: Optional data. Maybe NULL.