函数逻辑报告 |
Source Code:fs\binfmt_elf.c |
Create Date:2022-07-29 11:03:06 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:load_elf_binary
函数原型:static int load_elf_binary(struct linux_binprm *bprm)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct linux_binprm * | bprm |
683 | struct file * interpreter = NULL |
685 | load_addr_set等于0 |
687 | struct elf64_phdr * elf_ppnt, * elf_phdata, * interp_elf_phdata = NULL |
689 | bss_prot等于0 |
692 | interp_load_addr等于0 |
694 | reloc_func_desc((__unused__))等于0 |
696 | struct{struct elf64_hdr elf_ex;struct elf64_hdr interp_elf_ex;} * loc |
704 | 如果非loc则 |
719 | 如果非elf_check_arch( & elf_ex)则转到:out |
721 | 如果That's for binfmt_elf_fdpic to deal with ( & elf_ex)则转到:out |
727 | 如果非elf_phdata则转到:out |
730 | elf_ppnt等于elf_phdata |
742 | 如果 Segment size in file 大于# chars in a path name including nul 或 Segment size in file 小于2则转到:out_free_ph |
746 | elf_interpreter等于开辟内存 |
747 | 如果非elf_interpreter则转到:out_free_ph |
752 | 如果retval小于0则转到:out_free_interp |
756 | 如果elf_interpreter[ Segment size in file - 1]不等于'\0'则转到:out_free_interp |
760 | 释放内存 |
762 | 如果是错误则转到:out_free_ph |
769 | would_dump(bprm, interpreter) |
772 | retval等于elf_read(interpreter, & interp_elf_ex, interp_elf_ex的长度, 0) |
774 | 如果retval小于0则转到:out_free_dentry |
777 | 退出 |
779 | out_free_interp : |
780 | 释放内存 |
781 | 转到:out_free_ph |
784 | elf_ppnt等于elf_phdata |
787 | 当:p_type恒等于PT_GNU_STACK |
792 | 退出 |
804 | 如果interpreter则 |
807 | 如果内存比较不等于0则转到:out_free_dentry |
810 | 如果非elf_check_arch( & interp_elf_ex)或That's for binfmt_elf_fdpic to deal with ( & interp_elf_ex)则转到:out_free_dentry |
817 | 如果非interp_elf_phdata则转到:out_free_dentry |
842 | 如果retval则转到:out_free_dentry |
847 | 如果retval则转到:out_free_dentry |
852 | SET_PERSONALITY2(elf_ex, & arch_state) |
853 | 如果An executable for which elf_read_implies_exec() returns TRUE will* have the READ_IMPLIES_EXEC personality flag set automatically.(elf_ex, executable_stack)则personality或等于READ_IMPLIES_EXEC |
859 | setup_new_exec(bprm) |
864 | retval等于Finalizes the stack vm_area_struct. The flags and permissions are updated,* the stack is optionally relocated, and some extra space is added. |
866 | 如果retval小于0则转到:out_free_dentry |
869 | elf_bss等于0 |
870 | elf_brk等于0 |
872 | start_code等于0UL的反 |
873 | end_code等于0 |
874 | start_data等于0 |
875 | end_data等于0 |
883 | total_size等于0 |
888 | 如果此条件成立可能性小(为编译器优化)(elf_brk > elf_bss)则 |
919 | vaddr等于 Segment virtual address |
924 | 如果e_type恒等于ET_EXEC或load_addr_set则 |
957 | 如果interpreter则 |
959 | 如果flags按位与Randomize virtual address space 则load_bias加等于arch_mmap_rnd() |
962 | 否则load_bias等于0 |
972 | load_bias等于ELF_PAGESTART(load_bias - vaddr) |
976 | 如果非total_size则 |
978 | 转到:out_free_dentry |
987 | 转到:out_free_dentry |
990 | 如果非load_addr_set则 |
991 | load_addr_set等于1 |
994 | load_bias加等于error减ELF_PAGESTART(load_bias + vaddr) |
997 | reloc_func_desc等于load_bias |
1000 | k等于 Segment virtual address |
1001 | 如果k小于start_code则start_code等于k |
1003 | 如果start_data小于k则start_data等于k |
1016 | 转到:out_free_dentry |
1019 | k等于 Segment virtual address 加 Segment size in file |
1034 | Entry point virtual address 加等于load_bias |
1037 | start_code加等于load_bias |
1039 | start_data加等于load_bias |
1048 | 如果retval则转到:out_free_dentry |
1052 | 转到:out_free_dentry |
1055 | 如果interpreter则 |
1059 | 如果非是错误则 |
1064 | interp_load_addr等于elf_entry |
1065 | elf_entry加等于 Entry point virtual address |
1070 | 转到:out_free_dentry |
1075 | fput(interpreter) |
1076 | 否则 |
1080 | 转到:out_free_dentry |
1084 | 释放内存 |
1085 | 释放内存 |
1087 | set_binfmt( & elf_format) |
1090 | retval等于arch_setup_additional_pages(bprm, !!interpreter) |
1095 | retval等于create_elf_tables(bprm, & elf_ex, load_addr, interp_load_addr) |
1100 | start_code等于start_code |
1101 | start_data等于start_data |
1103 | start_stack等于p |
1118 | brk等于start_brk等于arch_randomize_brk(mm) |
1125 | 如果personality按位与MMAP_PAGE_ZERO则 |
1130 | error等于vm_mmap(NULL, 0, PAGE_SIZE, page can be read | page can be executed , Interpret addr exactly | Changes are private , 0) |
1134 | regs等于current_pt_regs() |
1150 | start_thread(regs, elf_entry, p) |
1151 | retval等于0 |
1152 | out : |
1153 | 释放内存 |
1154 | out_ret : |
1155 | 返回:retval |
1158 | out_free_dentry : |
1159 | 释放内存 |
1161 | 如果interpreter则fput(interpreter) |
1163 | out_free_ph : |
1164 | 释放内存 |
1165 | 转到:out |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |