Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:he loader itself

Proto:static int load_misc_binary(struct linux_binprm *bprm)

Type:int

Parameter:

TypeParameterName
struct linux_binprm *bprm
135  struct file * interp_file = NULL
137  fd_binary = -1
139  retval = -ENOEXEC
140  If Not enabled Then Return retval
144  read_lock( & entries_lock)
145  fmt = Check if we support the binfmt* if we do, return the node, else NULL* locking is done in load_misc_binary
146  If fmt Then get a reference to a dentry
148  read_unlock( & entries_lock)
149  If Not fmt Then Return retval
153  retval = -ENOENT
154  If interp_flags & BINPRM_FLAGS_PATH_INACCESSIBLE Then Go to ret
157  If Not ( type, status, etc. & MISC_FMT_PRESERVE_ARGV0) Then
158  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.
159  If retval Then Go to ret
163  If type, status, etc. & MISC_FMT_OPEN_BINARY Then
169  fd_binary = get_unused_fd_flags(0)
170  If fd_binary < 0 Then
171  retval = fd_binary
172  Go to ret
174  fd_install(fd_binary, file)
178  would_dump(bprm, file)
180  allow_write_access(file)
181  file = NULL
184  interp_flags |= BINPRM_FLAGS_EXECFD
185  interp_data = fd_binary
187  Else
188  allow_write_access(file)
189  fput(file)
190  file = NULL
193  retval = Like copy_strings, but get argv and its values from kernel memory.
194  If retval < 0 Then Go to error
196  argc++
199  retval = Like copy_strings, but get argv and its values from kernel memory.
200  If retval < 0 Then Go to error
202  argc++
205  retval = bprm_change_interp( filename of interpreter , bprm)
206  If retval < 0 Then Go to error
209  If type, status, etc. & MISC_FMT_OPEN_FILE Then
210  interp_file = file_clone_open(interp_file)
211  If Not IS_ERR(interp_file) Then deny_write_access(interp_file)
213  Else
214  interp_file = open_exec( filename of interpreter )
216  retval = PTR_ERR(interp_file)
217  If IS_ERR(interp_file) Then Go to error
220  file = interp_file
221  If type, status, etc. & MISC_FMT_CREDENTIALS Then
222  pos = 0
228  memset(buf, 0, sizeof(linux_binprm->buf) )
229  retval = kernel_read(file, buf, sizeof(linux_binprm->buf) , & pos)
231  Else 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).
234  If retval < 0 Then Go to error
237  retval = ycle the list of binary formats handler, until one recognizes the image
238  If retval < 0 Then Go to error
241  ret :
242  dput - release a dentry*@dentry: dentry to release * Release a dentry. This will drop the usage count and if appropriate* call the dentry unlink method as well as removing it from the queues and* releasing its resources
243  Return retval
244  error :
245  If fd_binary > 0 Then In contrast to sys_close(), this stub does not check whether the syscall* should or should not be restarted, but returns the raw error codes from* __close_fd().
247  interp_flags = 0
248  interp_data = 0
249  Go to ret