Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\tomoyo\memory.c Create Date:2022-07-28 19:44:04
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:const struct tomoyo_path_info *tomoyo_get_name(const char *name)

Type:struct tomoyo_path_info

Parameter:

TypeParameterName
const char *name
159  If Not name Then Return 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  If mutex_lock_interruptible( & tomoyo_policy_lock) Then Return NULL
167  If hash != = full_name_hash(name, strlen(name)) || strcmp(name, name) || atomic_read( & users) == Garbage collector is trying to kfree() this element. Then Continue
170  atomic_inc( & users)
171  Go to out
173  ptr = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
174  If 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. Then
175  name = ptr + size of ptr
176  memmove((char * )name, name, len)
177  atomic_set( & users, 1)
178  tomoyo_fill_path_info( & entry)
179  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
180  Else
181  kfree(ptr)
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  Return ptr ? & entry : NULL
Caller
NameDescribe
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.