函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:kernfs node operations

函数原型:static int selinux_kernfs_init_security(struct kernfs_node *kn_dir, struct kernfs_node *kn)

返回类型:int

参数:

类型参数名称
struct kernfs_node *kn_dir
struct kernfs_node *kn
3472  tsec等于selinux_cred(current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.())
3477  rc等于kernfs_xattr_get(kn_dir, XATTR_NAME_SELINUX, NULL, 0)
3478  如果rc恒等于负ENODATA则返回:0
3480  否则如果rc小于0则返回:rc
3483  clen等于rc
3484  context等于开辟内存
3485  如果非context则返回:负ENOMEM
3488  rc等于kernfs_xattr_get(kn_dir, XATTR_NAME_SELINUX, context, clen)
3489  如果rc小于0则
3490  释放内存
3491  返回:rc
3494  rc等于security_context_to_sid( & selinux_state, context, clen, & parent_sid, GFP_KERNEL)
3496  释放内存
3497  如果rc则返回:rc
3500  如果 fscreate SID
3501  newsid等于 fscreate SID
3502  否则
3503  secclass等于inode_mode_to_security_class(mode)
3506  name等于name
3507  hash_len等于Return the "hash_len" (hash and length) of a null-terminated string
3509  rc等于security_transition_sid( & selinux_state, current SID , parent_sid, secclass, & q, & newsid)
3512  如果rc则返回:rc
3516  rc等于security_sid_to_context_force( & selinux_state, newsid, & context, & clen)
3518  如果rc则返回:rc
3521  rc等于kernfs_xattr_set(kn, XATTR_NAME_SELINUX, context, clen, set value, fail if attr already exists )
3523  释放内存
3524  返回:rc