Function report |
Source Code:fs\binfmt_elf_fdpic.c |
Create Date:2022-07-28 20:29:03 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:load an fdpic binary into various bits of memory
Proto:static int load_elf_fdpic_binary(struct linux_binprm *bprm)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct linux_binprm * | bprm |
185 | regs = current_pt_regs() |
194 | struct file * interpreter = NULL |
195 | char * interpreter_name = NULL |
202 | memset( & exec_params, 0, size of exec_params ) |
203 | memset( & interp_params, 0, size of interp_params ) |
205 | copy of ELF header = buf |
210 | If Not is_elf( & copy of ELF header , file) Then Go to error |
212 | If Not That's for binfmt_elf_fdpic to deal with ( & copy of ELF header ) Then |
215 | Go to error |
229 | phdr = copy of PT_PHDR table |
235 | If p_filesz > # chars in a path name including nul Then Go to error |
243 | If Not interpreter_name Then Go to error |
247 | retval = kernel_read(file, interpreter_name, p_filesz, & pos) |
249 | If Value for the false possibility is greater at compile time(retval != p_filesz) Then |
256 | If interpreter_name[p_filesz - 1] != '\0' Then Go to error |
259 | kdebug("Using ELF interpreter %s", interpreter_name) |
262 | interpreter = open_exec(interpreter_name) |
263 | retval = PTR_ERR(interpreter) |
264 | If IS_ERR(interpreter) Then |
265 | interpreter = NULL |
266 | Go to error |
274 | would_dump(bprm, interpreter) |
276 | pos = 0 |
277 | retval = kernel_read(interpreter, buf, sizeof(linux_binprm->buf) , & pos) |
285 | copy of ELF header = *buf |
286 | Break |
290 | If user address at which to map binary == 0 Then user address at which to map binary = p_vaddr |
293 | Break |
298 | If is_constdisp( & copy of ELF header ) Then flags |= PT_LOADs require constant* displacement |
302 | If interpreter_name Then |
304 | If Not is_elf( & copy of ELF header , interpreter) Then Go to error |
316 | If flags & T if stack to be executable Then executable_stack = Enable executable stacks |
318 | Else if flags & T if stack not to be executable Then executable_stack = Disable executable stacks |
320 | Else executable_stack = Whatever the arch defaults to |
323 | If stack_size == 0 Then |
325 | If flags & T if stack to be executable Then executable_stack = Enable executable stacks |
327 | Else if flags & T if stack not to be executable Then executable_stack = Disable executable stacks |
329 | Else executable_stack = Whatever the arch defaults to |
334 | If stack_size == 0 Then stack_size = 131072UL |
337 | If is_constdisp( & copy of ELF header ) Then flags |= PT_LOADs require constant* displacement |
348 | If That's for binfmt_elf_fdpic to deal with ( & copy of ELF header ) Then Change personality of the currently running process.(PER_LINUX_FDPIC) |
355 | setup_new_exec(bprm) |
357 | set_binfmt( & elf_fdpic_format) |
359 | start_code = 0 |
360 | end_code = 0 |
361 | start_stack = 0 |
362 | start_data = 0 |
363 | end_data = 0 |
364 | exec_fdpic_loadmap = 0 |
365 | interp_fdpic_loadmap = 0 |
368 | elf_fdpic_arch_lay_out_mm( & exec_params, & interp_params, & start_stack, & start_brk) |
373 | retval = Finalizes the stack vm_area_struct. The flags and permissions are updated,* the stack is optionally relocated, and some extra space is added. |
390 | If interpreter_name Then |
393 | If retval < 0 Then |
395 | Go to error |
399 | fput(interpreter) |
400 | interpreter = NULL |
438 | If present useful information to the program by shovelling it onto the new* process's stack < 0 Then Go to error |
442 | kdebug("- start_code %lx", start_code) |
444 | kdebug("- start_data %lx", start_data) |
448 | kdebug("- start_stack %lx", start_stack) |
464 | entryaddr = If mapped entry user address Else mapped entry user address |
465 | start_thread(regs, entryaddr, start_stack) |
467 | retval = 0 |
469 | error : |
470 | If interpreter Then |
472 | fput(interpreter) |
474 | kfree(interpreter_name) |
475 | kfree( copy of PT_PHDR table ) |
477 | kfree( copy of PT_PHDR table ) |
479 | Return retval |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |