Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\binfmt_script.c Create Date:2022-07-28 20:27:48
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:load_script

Proto:static int load_script(struct linux_binprm *bprm)

Type:int

Parameter:

TypeParameterName
struct linux_binprm *bprm
42  If buf[0] != '#' || buf[1] != '!' Then Return -ENOEXEC
51  If interp_flags & BINPRM_FLAGS_PATH_INACCESSIBLE Then Return -ENOENT
55  allow_write_access(file)
56  fput(file)
57  file = NULL
73  buf_end = buf + size of buf - 1
74  cp = strnchr - Find a character in a length limited string*@s: The string to be searched*@count: The number of characters to be searched*@c: The character to search for* Note that the %NUL-terminator is considered part of the string, and can* be searched for.
75  If Not cp Then
76  cp = next_non_spacetab(buf + 2, buf_end)
77  If Not cp Then Return -ENOEXEC
83  If Not next_terminator(cp, buf_end) Then Return -ENOEXEC
85  cp = buf_end
88  cp = '\0'
89  When cp > buf cycle
90  cp--
91  If cp == ' ' || cp == '\t' Then cp = '\0'
93  Else Break
96  When cp == ' ' || cp == '\t' cycle If cp == '\0' Then
98  Return -ENOEXEC
99  i_name = cp
100  i_arg = NULL
101  When cp && cp != ' ' && cp != '\t' cycle When cp == ' ' || cp == '\t' cycle
104  cp++ = '\0'
105  If cp Then i_arg = cp
117  retval = Arguments are '\0' separated strings found at the location bprm->p* points to; chop off the first by relocating brpm->p to right after* the first '\0' encountered.
118  If retval Then Return retval
120  retval = Like copy_strings, but get argv and its values from kernel memory.
121  If retval < 0 Then Return retval
123  argc++
124  If i_arg Then
125  retval = Like copy_strings, but get argv and its values from kernel memory.
126  If retval < 0 Then Return retval
128  argc++
130  retval = Like copy_strings, but get argv and its values from kernel memory.
131  If retval Then Return retval
133  argc++
134  retval = bprm_change_interp(i_name, bprm)
135  If retval < 0 Then Return retval
141  file = open_exec(i_name)
142  If IS_ERR(file) Then Return PTR_ERR(file)
145  file = file
146  retval = Fill the binprm structure from the inode.* Check permissions, then read the first BINPRM_BUF_SIZE bytes* This may be called multiple times for binary chains (scripts for example).
147  If retval < 0 Then Return retval
149  Return ycle the list of binary formats handler, until one recognizes the image