函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:moyo_get_name - Allocate permanent memory for string data.*@name: The string to store into the permernent memory.* Returns pointer to "struct tomoyo_path_info" on success, NULL otherwise.

函数原型:const struct tomoyo_path_info *tomoyo_get_name(const char *name)

返回类型:struct tomoyo_path_info

参数:

类型参数名称
const char *name
159  如果非name则返回:NULL
161  len等于strlen - Find the length of a string*@s: The string to be sized加1
162  hash等于Version 2: One word (32 or 64 bits) at a time.* If CONFIG_DCACHE_WORD_ACCESS is defined (meaning * exists, which describes major Linux platforms like x86 and ARM), then* this computes a different hash function much faster.
163  head等于moyo_name_list is used for holding string data used by TOMOYO.* Since same string data is likely used for multiple times (e.g.* "/lib/libc-2.5.so"), TOMOYO shares string data in the form of* "const struct tomoyo_path_info *".[hash_long(hash, TOMOYO uses this hash only when appending a string into the string* table. Frequency of appending strings is very low. So we don't need* large (e.g. 64k) hash size. 256 will be sufficient.)]
164  如果mutex_lock_interruptible( & tomoyo_policy_lock)则返回:NULL
167  如果hash不等于 = full_name_hash(name, strlen(name)) 字符串比较atomic_read( & users)恒等于Garbage collector is trying to kfree() this element. 则继续下一循环
170  atomic_inc( & users)
171  转到:out
173  ptr等于分配内存并置零
174  如果moyo_memory_ok - Check memory quota.*@ptr: Pointer to allocated memory.* Returns true on success, false otherwise.* Returns true if @ptr is not NULL and quota not exceeded, false otherwise.* Caller holds tomoyo_policy_lock mutex.
175  name等于ptrptr的长度
176  memmove((char * )name, name, len)
177  atomic_set( & users, 1)
178  tomoyo_fill_path_info( & entry)
179  添加链表项
180  否则
181  释放内存
182  ptr = NULL
184  out :
185  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.
186  返回:ptr ? & entry : NULL
调用者
名称描述
tomoyo_update_manager_entrymoyo_update_manager_entry - Add a manager entry.*@manager: The path to manager or the domainnamme.*@is_delete: True if it is a delete request.* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
tomoyo_get_dqwordmoyo_get_dqword - tomoyo_get_name() for a quoted string.*@start: String to save.* Returns pointer to "struct tomoyo_path_info" on success, NULL otherwise.
tomoyo_parse_envpmoyo_parse_envp - Parse an envp[] condition part.*@left: Lefthand value.*@right: Righthand value.*@envp: Pointer to "struct tomoyo_envp".* Returns true on success, false otherwise.
tomoyo_get_transit_preferencemoyo_get_transit_preference - Parse domain transition preference for execve().*@param: Pointer to "struct tomoyo_acl_param".*@e: Pointer to "struct tomoyo_condition".* Returns the condition string part.
tomoyo_write_transition_controlmoyo_write_transition_control - Write "struct tomoyo_transition_control" list.*@param: Pointer to "struct tomoyo_acl_param".*@type: Type of this entry.* Returns 0 on success, negative value otherwise.
tomoyo_write_aggregatormoyo_write_aggregator - Write "struct tomoyo_aggregator" list.*@param: Pointer to "struct tomoyo_acl_param".* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
tomoyo_assign_domainmoyo_assign_domain - Create a domain or a namespace.*@domainname: The name of domain.*@transit: True if transit to domain found or created.* Returns pointer to "struct tomoyo_domain_info" on success, NULL otherwise.* Caller holds tomoyo_read_lock().
tomoyo_write_envmoyo_write_env - Write "struct tomoyo_env_acl" list.*@param: Pointer to "struct tomoyo_acl_param".* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
tomoyo_write_groupmoyo_write_group - Write "struct tomoyo_path_group"/"struct tomoyo_number_group"/"struct tomoyo_address_group" list.*@param: Pointer to "struct tomoyo_acl_param".*@type: Type of this group.* Returns 0 on success, negative value otherwise.
tomoyo_get_groupmoyo_get_group - Allocate memory for "struct tomoyo_path_group"/"struct tomoyo_number_group".*@param: Pointer to "struct tomoyo_acl_param".*@idx: Index number.* Returns pointer to "struct tomoyo_group" on success, NULL otherwise.
tomoyo_mm_initmoyo_mm_init - Initialize mm related code.
tomoyo_get_domainnamemoyo_get_domainname - Read a domainname from a line.*@param: Pointer to "struct tomoyo_acl_param".* Returns a domainname on success, NULL otherwise.
tomoyo_parse_name_unionmoyo_parse_name_union - Parse a tomoyo_name_union.*@param: Pointer to "struct tomoyo_acl_param".*@ptr: Pointer to "struct tomoyo_name_union".* Returns true on success, false otherwise.