GeezerVison is showing github.com — feat: 性能优化,移除无用指令 · VVeakee/SKRoot-linuxKernelRoot@506fd1f
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/3rdparty/aarch64_asm_helper.h -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -54,7 +54,6 @@ static std::pair<std::shared_ptr<char>, size_t> aarch64_asm_to_bytes(const aarch | 54 | 54 | return { data_container, data_size }; | 55 | 55 | } | 56 | 56 |
| 57 | | - | 58 | 57 | static bool aarch64_asm_b(std::unique_ptr<asmjit::a64::Assembler>& a, int32_t b_value) { | 59 | 58 | if (b_value % 4 != 0) { | 60 | 59 | std::cout << "[发生错误] The B instruction offset must be a multiple of 4" << std::endl; | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/analyze/base_func.h -6Lines changed: 0 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,12 +40,6 @@ static std::string generate_random_str(std::size_t len) { | 40 | 40 | return key; | 41 | 41 | } | 42 | 42 |
| 43 | | -static std::string generate_random_root_key(int root_key_len) { | 44 | | - std::shared_ptr<char> root_key_data(new (std::nothrow) char[root_key_len], std::default_delete<char[]>()); | 45 | | - get_rand_str(root_key_data.get(), root_key_len); | 46 | | - std::string str_root_key(root_key_data.get(), root_key_len); | 47 | | - return str_root_key; | 48 | | -} | 49 | 43 |
| 50 | 44 | static auto hex2bytes(uint8_t* hex, uint8_t* str) -> void { | 51 | 45 | char high, low; | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/analyze/symbol_analyze.cpp -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,8 +33,6 @@ bool SymbolAnalyze::find_symbol_offset() { | 33 | 33 | m_kernel_sym_offset.kernel_halt = parse_symbol_region(kallsyms_matching_single("kernel_halt")); | 34 | 34 | m_kernel_sym_offset.drm_dev_printk = parse_symbol_region(kallsyms_matching_single("drm_dev_printk")); | 35 | 35 | m_kernel_sym_offset.dev_printk = parse_symbol_region(kallsyms_matching_single("__dev_printk")); | 36 | | - m_kernel_sym_offset.register_die_notifier = parse_symbol_region(kallsyms_matching_single("register_die_notifier")); | 37 | | - m_kernel_sym_offset.unregister_die_notifier = parse_symbol_region(kallsyms_matching_single("unregister_die_notifier")); | 38 | 36 |
| 39 | 37 | m_kernel_sym_offset.__do_execve_file = kallsyms_matching_single("__do_execve_file"); | 40 | 38 | m_kernel_sym_offset.do_execveat_common = kallsyms_matching_single("do_execveat_common"); | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/analyze/symbol_analyze.h -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,8 +20,6 @@ struct KernelSymbolOffset { | 20 | 20 | SymbolRegion kernel_halt = { 0 }; | 21 | 21 | SymbolRegion drm_dev_printk = { 0 }; | 22 | 22 | SymbolRegion dev_printk = { 0 }; | 23 | | - SymbolRegion register_die_notifier = { 0 }; | 24 | | - SymbolRegion unregister_die_notifier = { 0 }; | 25 | 23 |
| 26 | 24 | size_t __do_execve_file = 0; | 27 | 25 | size_t do_execveat_common = 0; | |
Collapse file Copy file name to clipboard Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_avc_denied.cpp +18-48Lines changed: 18 additions & 48 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,22 +24,17 @@ size_t PatchAvcDenied::patch_avc_denied_first_guide(const SymbolRegion& hook_fun | 24 | 24 | if (hook_func_start_addr == 0) { return 0; } | 25 | 25 | std::cout << "Start hooking addr: " << std::hex << hook_func_start_addr << std::endl << std::endl; | 26 | 26 | size_t avc_denied_addr = m_avc_denied.offset + m_avc_denied.size - 4; | 27 | | - | 28 | 27 | aarch64_asm_info asm_info = init_aarch64_asm(); | 29 | 28 | auto& a = asm_info.a; | 30 | 29 | uint32_t sp_el0_id = SysReg::encode(3, 0, 4, 1, 0); | 31 | 30 |
| 32 | | - a->stp(x7, x8, ptr(sp).pre(-16)); | 33 | | - a->stp(x9, x10, ptr(sp).pre(-16)); | 34 | | - | 35 | | - | 36 | | - a->mrs(x7, sp_el0_id); | | 31 | + a->mrs(x11, sp_el0_id); | 37 | 32 | for (auto x = 0; x < task_struct_offset_cred.size(); x++) { | 38 | 33 | if (x != task_struct_offset_cred.size() - 1) { | 39 | | - a->ldr(x7, ptr(x7, task_struct_offset_cred[x])); | | 34 | + a->ldr(x11, ptr(x11, task_struct_offset_cred[x])); | 40 | 35 | } | 41 | 36 | } | 42 | | - a->ldr(x7, ptr(x7, task_struct_offset_cred.back())); | | 37 | + a->ldr(x11, ptr(x11, task_struct_offset_cred.back())); | 43 | 38 |
| 44 | 39 | std::cout << print_aarch64_asm(asm_info) << std::endl; | 45 | 40 |
| @@ -67,61 +62,36 @@ size_t PatchAvcDenied::patch_avc_denied_core(const SymbolRegion& hook_func_start | 67 | 62 | uint64_t cap_ability_max = get_cap_ability_max(); | 68 | 63 | int cap_cnt = get_need_read_cap_cnt(); | 69 | 64 |
| 70 | | - | 71 | 65 | aarch64_asm_info asm_info = init_aarch64_asm(); | 72 | 66 | auto& a = asm_info.a; | 73 | 67 | Label label_end = a->newLabel(); | 74 | 68 | Label label_cycle_uid = a->newLabel(); | 75 | 69 | Label label_cycle_cap = a->newLabel(); | 76 | | - a->add(x7, x7, Imm(atomic_usage_len)); | 77 | | - a->mov(x8, Imm(8)); | | 70 | + | | 71 | + a->add(x11, x11, Imm(atomic_usage_len)); | | 72 | + a->mov(x12, Imm(8)); | 78 | 73 | a->bind(label_cycle_uid); | 79 | | - a->ldr(w9, ptr(x7).post(4)); | 80 | | - a->cbnz(w9, label_end); | 81 | | - a->subs(x8, x8, Imm(1)); | | 74 | + a->ldr(w13, ptr(x11).post(4)); | | 75 | + a->cbnz(w13, label_end); | | 76 | + a->subs(x12, x12, Imm(1)); | 82 | 77 | a->b(CondCode::kNE, label_cycle_uid); | 83 | | - a->mov(w8, Imm(0xc)); | 84 | | - a->ldr(w9, ptr(x7).post(4 + securebits_padding)); | 85 | | - a->cmp(w8, w9); | | 78 | + a->mov(w12, Imm(0xc)); | | 79 | + a->ldr(w13, ptr(x11).post(4 + securebits_padding)); | | 80 | + a->cmp(w12, w13); | 86 | 81 | a->b(CondCode::kNE, label_end); | 87 | | - a->mov(x8, Imm(cap_ability_max)); | 88 | | - a->mov(x9, Imm(cap_cnt)); | | 82 | + a->mov(x12, Imm(cap_ability_max)); | | 83 | + a->mov(x13, Imm(cap_cnt)); | 89 | 84 | a->bind(label_cycle_cap); | 90 | | - a->ldr(x10, ptr(x7).post(8)); | 91 | | - a->cmp(x10, x8); | | 85 | + a->ldr(x14, ptr(x11).post(8)); | | 86 | + a->cmp(x14, x12); | 92 | 87 | a->b(CondCode::kCC, label_end); | 93 | | - a->subs(x9, x9, Imm(1)); | | 88 | + a->subs(x13, x13, Imm(1)); | 94 | 89 | a->b(CondCode::kNE, label_cycle_cap); | 95 | 90 | a->mov(w0, wzr); | 96 | 91 | a->bind(label_end); | 97 | | - | 98 | | - std::cout << print_aarch64_asm(asm_info) << std::endl; | 99 | | - | 100 | | - auto [sp_bytes, data_size] = aarch64_asm_to_bytes(asm_info); | 101 | | - if (!sp_bytes) { | 102 | | - return 0; | 103 | | - } | 104 | | - std::string str_bytes = bytes2hex((const unsigned char*)sp_bytes.get(), data_size); | 105 | | - size_t shellcode_size = str_bytes.length() / 2; | 106 | | - if (shellcode_size > hook_func_start_region.size) { | 107 | | - std::cout << "[发生错误] patch_avc_denied failed: not enough kernel space." << std::endl; | 108 | | - return 0; | 109 | | - } | 110 | | - vec_out_patch_bytes_data.push_back({ str_bytes, hook_func_start_addr }); | 111 | | - return shellcode_size; | 112 | | -} | 113 | | - | 114 | | -size_t PatchAvcDenied::patch_avc_denied_end_guide(const SymbolRegion& hook_func_start_region, std::vector<patch_bytes_data>& vec_out_patch_bytes_data) { | 115 | | - size_t hook_func_start_addr = hook_func_start_region.offset; | 116 | | - if (hook_func_start_addr == 0) { return 0; } | 117 | | - std::cout << "Start hooking addr: " << std::hex << hook_func_start_addr << std::endl << std::endl; | 118 | | - | 119 | | - aarch64_asm_info asm_info = init_aarch64_asm(); | 120 | | - auto& a = asm_info.a; | 121 | | - a->ldp(x9, x10, ptr(sp).post(16)); | 122 | | - a->ldp(x7, x8, ptr(sp).post(16)); | 123 | 92 | a->ret(x30); | 124 | 93 | std::cout << print_aarch64_asm(asm_info) << std::endl; | | 94 | + | 125 | 95 | auto [sp_bytes, data_size] = aarch64_asm_to_bytes(asm_info); | 126 | 96 | if (!sp_bytes) { | 127 | 97 | return 0; | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_avc_denied.h -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,8 +12,6 @@ class PatchAvcDenied : public PatchBase | 12 | 12 | std::vector<patch_bytes_data>& vec_out_patch_bytes_data); | 13 | 13 |
| 14 | 14 | size_t patch_avc_denied_core(const SymbolRegion& hook_func_start_region, std::vector<patch_bytes_data>& vec_out_patch_bytes_data); | 15 | | - | 16 | | - size_t patch_avc_denied_end_guide(const SymbolRegion& hook_func_start_region, std::vector<patch_bytes_data>& vec_out_patch_bytes_data); | 17 | 15 | private: | 18 | 16 | int get_need_read_cap_cnt(); | 19 | 17 | SymbolRegion m_avc_denied = {0}; | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_do_execve.cpp +37-41Lines changed: 37 additions & 41 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -79,65 +79,61 @@ size_t PatchDoExecve::patch_do_execve(const SymbolRegion& hook_func_start_region | 79 | 79 | Label label_cycle_name = a->newLabel(); | 80 | 80 | a->embed((const uint8_t*)empty_root_key_buf, sizeof(empty_root_key_buf)); | 81 | 81 | a->mov(x0, x0); | 82 | | - a->stp(x7, x8, ptr(sp).pre(-16)); | 83 | | - a->stp(x9, x10, ptr(sp).pre(-16)); | 84 | | - a->stp(x11, x12, ptr(sp).pre(-16)); | 85 | | - a->mov(x7, Imm(0xFFFFFFFFFFFFF001)); | 86 | | - a->cmp(a64::x(m_reg_param.do_execve_key_reg), x7); | | 82 | + a->mov(x11, Imm(0xFFFFFFFFFFFFF001)); | | 83 | + a->cmp(a64::x(m_reg_param.do_execve_key_reg), x11); | 87 | 84 | a->b(CondCode::kCS, label_end); | 88 | 85 | if (m_reg_param.is_single_filename) { | 89 | | - a->mov(x7, a64::x(m_reg_param.do_execve_key_reg)); | | 86 | + a->mov(x11, a64::x(m_reg_param.do_execve_key_reg)); | 90 | 87 | } else { | 91 | | - a->ldr(x7, ptr(a64::x(m_reg_param.do_execve_key_reg))); | | 88 | + a->ldr(x11, ptr(a64::x(m_reg_param.do_execve_key_reg))); | 92 | 89 | } | 93 | 90 | int32_t key_offset = -a->offset(); | 94 | | - aarch64_asm_adr_x(a, x8, key_offset); | 95 | | - a->mov(x9, Imm(0)); | | 91 | + aarch64_asm_adr_x(a, x12, key_offset); | | 92 | + a->mov(x13, Imm(0)); | 96 | 93 | a->bind(label_cycle_name); | 97 | | - a->ldrb(w10, ptr(x7, x9)); | 98 | | - a->ldrb(w11, ptr(x8, x9)); | 99 | | - a->cmp(w10, w11); | | 94 | + a->ldrb(w14, ptr(x11, x13)); | | 95 | + a->ldrb(w15, ptr(x12, x13)); | | 96 | + a->cmp(w14, w15); | 100 | 97 | a->b(CondCode::kNE, label_end); | 101 | | - a->add(x9, x9, Imm(1)); | 102 | | - a->cmp(x9, Imm(ROOT_KEY_LEN)); | | 98 | + | | 99 | + a->add(x13, x13, Imm(1)); | | 100 | + a->cmp(x13, Imm(ROOT_KEY_LEN)); | 103 | 101 | a->b(CondCode::kLT, label_cycle_name); | 104 | | - a->mrs(x8, sp_el0_id); | 105 | | - a->mov(x10, x8); | | 102 | + a->mrs(x12, sp_el0_id); | | 103 | + a->mov(x14, x12); | 106 | 104 | for (auto x = 0; x < task_struct_offset_cred.size(); x++) { | 107 | 105 | if (x != task_struct_offset_cred.size() - 1) { | 108 | | - a->ldr(x10, ptr(x10, task_struct_offset_cred[x])); | | 106 | + a->ldr(x14, ptr(x14, task_struct_offset_cred[x])); | 109 | 107 | } | 110 | 108 | } | 111 | | - a->ldr(x10, ptr(x10, task_struct_offset_cred.back())); | 112 | | - a->add(x10, x10, Imm(atomic_usage_len)); | 113 | | - a->str(xzr, ptr(x10).post(8)); | 114 | | - a->str(xzr, ptr(x10).post(8)); | 115 | | - a->str(xzr, ptr(x10).post(8)); | 116 | | - a->str(xzr, ptr(x10).post(8)); | 117 | | - a->mov(w9, Imm(0xc)); | 118 | | - a->str(w9, ptr(x10).post(4 + securebits_padding)); | 119 | | - a->mov(x9, Imm(cap_ability_max)); | 120 | | - a->stp(x9, x9, ptr(x10).post(16)); | 121 | | - a->stp(x9, x9, ptr(x10).post(16)); | | 109 | + | | 110 | + a->ldr(x14, ptr(x14, task_struct_offset_cred.back())); | | 111 | + a->add(x14, x14, Imm(atomic_usage_len)); | | 112 | + a->str(xzr, ptr(x14).post(8)); | | 113 | + a->str(xzr, ptr(x14).post(8)); | | 114 | + a->str(xzr, ptr(x14).post(8)); | | 115 | + a->str(xzr, ptr(x14).post(8)); | | 116 | + a->mov(w13, Imm(0xc)); | | 117 | + a->str(w13, ptr(x14).post(4 + securebits_padding)); | | 118 | + a->mov(x13, Imm(cap_ability_max)); | | 119 | + a->stp(x13, x13, ptr(x14).post(16)); | | 120 | + a->stp(x13, x13, ptr(x14).post(16)); | 122 | 121 | if (cap_cnt == 5) { | 123 | | - a->str(x9, ptr(x10).post(8)); | | 122 | + a->str(x13, ptr(x14).post(8)); | 124 | 123 | } | 125 | 124 | if (is_thread_info_in_stack) { | 126 | | - a->mov(x9, x8); | 127 | | - a->and_(x9, x9, Imm((uint64_t)~(0x4000 - 1))); | 128 | | - a->ldxr(w10, ptr(x9)); | 129 | | - a->bic(w10, w10, Imm(0xFFF)); | 130 | | - a->stxr(w11, w10, ptr(x9)); | | 125 | + a->mov(x13, x12); | | 126 | + a->and_(x13, x13, Imm((uint64_t)~(0x4000 - 1))); | | 127 | + a->ldxr(w14, ptr(x13)); | | 128 | + a->bic(w14, w14, Imm(0xFFF)); | | 129 | + a->stxr(w15, w14, ptr(x13)); | 131 | 130 | } else { | 132 | | - a->ldxr(w10, ptr(x8)); | 133 | | - a->bic(w10, w10, Imm(0xFFF)); | 134 | | - a->stxr(w11, w10, ptr(x8)); | | 131 | + a->ldxr(w14, ptr(x12)); | | 132 | + a->bic(w14, w14, Imm(0xFFF)); | | 133 | + a->stxr(w15, w14, ptr(x12)); | 135 | 134 | } | 136 | | - a->str(xzr, ptr(x8, task_struct_offset_seccomp.back())); | | 135 | + a->str(xzr, ptr(x12, task_struct_offset_seccomp.back())); | 137 | 136 | a->bind(label_end); | 138 | | - a->ldp(x11, x12, ptr(sp).post(16)); | 139 | | - a->ldp(x9, x10, ptr(sp).post(16)); | 140 | | - a->ldp(x7, x8, ptr(sp).post(16)); | 141 | 137 | aarch64_asm_b(a, (int32_t)(do_execve_entry_hook_jump_back_addr - (hook_func_start_addr + a->offset()))); | 142 | 138 | std::cout << print_aarch64_asm(asm_info) << std::endl; | 143 | 139 |
| |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_filldir64.cpp +11-34Lines changed: 11 additions & 34 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,10 +14,8 @@ size_t PatchFilldir64::patch_filldir64_root_key_guide(size_t root_key_mem_addr, | 14 | 14 | std::cout << "Start hooking addr: " << std::hex << hook_func_start_addr << std::endl << std::endl; | 15 | 15 | aarch64_asm_info asm_info = init_aarch64_asm(); | 16 | 16 | auto& a = asm_info.a; | 17 | | - a->stp(x7, x8, ptr(sp).pre(-16)); | 18 | | - a->stp(x9, x10, ptr(sp).pre(-16)); | 19 | 17 | int root_key_adr_offset = root_key_mem_addr - (hook_func_start_addr + a->offset()); | 20 | | - aarch64_asm_adr_x(a, x7, root_key_adr_offset); | | 18 | + aarch64_asm_adr_x(a, x11, root_key_adr_offset); | 21 | 19 | std::cout << print_aarch64_asm(asm_info) << std::endl; | 22 | 20 | auto [sp_bytes, data_size] = aarch64_asm_to_bytes(asm_info); | 23 | 21 | if (!sp_bytes) { | @@ -38,31 +36,32 @@ size_t PatchFilldir64::patch_filldir64_core(const SymbolRegion& hook_func_start_ | 38 | 36 | size_t hook_func_start_addr = hook_func_start_region.offset; | 39 | 37 | if (hook_func_start_addr == 0) { return 0; } | 40 | 38 | std::cout << "Start hooking addr: " << std::hex << hook_func_start_addr << std::endl << std::endl; | | 39 | + size_t filldir64_entry_hook_jump_back_addr = m_filldir64 + 4; | 41 | 40 | aarch64_asm_info asm_info = init_aarch64_asm(); | 42 | 41 | auto& a = asm_info.a; | 43 | 42 | Label label_end = a->newLabel(); | 44 | 43 | Label label_cycle_name = a->newLabel(); | 45 | 44 |
| 46 | 45 | a->cmp(w2, Imm(16)); | 47 | 46 | a->b(CondCode::kNE, label_end); | 48 | | - a->mov(x8, Imm(0)); | | 47 | + a->mov(x12, Imm(0)); | 49 | 48 | a->bind(label_cycle_name); | 50 | | - a->ldrb(w9, ptr(x1, x8)); | 51 | | - a->ldrb(w10, ptr(x7, x8)); | 52 | | - a->cmp(w9, w10); | | 49 | + a->ldrb(w13, ptr(x1, x12)); | | 50 | + a->ldrb(w14, ptr(x11, x12)); | | 51 | + a->cmp(w13, w14); | 53 | 52 | a->b(CondCode::kNE, label_end); | 54 | | - a->add(x8, x8, Imm(1)); | 55 | | - a->cmp(x8, Imm(16)); | | 53 | + a->add(x12, x12, Imm(1)); | | 54 | + a->cmp(x12, Imm(16)); | 56 | 55 | a->b(CondCode::kLT, label_cycle_name); | 57 | | - a->ldp(x9, x10, ptr(sp).post(16)); | 58 | | - a->ldp(x7, x8, ptr(sp).post(16)); | 59 | 56 | if (m_kernel_ver_parser.is_kernel_version_less("6.1.0")) { | 60 | 57 | a->mov(x0, xzr); | 61 | 58 | } else { | 62 | 59 | a->mov(x0, Imm(1)); | 63 | 60 | } | 64 | 61 | a->ret(x30); | 65 | 62 | a->bind(label_end); | | 63 | + a->mov(x0, x0); | | 64 | + aarch64_asm_b(a, (int32_t)(filldir64_entry_hook_jump_back_addr - (hook_func_start_addr + a->offset()))); | 66 | 65 | std::cout << print_aarch64_asm(asm_info) << std::endl; | 67 | 66 | auto [sp_bytes, data_size] = aarch64_asm_to_bytes(asm_info); | 68 | 67 | if (!sp_bytes) { | @@ -74,32 +73,10 @@ size_t PatchFilldir64::patch_filldir64_core(const SymbolRegion& hook_func_start_ | 74 | 73 | std::cout << "[发生错误] patch_filldir64 failed: not enough kernel space." << std::endl; | 75 | 74 | return 0; | 76 | 75 | } | 77 | | - vec_out_patch_bytes_data.push_back({ str_bytes, hook_func_start_addr }); | 78 | | - return shellcode_size; | 79 | | - | 80 | | -} | 81 | | - | 82 | | -size_t PatchFilldir64::patch_filldir64_end_guide(const SymbolRegion& hook_func_start_region, std::vector<patch_bytes_data>& vec_out_patch_bytes_data) { | 83 | | - size_t hook_func_start_addr = hook_func_start_region.offset; | 84 | | - if (hook_func_start_addr == 0) { return 0; } | 85 | | - std::cout << "Start hooking addr: " << std::hex << hook_func_start_addr << std::endl << std::endl; | 86 | | - size_t filldir64_entry_hook_jump_back_addr = m_filldir64 + 4; | 87 | | - aarch64_asm_info asm_info = init_aarch64_asm(); | 88 | | - auto& a = asm_info.a; | 89 | | - a->ldp(x9, x10, ptr(sp).post(16)); | 90 | | - a->ldp(x7, x8, ptr(sp).post(16)); | 91 | | - a->mov(x0, x0); | 92 | | - aarch64_asm_b(a, (int32_t)(filldir64_entry_hook_jump_back_addr - (hook_func_start_addr + a->offset()))); | 93 | | - std::cout << print_aarch64_asm(asm_info) << std::endl; | 94 | | - auto [sp_bytes, data_size] = aarch64_asm_to_bytes(asm_info); | 95 | | - if (!sp_bytes) { | 96 | | - return 0; | 97 | | - } | 98 | | - std::string str_bytes = bytes2hex((const unsigned char*)sp_bytes.get(), data_size); | 99 | | - size_t shellcode_size = str_bytes.length() / 2; | 100 | 76 | char hookOrigCmd[4] = { 0 }; | 101 | 77 | memcpy(&hookOrigCmd, (void*)((size_t)&m_file_buf[0] + m_filldir64), sizeof(hookOrigCmd)); | 102 | 78 | std::string strHookOrigCmd = bytes2hex((const unsigned char*)hookOrigCmd, sizeof(hookOrigCmd)); | | 79 | + | 103 | 80 | int end_order_len = a->offset() - 2 * 4; | 104 | 81 | str_bytes = str_bytes.substr(0, (end_order_len) * 2) + strHookOrigCmd + str_bytes.substr((end_order_len + 4) * 2); | 105 | 82 | if (shellcode_size > hook_func_start_region.size) { | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_filldir64.h -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,6 @@ class PatchFilldir64 : public PatchBase | 10 | 10 |
| 11 | 11 | size_t patch_filldir64_root_key_guide(size_t root_key_mem_addr, const SymbolRegion& hook_func_start_region, std::vector<patch_bytes_data>& vec_out_patch_bytes_data); | 12 | 12 | size_t patch_filldir64_core(const SymbolRegion& hook_func_start_region, std::vector<patch_bytes_data>& vec_out_patch_bytes_data); | 13 | | - size_t patch_filldir64_end_guide(const SymbolRegion& hook_func_start_region, std::vector<patch_bytes_data>& vec_out_patch_bytes_data); | 14 | 13 |
| 15 | 14 | private: | 16 | 15 | size_t m_filldir64 = 0; | |
|