函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:inode_doinit_use_xattr

函数原型:static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry, unsigned int def_sid, unsigned int *sid)

返回类型:int

参数:

类型参数名称
struct inode *inode
struct dentry *dentry
unsigned intdef_sid
unsigned int *sid
1377  len等于INITCONTEXTLEN
1378  context等于开辟内存
1379  如果非context则返回:负ENOMEM
1382  context[len]等于'\0'
1383  rc等于__vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len)
1384  如果rc恒等于负ERANGE
1385  释放内存
1388  rc等于__vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, NULL, 0)
1389  如果rc小于0则返回:rc
1392  len等于rc
1393  context等于开辟内存
1394  如果非context则返回:负ENOMEM
1397  context[len]等于'\0'
1398  rc等于__vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len)
1401  如果rc小于0则
1402  释放内存
1403  如果rc不等于负ENODATA
1404  打印警告信息("SELinux: %s: getxattr returned %d for dev=%s ino=%ld\n", __func__, - rc, s_id, Stat data, not accessed from path walking )
1406  返回:rc
1408  sid等于def_sid
1409  返回:0
1412  rc等于security_context_to_sid_default( & selinux_state, context, rc, sid, def_sid, GFP_NOFS)
1414  如果rc
1415  dev等于s_id
1416  ino等于Stat data, not accessed from path walking
1418  如果rc恒等于负EINVAL
1419  pr_notice_ratelimited("SELinux: inode=%lu on dev=%s was found to have an invalid context=%s. This indicates you may need to relabel the inode or the filesystem in question.\n", ino, dev, context)
1421  否则
1422  打印警告信息("SELinux: %s: context_to_sid(%s) returned %d for dev=%s ino=%ld\n", __func__, context, - rc, dev, ino)
1426  释放内存
1427  返回:0
调用者
名称描述
inode_doinit_with_dentry