Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\user_namespace.c Create Date:2022-07-28 11:19:42
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:proc_setgroups_write

Proto:ssize_t proc_setgroups_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
const char __user *buf
size_tcount
loff_t *ppos
1136  seq = needed for tty driver, and maybe others
1137  ns = private
1143  ret = -EINVAL
1144  If ppos != 0 || count >= size of kbuf Then Go to out
1148  ret = -EFAULT
1149  If copy_from_user(kbuf, buf, count) Then Go to out
1151  kbuf[count] = '\0'
1152  pos = kbuf
1155  ret = -EINVAL
1156  If strncmp(pos, "allow", 5) == 0 Then
1157  pos += 5
1158  setgroups_allowed = true
1160  Else if strncmp(pos, "deny", 4) == 0 Then
1161  pos += 4
1162  setgroups_allowed = false
1164  Else Go to out
1168  pos = skip_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.
1169  If pos != '\0' Then Go to out
1172  ret = -EPERM
1173  mutex_lock( & userns_state_mutex)
1174  If setgroups_allowed Then
1178  If Not (flags & USERNS_SETGROUPS_ALLOWED) Then Go to out_unlock
1180  Else
1184  If 64 bytes -- 1 cache line != 0 Then Go to out_unlock
1186  flags &= ~USERNS_SETGROUPS_ALLOWED
1188  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.
1191  ppos = count
1192  ret = count
1193  out :
1194  Return ret
1195  out_unlock :
1196  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.
1197  Go to out