函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:sel_write_create

函数原型:static ssize_t sel_write_create(struct file *file, char *buf, size_t size)

返回类型:ssize_t

参数:

类型参数名称
struct file *file
char *buf
size_tsize
861  fsi等于s_fs_info
862  state等于state
863  char * scon = NULL, * tcon = NULL
864  char * namebuf = NULL, * objname = NULL
868  char * newcon = NULL
872  length等于avc_has_perm - Check permissions and perform any appropriate auditing
876  如果length则转到:out
879  length等于负ENOMEM
880  scon等于分配内存并置零
881  如果非scon则转到:out
884  length等于负ENOMEM
885  tcon等于分配内存并置零
886  如果非tcon则转到:out
889  length等于负ENOMEM
890  namebuf等于分配内存并置零
891  如果非namebuf则转到:out
894  length等于负EINVAL
895  nargs等于sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments
896  如果nargs小于3或nargs大于4则转到:out
898  如果nargs恒等于4则
909  r等于w等于namebuf
910  循环
911  c1等于r自加
912  如果c1恒等于'+'则c1等于' '
914  否则如果c1恒等于'%'则
916  如果c1小于0则转到:out
919  如果c2小于0则转到:out
921  c1等于c1左移4位按位或c2
923  w自加等于c1
924 c1不等于'\0'循环
926  objname等于namebuf
929  length等于security_context_str_to_sid(state, scon, & ssid, GFP_KERNEL)
930  如果length则转到:out
933  length等于security_context_str_to_sid(state, tcon, & tsid, GFP_KERNEL)
934  如果length则转到:out
937  length等于security_transition_sid_user(state, ssid, tsid, tclass, objname, & newsid)
939  如果length则转到:out
942  length等于security_sid_to_context(state, newsid, & newcon, & len)
943  如果length则转到:out
946  length等于负ERANGE
947  如果len大于SIMPLE_TRANSACTION_LIMIT
948  打印错误信息("SELinux: %s: context size (%u) exceeds payload max\n", __func__, len)
950  转到:out
953  memcpy(buf, newcon, len)
954  length等于len
955  out :
956  释放内存
957  释放内存
958  释放内存
959  释放内存
960  返回:length