函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Change the ownership of a key* The key must grant the caller Setattr permission for this to work, though* the key need not be fully instantiated yet. For the UID to be changed, or* for the GID to be changed to a group the caller is not a member of, the

函数原型:long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group)

返回类型:long

参数:

类型参数名称
key_serial_tid
uid_tuser
gid_tgroup
882  struct key_user * newowner, * zapowner = NULL
889  uid等于make_kuid(current_user_ns(), user)
890  gid等于make_kgid(current_user_ns(), group)
891  ret等于负EINVAL
892  如果((user != (uid_t) - 1) && !uid_valid(uid))则转到:error
894  如果((group != (gid_t) - 1) && !gid_valid(gid))则转到:error
897  ret等于0
898  如果(user == (uid_t) - 1 && group == (gid_t) - 1)则转到:error
901  key_ref等于Look up a key ID given us by userspace with a given permissions mask to get* the key it refers to.* Flags can be passed to request that special keyrings be created if referred* to directly, to permit partially constructed keys to be found and to skip
903  如果是错误
904  ret等于错误
905  转到:error
908  key等于key_ref_to_ptr(key_ref)
911  ret等于负EACCES
912  lock for writing
914  如果非操作权限检查
916  如果(user != (uid_t) - 1 && !uid_eq(uid, uid))则转到:error_put
921  如果(group != (gid_t) - 1 && !gid_eq(gid, gid) && !in_group_p(gid))则转到:error_put
926  如果(user != (uid_t) - 1 && !uid_eq(uid, uid))则
927  ret等于负ENOMEM
928  newowner等于Get the key quota record for a user, allocating a new record if one doesn't* already exist.
929  如果非newowner则转到:error_put
939  加自旋锁
950  加自旋锁
951  qnkeys自减
956  atomic_dec( & nkeys)
957  atomic_inc( & umber of keys )
960  atomic_dec( & nikeys)
964  zapowner等于 owner of this key
965  owner of this key 等于newowner
966  uid等于uid
970  如果(group != (gid_t) - 1)则gid等于gid
973  ret等于0
975  error_put :
976  lease a write lock
977  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
978  如果zapownerDispose of a user structure
980  error :
981  返回:ret
983  quota_overrun :
984  自旋锁解锁
985  zapowner等于newowner
986  ret等于负EDQUOT
987  转到:error_put
调用者
名称描述
SYSCALL_DEFINE5The key control system call
COMPAT_SYSCALL_DEFINE5The key control system call, 32-bit compatibility version for 64-bit archs