函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\crypto\keyring.c Create Date:2022-07-29 10:57:24
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Try to remove an fscrypt master encryption key

函数原型:static int do_remove_key(struct file *filp, void __user *_uarg, bool all_users)

返回类型:int

参数:

类型参数名称
struct file *filp
void __user *_uarg
boolall_users
761  sb等于i_sb
762  __useruarg等于_uarg
766  status_flags等于0
770  如果copy_from_user( & arg, uarg, arg的长度)则返回:负EFAULT
773  如果非valid_key_spec( & key_spec)则返回:负EINVAL
776  如果memchr_inv - Find an unmatching character in an area of memory.*@start: The memory area*@c: Find a character other than c*@bytes: The size of the area.* returns the address of the first character other than @c, or %NULL则返回:负EINVAL
783  如果 of FSCRYPT_KEY_SPEC_TYPE_* 恒等于v1 policy keys are specified by an arbitrary 8-byte key "descriptor",* matching fscrypt_policy_v1::master_key_descriptor.且非操作权限检查则返回:负EACCES
788  key等于Find the specified master key in ->s_master_keys.* Returns ERR_PTR(-ENOKEY) if not found.
789  如果是错误则返回:错误
791  mk等于data[0]
793  lock for writing
796  如果Keyring which contains a key of type 'key_type_fscrypt_user' for each* user who has added this keynr_leaves_on_tree不等于0则
797  如果all_userserr等于keyring_clear(Keyring which contains a key of type 'key_type_fscrypt_user' for each* user who has added this key)
799  否则err等于Remove the current user's "key" from ->mk_users.* The master key's key->sem must be held for write.* Returns 0 if removed, -ENOKEY if not found, or another -errno code.
801  如果err
803  转到:out_put_key
805  如果nr_leaves_on_tree不等于0则
813  err等于0
815  转到:out_put_key
820  dead = false
821  如果is_master_key_secret_present( & The secret key material. After FS_IOC_REMOVE_ENCRYPTION_KEY is* executed, this is wiped and no new inodes can be unlocked with this* key; however, there may still be inodes in ->mk_decrypted_inodes* which could not be evicted)则
822  lock for writing
823  wipe_master_key_secret( & The secret key material. After FS_IOC_REMOVE_ENCRYPTION_KEY is* executed, this is wiped and no new inodes can be unlocked with this* key; however, there may still be inodes in ->mk_decrypted_inodes* which could not be evicted)
824  dead等于_dec_and_test - decrement a refcount and test if it is 0*@r: the refcount* Similar to atomic_dec_and_test(), it will WARN on underflow and fail to* decrement when saturated at REFCOUNT_SATURATED
825  lease a write lock
827  lease a write lock
828  如果dead
833  key_invalidate(key)
834  err等于0
835  否则
837  err等于try_to_lock_encrypted_files(sb, mk)
838  如果err恒等于负EBUSY
841  err等于0
850  out_put_key :
851  key_put(key)
852  如果err恒等于0则err等于put_user - Write a simple value into user space(status_flags, & utput )
854  返回:err
调用者
名称描述
fscrypt_ioctl_remove_key
fscrypt_ioctl_remove_key_all_users