函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Search a tree of keyrings that point to other keyrings up to the maximum* depth.

函数原型:static bool search_nested_keyrings(struct key *keyring, struct keyring_search_context *ctx)

返回类型:bool

参数:

类型参数名称
struct key *keyring
struct keyring_search_context *ctx
670  struct{struct key * keyring;struct assoc_array_node * node;int slot;}stack[6]
680  sp等于0
682  kenter("{%d},{%s,%s}", key serial number , name, description)
688  BUG_ON((flags & Search a tree of keyrings that point to other keyrings up to the maximum* depth.) == 0 || (flags & Search a tree of keyrings that point to other keyrings up to the maximum* depth.) == Search a tree of keyrings that point to other keyrings up to the maximum* depth.)
691  如果descriptionFinalise an index key to include a part of the description actually in the* index key, to set the domain tag and to calculate the hash.
697  如果Type of lookup for this search. 恒等于Iterative search. keyring_compare_object(keyring, & index_key)则
699  Internal stuff 等于2
702  转到:found
704  返回:false
705  默认
706  退出
710  Internal stuff 等于0
713  descend_to_keyring :
714  kdebug("descend to %d", key serial number )
715  如果 status flags (change with bitops) 按位与1左移set if key has been invalidated 位按位或1左移set if key had been revoked 位的值则转到:not_this_keyring
722  如果Search inside a keyring for a key. We can search by walking to it* directly based on its index-key or we can iterate over the entire* tree looking for it, based on the match function.则转到:found
733  如果非flags按位与Search child keyrings also 的值则转到:not_this_keyring
736  ptr等于READ_ONCE(The node at the root of the tree )
737  如果非ptr则转到:not_this_keyring
740  如果assoc_array_ptr_is_shortcut(ptr)则
745  shortcut等于assoc_array_ptr_to_shortcut(ptr)
746  如果index_key[0]按位与ASSOC_ARRAY_FAN_MASK的值不等于0则转到:not_this_keyring
749  ptr等于READ_ONCE(next_node)
750  node等于assoc_array_ptr_to_node(ptr)
751  转到:begin_node
754  node等于assoc_array_ptr_to_node(ptr)
755  ptr等于slots[0]
756  如果非assoc_array_ptr_is_meta(ptr)则转到:begin_node
759  descend_to_node :
763  kdebug("descend")
764  如果assoc_array_ptr_is_shortcut(ptr)则
765  shortcut等于assoc_array_ptr_to_shortcut(ptr)
766  ptr等于READ_ONCE(next_node)
767  BUG_ON(!assoc_array_ptr_is_node(ptr))
769  node等于assoc_array_ptr_to_node(ptr)
771  begin_node :
772  kdebug("begin_node")
773  slot等于0
774  ascend_to_node :
776 slot小于Number of slots per node 循环
777  ptr等于READ_ONCE(slots[slot])
779  如果assoc_array_ptr_is_meta(ptr)且back_pointer则转到:descend_to_node
782  如果非keyring_ptr_is_keyring(ptr)则继续下一循环
785  key等于keyring_ptr_to_key(ptr)
788  如果flags按位与Give an error on excessive depth
789  result等于错误号
790  返回:false
792  转到:not_this_keyring
796  如果非flags按位与Don't check permissions 的值且key_task_permission(make_key_ref(key, possessed), cred, Require permission to search (keyring) or find (key) )小于0则继续下一循环
802  keyring等于keyring
803  node等于node
804  slot等于slot
805  sp自加
808  keyring等于key
809  转到:descend_to_keyring
815  ptr等于READ_ONCE(back_pointer)
816  slot等于parent_slot
818  如果ptrassoc_array_ptr_is_shortcut(ptr)则
819  shortcut等于assoc_array_ptr_to_shortcut(ptr)
820  ptr等于READ_ONCE(back_pointer)
821  slot等于parent_slot
823  如果非ptr则转到:not_this_keyring
825  node等于assoc_array_ptr_to_node(ptr)
826  slot自加
832  如果back_pointer
833  kdebug("ascend %d", slot)
834  转到:ascend_to_node
840  not_this_keyring :
841  kdebug("not_this_keyring %d", sp)
842  如果sp小于等于0则
843  kleave(" = false")
844  返回:false
848  sp自减
849  keyring等于keyring
850  node等于node
851  slot等于slot加1
852  kdebug("ascend to %d [%d]", key serial number , slot)
853  转到:ascend_to_node
856  found :
857  key等于key_ref_to_ptr(result)
858  key_check(key)
859  如果非flags按位与Don't update times 的值则
860  last time used for LRU keyring discard 等于now
861  last time used for LRU keyring discard 等于now
862 sp大于0循环
863  last time used for LRU keyring discard 等于now
865  kleave(" = true")
866  返回:true
调用者
名称描述
keyring_search_rcukeyring_search_rcu - Search a keyring tree for a matching key under RCU*@keyring_ref: A pointer to the keyring with possession indicator
keyring_detect_cycleSee if a cycle will will be created by inserting acyclic tree B in acyclic* tree A at the topmost level (ie: as a direct child of A).* Since we are adding B to A at the top level, checking for cycles should just