GeezerVison is showing github.com — fix: 优化代码结构 · VVeakee/SKRoot-linuxKernelRoot@62c7f56
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/analyze/symbol_analyze.cpp +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#include "analyze_kernel.h" | | 1 | +#include "symbol_analyze.h" | 2 | 2 |
| 3 | | -AnalyzeKernel::AnalyzeKernel(const std::vector<char>& file_buf) : m_file_buf(file_buf), m_kernel_sym_parser(file_buf) | | 3 | +SymbolAnalyze::SymbolAnalyze(const std::vector<char>& file_buf) : m_file_buf(file_buf), m_kernel_sym_parser(file_buf) | 4 | 4 | { | 5 | 5 | } | 6 | 6 |
| 7 | | -AnalyzeKernel::~AnalyzeKernel() | | 7 | +SymbolAnalyze::~SymbolAnalyze() | 8 | 8 | { | 9 | 9 | } | 10 | 10 |
| 11 | | -bool AnalyzeKernel::analyze_kernel_symbol() { | | 11 | +bool SymbolAnalyze::analyze_kernel_symbol() { | 12 | 12 | if (!m_kernel_sym_parser.init_kallsyms_lookup_name()) { | 13 | 13 | std::cout << "Failed to initialize kallsyms lookup name" << std::endl; | 14 | 14 | return false; | @@ -20,15 +20,15 @@ bool AnalyzeKernel::analyze_kernel_symbol() { | 20 | 20 | return true; | 21 | 21 | } | 22 | 22 |
| 23 | | -KernelSymbolOffset AnalyzeKernel::get_symbol_offset() { | | 23 | +KernelSymbolOffset SymbolAnalyze::get_symbol_offset() { | 24 | 24 | return m_kernel_sym_offset; | 25 | 25 | } | 26 | 26 |
| 27 | | -bool AnalyzeKernel::is_kernel_version_less(const std::string& ver) const { | | 27 | +bool SymbolAnalyze::is_kernel_version_less(const std::string& ver) const { | 28 | 28 | return m_kernel_sym_parser.is_kernel_version_less(ver); | 29 | 29 | } | 30 | 30 |
| 31 | | -bool AnalyzeKernel::find_symbol_offset() { | | 31 | +bool SymbolAnalyze::find_symbol_offset() { | 32 | 32 | m_kernel_sym_offset._text = m_kernel_sym_parser.kallsyms_lookup_name("_text"); | 33 | 33 | m_kernel_sym_offset._stext = m_kernel_sym_parser.kallsyms_lookup_name("_stext"); | 34 | 34 |
| |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/analyze/symbol_analyze.h +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,11 +33,11 @@ struct KernelSymbolOffset { | 33 | 33 | size_t report_cfi_failure = 0; | 34 | 34 | }; | 35 | 35 |
| 36 | | -class AnalyzeKernel | | 36 | +class SymbolAnalyze | 37 | 37 | { | 38 | 38 | public: | 39 | | - AnalyzeKernel(const std::vector<char> & file_buf); | 40 | | - ~AnalyzeKernel(); | | 39 | + SymbolAnalyze(const std::vector<char> & file_buf); | | 40 | + ~SymbolAnalyze(); | 41 | 41 |
| 42 | 42 | public: | 43 | 43 | bool analyze_kernel_symbol(); | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_avc_denied.cpp +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include "patch_avc_denied.h" | 2 | 2 | #include "analyze/ARM_asm.h" | 3 | 3 | PatchAvcDenied::PatchAvcDenied(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 4 | | - const AnalyzeKernel& analyze_kernel) : PatchBase(file_buf, sym, analyze_kernel) { | | 4 | + const SymbolAnalyze& symbol_analyze) : PatchBase(file_buf, sym, symbol_analyze) { | 5 | 5 |
| 6 | 6 | } | 7 | 7 |
| |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_avc_denied.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ class PatchAvcDenied : public PatchBase | 6 | 6 | { | 7 | 7 | public: | 8 | 8 | PatchAvcDenied(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 9 | | - const AnalyzeKernel& analyze_kernel); | | 9 | + const SymbolAnalyze& symbol_analyze); | 10 | 10 | ~PatchAvcDenied(); | 11 | 11 |
| 12 | 12 | size_t patch_avc_denied(size_t hook_func_start_addr, const std::vector<size_t>& task_struct_offset_cred, | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_base.cpp +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include "patch_base.h" | 2 | 2 | #include "analyze/ARM_asm.h" | 3 | 3 | PatchBase::PatchBase(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 4 | | - const AnalyzeKernel& analyze_kernel) : m_file_buf(file_buf), m_sym(sym), m_analyze_kernel(analyze_kernel) { | | 4 | + const SymbolAnalyze& symbol_analyze) : m_file_buf(file_buf), m_sym(sym), m_symbol_analyze(symbol_analyze) { | 5 | 5 |
| 6 | 6 | } | 7 | 7 |
| @@ -11,7 +11,7 @@ PatchBase::~PatchBase() | 11 | 11 |
| 12 | 12 | int PatchBase::get_cred_atomic_usage_len() { | 13 | 13 | int len = 8; | 14 | | - if (m_analyze_kernel.is_kernel_version_less("6.6.0")) { | | 14 | + if (m_symbol_analyze.is_kernel_version_less("6.6.0")) { | 15 | 15 | len = 4; | 16 | 16 | } | 17 | 17 | return len; | @@ -26,10 +26,10 @@ int PatchBase::get_cred_securebits_padding() { | 26 | 26 |
| 27 | 27 | std::string PatchBase::get_cap_ability_max() { | 28 | 28 | std::string cap; | 29 | | - if (m_analyze_kernel.is_kernel_version_less("5.8.0")) { | | 29 | + if (m_symbol_analyze.is_kernel_version_less("5.8.0")) { | 30 | 30 | cap = "0x3FFFFFFFFF"; | 31 | 31 | } | 32 | | - else if (m_analyze_kernel.is_kernel_version_less("5.9.0")) { | | 32 | + else if (m_symbol_analyze.is_kernel_version_less("5.9.0")) { | 33 | 33 | cap = "0xFFFFFFFFFF"; | 34 | 34 | } | 35 | 35 | else { | @@ -40,7 +40,7 @@ std::string PatchBase::get_cap_ability_max() { | 40 | 40 |
| 41 | 41 | int PatchBase::get_cap_cnt() { | 42 | 42 | int cnt = 0; | 43 | | - if (m_analyze_kernel.is_kernel_version_less("4.3.0")) { | | 43 | + if (m_symbol_analyze.is_kernel_version_less("4.3.0")) { | 44 | 44 | cnt = 4; | 45 | 45 | } else { | 46 | 46 | cnt = 5; | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_base.h +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | #include <iostream> | 3 | 3 | #include <vector> | 4 | 4 | #include "patch_kernel_root.h" | 5 | | -#include "analyze/analyze_kernel.h" | | 5 | +#include "analyze/symbol_analyze.h" | 6 | 6 | class PatchBase | 7 | 7 | { | 8 | 8 | public: | 9 | 9 | PatchBase(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 10 | | - const AnalyzeKernel& analyze_kernel); | | 10 | + const SymbolAnalyze& symbol_analyze); | 11 | 11 | ~PatchBase(); | 12 | 12 | protected: | 13 | 13 | int get_cred_atomic_usage_len(); | @@ -16,5 +16,5 @@ class PatchBase | 16 | 16 | int get_cap_cnt(); | 17 | 17 | const std::vector<char>& m_file_buf; | 18 | 18 | const KernelSymbolOffset& m_sym; | 19 | | - const AnalyzeKernel& m_analyze_kernel; | | 19 | + const SymbolAnalyze& m_symbol_analyze; | 20 | 20 | }; |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_do_execve.cpp +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | #include "patch_do_execve.h" | 3 | 3 | #include "analyze/ARM_asm.h" | 4 | 4 | PatchDoExecve::PatchDoExecve(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 5 | | - const AnalyzeKernel& analyze_kernel) : PatchBase(file_buf, sym, analyze_kernel) { | | 5 | + const SymbolAnalyze& symbol_analyze) : PatchBase(file_buf, sym, symbol_analyze) { | 6 | 6 |
| 7 | 7 | } | 8 | 8 | PatchDoExecve::~PatchDoExecve() {} | 9 | 9 |
| 10 | 10 | std::pair<size_t, size_t> PatchDoExecve::get_do_execve_param() { | 11 | 11 | size_t do_execve_addr = 0; | 12 | 12 | size_t do_execve_key_reg; | 13 | | - if (m_analyze_kernel.is_kernel_version_less("3.19.0")) { | | 13 | + if (m_symbol_analyze.is_kernel_version_less("3.19.0")) { | 14 | 14 | do_execve_addr = m_sym.do_execve_common; | 15 | 15 | do_execve_key_reg = 0; | 16 | 16 | } | 17 | | - else if (m_analyze_kernel.is_kernel_version_less("4.18.0")) { | | 17 | + else if (m_symbol_analyze.is_kernel_version_less("4.18.0")) { | 18 | 18 | do_execve_addr = m_sym.do_execveat_common; | 19 | 19 | do_execve_key_reg = 1; | 20 | 20 | } | 21 | | - else if (m_analyze_kernel.is_kernel_version_less("5.9.0")) { | | 21 | + else if (m_symbol_analyze.is_kernel_version_less("5.9.0")) { | 22 | 22 | do_execve_addr = m_sym.__do_execve_file; | 23 | 23 | do_execve_key_reg = 1; | 24 | 24 | } | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_do_execve.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ class PatchDoExecve : public PatchBase | 6 | 6 | { | 7 | 7 | public: | 8 | 8 | PatchDoExecve(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 9 | | - const AnalyzeKernel& analyze_kernel); | | 9 | + const SymbolAnalyze& symbol_analyze); | 10 | 10 | ~PatchDoExecve(); | 11 | 11 |
| 12 | 12 | size_t patch_do_execve(const std::string& str_root_key, size_t hook_func_start_addr, | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_filldir64.cpp +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include "patch_filldir64.h" | 2 | 2 | #include "analyze/ARM_asm.h" | 3 | 3 | PatchFilldir64::PatchFilldir64(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 4 | | - const AnalyzeKernel& analyze_kernel) : PatchBase(file_buf, sym, analyze_kernel) { | | 4 | + const SymbolAnalyze& symbol_analyze) : PatchBase(file_buf, sym, symbol_analyze) { | 5 | 5 |
| 6 | 6 | } | 7 | 7 |
| |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_filldir64.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ class PatchFilldir64 : public PatchBase | 6 | 6 | { | 7 | 7 | public: | 8 | 8 | PatchFilldir64(const std::vector<char>& file_buf, const KernelSymbolOffset& sym, | 9 | | - const AnalyzeKernel& analyze_kernel); | | 9 | + const SymbolAnalyze& symbol_analyze); | 10 | 10 | ~PatchFilldir64(); | 11 | 11 |
| 12 | 12 | size_t patch_filldir64(size_t root_key_addr_offset, size_t hook_func_start_addr, std::vector<patch_bytes_data>& vec_out_patch_bytes_data); | |
|