函数逻辑报告 |
Source Code:fs\binfmt_flat.c |
Create Date:2022-07-29 11:04:24 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| 首页 | 函数Tree |
| 注解内核,赢得工具 | 下载SCCT | English |
函数名称:load_flat_file
函数原型:static int load_flat_file(struct linux_binprm *bprm, struct lib_info *libinfo, int id, unsigned long *extra_stack)
返回类型:int
参数:
| 类型 | 参数 | 名称 |
|---|---|---|
| struct linux_binprm * | bprm | |
| struct lib_info * | libinfo | |
| int | id | |
| unsigned long * | extra_stack |
| 443 | data_len等于ntohl(Offset of end of data segment from beginningof file )减ntohl(Offset of data segment from beginning offile ) |
| 444 | bss_len等于ntohl(Offset of end of bss segment from beginningof file )减ntohl(Offset of end of data segment from beginningof file ) |
| 446 | 如果extra_stack则 |
| 447 | stack_len加等于extra_stack |
| 448 | extra_stack等于stack_len |
| 452 | rev等于ntohl(version (as above) ) |
| 455 | 如果字符串指定长度比较则 |
| 467 | 如果flags按位与utput useful kernel trace for debugging 则打印信息("Loading file: %s\n", filename) |
| 495 | 如果rev不等于FLAT_VERSION则 |
| 496 | 打印错误信息("bad flat file version 0x%x (supported 0x%lx)\n", rev, FLAT_VERSION) |
| 499 | 转到:err |
| 527 | rlim等于rlimit(RLIMIT_DATA) |
| 528 | 如果rlim大于等于RLIM_INFINITY则rlim等于0的反 |
| 536 | 如果id恒等于0则 |
| 543 | setup_new_exec(bprm) |
| 549 | extra等于max_t - return maximum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedlong, bss_len + stack_len, relocs * sizeof(unsignedlong)) |
| 562 | pr_debug("ROM mapping of file (we hope)\n") |
| 564 | textpos等于vm_mmap(file, 0, text_len, page can be read | page can be executed , Changes are private | mark it as an executable , 0) |
| 566 | 如果非textpos或IS_ERR_VALUE(textpos)则 |
| 571 | 转到:err |
| 576 | realdatastart等于vm_mmap(NULL, 0, len, page can be read | page can be written | page can be executed , Changes are private , 0) |
| 579 | 如果realdatastart恒等于0或IS_ERR_VALUE(realdatastart)则 |
| 604 | 如果IS_ERR_VALUE(result)则 |
| 608 | vm_munmap(realdatastart, len) |
| 609 | 转到:err |
| 614 | memp等于realdatastart |
| 616 | 否则 |
| 620 | textpos等于vm_mmap(NULL, 0, len, page can be read | page can be executed | page can be written , Changes are private , 0) |
| 623 | 如果非textpos或IS_ERR_VALUE(textpos)则 |
| 629 | 转到:err |
| 705 | 如果IS_ERR_VALUE(result)则 |
| 713 | start_code等于textpos加sizeof(structflat_hdr) |
| 718 | 如果id恒等于0则 |
| 719 | start_code等于start_code |
| 721 | start_data等于datapos |
| 737 | 如果flags按位与utput useful kernel trace for debugging 则 |
| 738 | 打印信息("Mapping is %lx, Entry point is %x, data_start is %x\n", textpos, 0x00ffffff & ntohl(Offset of first executable instructionwith text segment from beginning of file ), ntohl(Offset of data segment from beginning offile )) |
| 748 | Start of data segment 等于datapos |
| 751 | Has this library been loaded? 等于1 |
| 752 | Start address for this module 等于0x00ffffff按位与ntohl(Offset of first executable instructionwith text segment from beginning of file )的值加textpos |
| 767 | 如果flags按位与program is PIC with GOT 则 |
| 768 | 循环 |
| 770 | 如果Careful: we have to cast the result to the type of the pointer* for sign reasons(rp_val, rp)则返回:负EFAULT |
| 774 | 如果rp_val则 |
| 775 | addr等于calc_reloc(rp_val, libinfo, id, 0) |
| 776 | 如果addr恒等于Relocation incorrect somewhere 则 |
| 780 | 如果put_user - Write a simple value into user space(addr, rp)则返回:负EFAULT |
| 807 | 如果Careful: we have to cast the result to the type of the pointer* for sign reasons(tmp, reloc + i)则返回:负EFAULT |
| 810 | addr等于flat_get_relocate_addr(relval) |
| 811 | rp等于calc_reloc(addr, libinfo, id, 1) |
| 812 | 如果rp恒等于Relocation incorrect somewhere 则 |
| 819 | 如果此条件成立可能性小(为编译器优化)(ret)则转到:err |
| 822 | 如果addr不等于0则 |
| 827 | 如果flags按位与program is PIC with GOT 的值恒等于0则 |
| 834 | addr等于calc_reloc(addr, libinfo, id, 0) |
| 835 | 如果addr恒等于Relocation incorrect somewhere 则 |
| 841 | ret等于flat_put_addr_at_rp(rp, addr, relval) |
| 842 | 如果此条件成立可能性小(为编译器优化)(ret)则转到:err |
| 866 | 返回:0 |
| 867 | err : |
| 868 | 返回:ret |
| 名称 | 描述 |
|---|---|
| load_flat_binary | These are the functions used to load flat style executables and shared* libraries. There is no binary dependent code anywhere else. |
| 源代码转换工具 开放的插件接口 | X |
|---|---|
| 支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |