函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:getsecurity: We are called for security

函数原型:int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc)

返回类型:int

参数:

类型参数名称
struct inode *inode
const char *name
void **buffer
boolalloc
375  char * tmpbuf = NULL
381  如果字符串比较不等于0则返回:负EOPNOTSUPP
384  dentry等于d_find_any_alias(inode)
385  如果非dentry则返回:负EINVAL
388  size等于sizeof(structvfs_ns_cap_data)
389  ret等于vfs_getxattr_alloc(dentry, XATTR_NAME_CAPS, & tmpbuf, size, GFP_NOFS)
391  dput(dentry)
393  如果ret小于0则返回:ret
396  fs_ns等于s_user_ns
397  cap等于tmpbuf
398  如果is_v2header((size_t)ret, cap)则
401  如果allocbuffer等于tmpbuf
403  否则释放内存
405  返回:ret
406  否则如果非is_v3header((size_t)ret, cap)则
407  释放内存
408  返回:负EINVAL
411  nscap等于tmpbuf
412  root等于le32_to_cpu(rootid)
413  kroot等于make_kuid - Map a user-namespace uid pair into a kuid
417  mappedroot等于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.
418  如果(mappedroot != (uid_t) - 1 && mappedroot != (uid_t)0)则
419  如果alloc
420  buffer等于tmpbuf
422  否则释放内存
424  返回:size
427  如果非rootid_owns_currentns(kroot)则
428  释放内存
429  返回:负EOPNOTSUPP
433  size等于sizeof(structvfs_cap_data)
434  如果alloc
435  buffer等于开辟内存
436  如果buffer
437  cap等于buffer
443  memcpy( & data, & data, sizeof(__le32) * 2 * VFS_CAP_U32)
445  否则
446  size等于负ENOMEM
449  释放内存
450  返回:size