函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:User requested a write of security.capability. If needed, update the* xattr to change from v2 to v3, or to fixup the v3 rootid.* If all is ok, we return the new size, on error return < 0.

函数原型:int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)

返回类型:int

参数:

类型参数名称
struct dentry *dentry
void **ivalue
size_tsize
480  cap等于ivalue
482  inode等于d_backing_inode - Get upper or lower inode we should be using*@upper: The upper layer* This is the helper that should be used to get at the inode that will be used* if this dentry were to be opened as a file. The inode may be on the upper
483  task_ns等于current_user_ns(), fs_ns等于s_user_ns
488  如果非ivalue则返回:负EINVAL
490  如果非validheader(size, cap)则返回:负EINVAL
492  如果非apable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped*@inode: The inode in question*@cap: The capability in question* Return true if the current task has the given capability targeted at* its own user namespace and that the given inode's 则返回:负EPERM
494  如果size恒等于XATTR_CAPS_SZ_2则如果ns_capable(s_user_ns, CAP_SETFCAP)则
497  返回:size
499  rootid等于rootid_from_xattr( * ivalue, size, task_ns)
500  如果非uid_valid(rootid)则返回:负EINVAL
503  nsrootid等于m_kuid - Create a uid from a kuid user-namespace pair.*@targ: The user namespace we want a uid in.*@kuid: The kernel internal uid to start with.* Map @kuid into the user-namespace specified by @targ and* return the resulting uid.
504  如果nsrootid恒等于负1则返回:负EINVAL
507  newsize等于sizeof(structvfs_ns_cap_data)
508  nscap等于开辟内存
509  如果非nscap则返回:负ENOMEM
511  rootid等于cpu_to_le32(nsrootid)
512  nsmagic等于VFS_CAP_REVISION_3
513  magic等于le32_to_cpu( Little endian )
514  如果magic按位与VFS_CAP_FLAGS_EFFECTIVEnsmagic或等于VFS_CAP_FLAGS_EFFECTIVE
516  magic_etc等于cpu_to_le32(nsmagic)
517  memcpy( & data, & data, sizeof(__le32) * 2 * VFS_CAP_U32)
519  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
520  ivalue等于nscap
521  返回:newsize