函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:handle_policy_update

函数原型:static ssize_t handle_policy_update(struct file *file, const char __user *ubuf, size_t len)

返回类型:ssize_t

参数:

类型参数名称
struct file *file
const char __user *ubuf
size_tlen
117  pol等于开辟内存
118  如果非pol则返回:负ENOMEM
120  policy_str = NULL
121  hash_init - initialize a hash table*@hashtable: hashtable to be initialized* Calculates the size of the hashtable from the given parameter, otherwise* same as hash_init_size.* This has to be a macro since HASH_BITS() will not work on pointers since(rules)
123  p等于buf等于memdup_user_nul - duplicate memory region from user space and NUL-terminate*@src: source address in user space*@len: number of bytes to copy* Return: an ERR_PTR() on failure.
124  如果是错误
125  err等于错误
126  转到:out_free_pol
128  policy_str等于kstrdup - allocate space for and copy an existing string*@s: the string to duplicate*@gfp: the GFP mask used in the kmalloc() call when allocating memory* Return: newly allocated copy of @s or %NULL in case of error
129  如果(policy_str == NULL)则
130  err等于负ENOMEM
131  转到:out_free_buf
135 p不等于'\0'循环
138  end等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
139  如果(end == NULL)则
140  err等于负EINVAL
141  转到:out_free_buf
143  end等于'\0'
145  rule等于开辟内存
146  如果非rule
147  err等于负ENOMEM
148  转到:out_free_buf
151  err等于In the case the input buffer contains one or more invalid UIDs, the kuid_t* variables pointed to by @parent and @child will get updated but this* function will return an error.* Contents of @buf may be modified.
152  如果err则转到:out_free_rule
157  打印警告信息("bad policy: duplicate entry\n")
158  err等于负EEXIST
159  转到:out_free_rule
162  insert_rule(pol, rule)
163  p等于end加1
164  继续下一循环
166  out_free_rule :
167  释放内存
168  转到:out_free_buf
171  err等于verify_ruleset(pol)
173  如果errerr不等于负EINVAL则转到:out_free_buf
181  mutex_lock( & policy_update_lock)
182  pol等于cu_replace_pointer() - replace an RCU pointer, returning its old value*@rcu_ptr: RCU pointer, whose old value is returned*@ptr: regular pointer*@c: the lockdep conditions under which the dereference will take place* Perform a replacement, where @rcu_ptr (safesetid_setuid_rules, pol, lockdep_is_held( & policy_update_lock))
184  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.
185  err等于len
187  out_free_buf :
188  释放内存
189  out_free_pol :
190  如果polrelease_ruleset(pol)
192  返回:err
调用者
名称描述
safesetid_file_write