函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:sel_open_policy

函数原型:static int sel_open_policy(struct inode *inode, struct file *filp)

返回类型:int

参数:

类型参数名称
struct inode *inode
struct file *filp
375  fsi等于s_fs_info
376  state等于state
377  struct policy_load_memory * plm = NULL
380  BUG_ON( needed for tty driver, and maybe others )
382  mutex_lock( & mutex)
384  rc等于avc_has_perm - Check permissions and perform any appropriate auditing
387  如果rc则转到:err
390  rc等于负EBUSY
391  如果policy_opened则转到:err
394  rc等于负ENOMEM
395  plm等于分配内存并置零
396  如果非plm则转到:err
399  如果NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they 不等于security_policydb_len(state)则
400  inode_lock(inode)
401  NOTE: unlike i_size_read(), i_size_write() does need locking around it* (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount* can be lost, resulting in subsequent i_size_read() calls spinning forever.
402  inode_unlock(inode)
405  rc等于security_read_policy(state, & data, & len)
406  如果rc则转到:err
409  policy_opened等于1
411  needed for tty driver, and maybe others 等于plm
413  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
415  返回:0
416  err :
417  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
419  如果plmvfree(data)
421  释放内存
422  返回:rc