Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:moyo_scan_bprm - Scan "struct linux_binprm".*@ee: Pointer to "struct tomoyo_execve".*@argc: Length of @argc.*@argv: Pointer to "struct tomoyo_argv".*@envc: Length of @envp.*@envp: Poiner to "struct tomoyo_envp".* Returns true on success, false otherwise.

Proto:static bool tomoyo_scan_bprm(struct tomoyo_execve *ee, const u16 argc, const struct tomoyo_argv *argv, const u16 envc, const struct tomoyo_envp *envp)

Type:bool

Parameter:

TypeParameterName
struct tomoyo_execve *ee
const u16argc
const struct tomoyo_argv *argv
const u16envc
const struct tomoyo_envp *envp
109  bprm = bprm
110  dump = For dumping argv[] and envp[].
111  arg_ptr = Size is TOMOYO_EXEC_TMPSIZE bytes
112  arg_len = 0
113  pos = current top of mem
114  offset = pos % PAGE_SIZE
115  argv_count = argc
116  envp_count = envc
117  bool result = true
121  If argc + envc <= size of local_checked Then
122  checked = local_checked
123  memset(local_checked, 0, size of local_checked )
124  Else
125  checked = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
126  If Not checked Then Return false
129  When argv_count || envp_count cycle
130  If Not tomoyo_dump_page(bprm, pos, dump) Then
131  result = false
132  Go to out
134  pos += PAGE_SIZE - offset
135  When offset < PAGE_SIZE cycle
138  c = kaddr[offset++]
140  If c && arg_len < TOMOYO_EXEC_TMPSIZE - 10 Then
141  If c == '\\' Then
142  arg_ptr[arg_len++] = '\\'
143  arg_ptr[arg_len++] = '\\'
144  Else if c > ' ' && c < 127 Then
145  arg_ptr[arg_len++] = c
146  Else
147  arg_ptr[arg_len++] = '\\'
148  arg_ptr[arg_len++] = (c >> 6) + '0'
149  arg_ptr[arg_len++] = ( c >> 3 & 7) + '0'
151  arg_ptr[arg_len++] = (c & 7) + '0'
153  Else
154  arg_ptr[arg_len] = '\0'
156  If c Then Continue
159  If argv_count Then
167  Else if envp_count Then
180  Else
181  Break
183  arg_len = 0
185  offset = 0
186  If Not result Then Break
189  out :
190  If result Then
194  When i < argc cycle
195  If checked[i] Then Continue
201  If is_not Then Continue
203  result = false
204  Break
206  When i < envc cycle
207  If checked[argc + i] Then Continue
213  If Not value && Not is_not || value && is_not Then Continue
216  result = false
217  Break
220  If checked != local_checked Then kfree(checked)
222  Return result
Caller
NameDescribe
tomoyo_conditionmoyo_condition - Check condition part.*@r: Pointer to "struct tomoyo_request_info".*@cond: Pointer to "struct tomoyo_condition". Maybe NULL.* Returns true on success, false otherwise.* Caller holds tomoyo_read_lock().