Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\selinux\hooks.c Create Date:2022-07-28 18:57:55
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kernfs node operations

Proto:static int selinux_kernfs_init_security(struct kernfs_node *kn_dir, struct kernfs_node *kn)

Type:int

Parameter:

TypeParameterName
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  If rc == -ENODATA Then Return 0
3480  Else if rc < 0 Then Return rc
3483  clen = rc
3484  context = Allocation memory
3485  If Not context Then Return -ENOMEM
3488  rc = kernfs_xattr_get(kn_dir, XATTR_NAME_SELINUX, context, clen)
3489  If rc < 0 Then
3490  kfree(context)
3491  Return rc
3494  rc = security_context_to_sid( & selinux_state, context, clen, & parent_sid, GFP_KERNEL)
3496  kfree(context)
3497  If rc Then Return rc
3500  If fscreate SID Then
3501  newsid = fscreate SID
3502  Else
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  If rc Then Return rc
3516  rc = security_sid_to_context_force( & selinux_state, newsid, & context, & clen)
3518  If rc Then Return rc
3521  rc = kernfs_xattr_set(kn, XATTR_NAME_SELINUX, context, clen, set value, fail if attr already exists )
3523  kfree(context)
3524  Return rc