函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:map_write

函数原型:static ssize_t map_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos, int cap_setid, struct uid_gid_map *map, struct uid_gid_map *parent_map)

返回类型:ssize_t

参数:

类型参数名称
struct file *file
const char __user *buf
size_tcount
loff_t *ppos
intcap_setid
struct uid_gid_map *map
struct uid_gid_map *parent_map
850  seq等于 needed for tty driver, and maybe others
851  ns等于private
855  kbuf等于NULL
859  如果ppos不等于0或count大于等于PAGE_SIZE则返回:负EINVAL
863  kbuf等于memdup_user_nul(buf, count)
864  如果是错误则返回:错误
886  mutex_lock( & userns_state_mutex)
888  memset( & new_map, 0, sizeof(structuid_gid_map))
890  ret等于负EPERM
892  如果 64 bytes -- 1 cache line 不等于0则转到:out
898  如果cap_valid(cap_setid)且非le_ns_capable - Determine if the file's opener had a capability in effect*@file: The file we want to check*@ns: The usernamespace we want the capability in*@cap: The capability to be tested for* Return true if task that opened the file had a capability in 则转到:out
902  ret等于负EINVAL
903  pos等于kbuf
904 pos循环
907  next_line等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
908  如果next_line
909  next_line等于'\0'
910  next_line自加
911  如果next_line恒等于'\0'则next_line = NULL
915  pos等于字符串删除空格
916  first等于转换字符串为无符号整形
917  如果非Note: isspace() must return false for %NUL-terminator ( * pos)则转到:out
920  pos等于字符串删除空格
921  lower_first等于转换字符串为无符号整形
922  如果非Note: isspace() must return false for %NUL-terminator ( * pos)则转到:out
925  pos等于字符串删除空格
926  count等于转换字符串为无符号整形
927  如果pos且非Note: isspace() must return false for %NUL-terminator ( * pos)则转到:out
931  pos等于字符串删除空格
932  如果pos不等于'\0'则转到:out
936  如果((first == (u32) - 1) || (lower_first == (u32) - 1))则转到:out
943  如果firstcount小于等于first则转到:out
945  如果lower_firstcount小于等于lower_first则转到:out
950  如果mappings_overlap( & new_map, & extent)则转到:out
953  如果(( 64 bytes -- 1 cache line + 1) == UID_GID_MAP_MAX_EXTENTS && (next_line != NULL))则转到:out
957  ret等于sert_extent - Safely insert a new idmap extent into struct uid_gid_map.* Takes care to allocate a 4K block of memory if the number of mappings exceeds* UID_GID_MAP_MAX_BASE_EXTENTS.
958  如果ret小于0则转到:out
960  ret等于负EINVAL
963  如果 64 bytes -- 1 cache line 恒等于0则转到:out
966  ret等于负EPERM
968  如果非new_idmap_permitted(file, ns, cap_setid, & new_map)则转到:out
971  ret等于负EPERM
975 idx小于 64 bytes -- 1 cache line 循环
979  如果 64 bytes -- 1 cache line 小于等于UID_GID_MAP_MAX_BASE_EXTENTSe等于extent[idx]
981  否则e等于forward[idx]
984  lower_first等于map_id_range_down(parent_map, lower_first, count)
991  如果(lower_first == (u32) - 1)则转到:out
994  lower_first等于lower_first
1001  ret等于sort_idmaps - Sorts an array of idmap entries.* Can only be called if number of mappings exceeds UID_GID_MAP_MAX_BASE_EXTENTS.
1002  如果ret小于0则转到:out
1006  如果 64 bytes -- 1 cache line 小于等于UID_GID_MAP_MAX_BASE_EXTENTS
1007  内存复制(extent, extent, 64 bytes -- 1 cache line * extent[0]的长度)
1009  否则
1010  forward等于forward
1011  reverse等于reverse
1013  smp_wmb()
1014  64 bytes -- 1 cache line 等于 64 bytes -- 1 cache line
1016  ppos等于count
1017  ret等于count
1018  out :
1019  如果ret小于0且 64 bytes -- 1 cache line 大于UID_GID_MAP_MAX_BASE_EXTENTS
1020  kfree(forward)
1021  kfree(reverse)
1022  forward = NULL
1023  reverse = NULL
1024  64 bytes -- 1 cache line 等于0
1027  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.
1028  kfree(kbuf)
1029  返回:ret
调用者
名称描述
proc_uid_map_write
proc_gid_map_write
proc_projid_map_write