GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: 修复部分5.x内核无法修补问题 · Corner514/SKRoot-linuxKernelRoot@174e3ba

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • patch_kernel_root
    • analyze
      • symbol_analyze.cpp
      • symbol_analyze.h
    • exe
      • patch_kernel_root.exe
    • patch_do_execve.cpp
    • patch_kernel_root.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎patch_kernel_root/analyze/symbol_analyze.cpp‎

Copy file name to clipboardExpand all lines: patch_kernel_root/analyze/symbol_analyze.cpp
+39-1Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ bool SymbolAnalyze::analyze_kernel_symbol() {
1313
std::cout << "Failed to initialize kallsyms lookup name" << std::endl;
1414
return false;
1515
}
16-
if (!find_symbol_offset()) {
16+
bool found = find_symbol_offset();
17+
printf_symbol_offset();
18+
if (!found) {
1719
std::cout << "Failed to find symbol offset" << std::endl;
1820
return false;
1921
}
@@ -53,6 +55,10 @@ bool SymbolAnalyze::find_symbol_offset() {
5355
m_kernel_sym_offset.avc_denied = parse_symbol_region(kallsyms_matching_single("avc_denied", true));
5456
}
5557
m_kernel_sym_offset.filldir64 = kallsyms_matching_single("filldir64");
58+
if (m_kernel_sym_offset.filldir64 == 0) {
59+
m_kernel_sym_offset.filldir64 = kallsyms_matching_single("filldir64", true);
60+
}
61+
5662
m_kernel_sym_offset.freeze_task = kallsyms_matching_single("freeze_task");
5763

5864
m_kernel_sym_offset.revert_creds = kallsyms_matching_single("revert_creds");
@@ -75,6 +81,38 @@ bool SymbolAnalyze::find_symbol_offset() {
7581
}
7682

7783

84+
void SymbolAnalyze::printf_symbol_offset() {
85+
std::cout << "_text:" << m_kernel_sym_offset._text << std::endl;
86+
std::cout << "_stext:" << m_kernel_sym_offset._stext << std::endl;
87+
std::cout << "die:" << m_kernel_sym_offset.die.offset << ", size:" << m_kernel_sym_offset.die.size << std::endl;
88+
std::cout << "arm64_notify_die:" << m_kernel_sym_offset.arm64_notify_die.offset << ", size:" << m_kernel_sym_offset.arm64_notify_die.size << std::endl;
89+
std::cout << "kernel_halt:" << m_kernel_sym_offset.kernel_halt.offset << ", size:" << m_kernel_sym_offset.kernel_halt.size << std::endl;
90+
91+
std::cout << "drm_dev_printk:" << m_kernel_sym_offset.drm_dev_printk.offset << ", size:" << m_kernel_sym_offset.drm_dev_printk.size << std::endl;
92+
std::cout << "dev_printk:" << m_kernel_sym_offset.dev_printk.offset << ", size:" << m_kernel_sym_offset.dev_printk.size << std::endl;
93+
94+
std::cout << "__do_execve_file:" << m_kernel_sym_offset.__do_execve_file << std::endl;
95+
std::cout << "do_execveat_common:" << m_kernel_sym_offset.do_execveat_common << std::endl;
96+
std::cout << "do_execve_common:" << m_kernel_sym_offset.do_execve_common << std::endl;
97+
std::cout << "do_execveat:" << m_kernel_sym_offset.do_execveat << std::endl;
98+
std::cout << "do_execve:" << m_kernel_sym_offset.do_execve << std::endl;
99+
100+
std::cout << "avc_denied:" << m_kernel_sym_offset.avc_denied.offset << ", size:" << m_kernel_sym_offset.avc_denied.size << std::endl;
101+
std::cout << "filldir64:" << m_kernel_sym_offset.filldir64 << std::endl;
102+
std::cout << "freeze_task:" << m_kernel_sym_offset.freeze_task << std::endl;
103+
104+
std::cout << "revert_creds:" << m_kernel_sym_offset.revert_creds << std::endl;
105+
std::cout << "prctl_get_seccomp:" << m_kernel_sym_offset.prctl_get_seccomp << std::endl;
106+
107+
std::cout << "__cfi_check:" << m_kernel_sym_offset.__cfi_check.offset << ", size:" << m_kernel_sym_offset.__cfi_check.size << std::endl;
108+
std::cout << "__cfi_check_fail:" << m_kernel_sym_offset.__cfi_check_fail << std::endl;
109+
std::cout << "__cfi_slowpath_diag:" << m_kernel_sym_offset.__cfi_slowpath_diag << std::endl;
110+
std::cout << "__cfi_slowpath:" << m_kernel_sym_offset.__cfi_slowpath << std::endl;
111+
std::cout << "__ubsan_handle_cfi_check_fail_abort:" << m_kernel_sym_offset.__ubsan_handle_cfi_check_fail_abort << std::endl;
112+
std::cout << "__ubsan_handle_cfi_check_fail:" << m_kernel_sym_offset.__ubsan_handle_cfi_check_fail << std::endl;
113+
std::cout << "report_cfi_failure:" << m_kernel_sym_offset.report_cfi_failure << std::endl;
114+
}
115+
78116
uint64_t SymbolAnalyze::kallsyms_matching_single(const char* name, bool fuzzy) {
79117
if (fuzzy) {
80118
auto map = kallsyms_matching_all(name);
Collapse file

‎patch_kernel_root/analyze/symbol_analyze.h‎

Copy file name to clipboardExpand all lines: patch_kernel_root/analyze/symbol_analyze.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class SymbolAnalyze
5555
KernelSymbolOffset get_symbol_offset();
5656
private:
5757
bool find_symbol_offset();
58+
void printf_symbol_offset();
5859
uint64_t kallsyms_matching_single(const char* name, bool fuzzy = false);
5960
std::unordered_map<std::string, uint64_t> kallsyms_matching_all(const char* name);
6061
SymbolRegion parse_symbol_region(uint64_t offset);
Collapse file

‎patch_kernel_root/exe/patch_kernel_root.exe‎

Copy file name to clipboard
0 Bytes
Binary file not shown.
Collapse file

‎patch_kernel_root/patch_do_execve.cpp‎

Copy file name to clipboardExpand all lines: patch_kernel_root/patch_do_execve.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ size_t PatchDoExecve::patch_do_execve(const SymbolRegion& hook_func_start_region
7878
Label label_cycle_name = a->newLabel();
7979
a->embed((const uint8_t*)empty_root_key_buf, sizeof(empty_root_key_buf));
8080
a->mov(x0, x0);
81-
a->mov(x11, Imm(0xFFFFFFFFFFFFF001));
81+
a->mov(x11, Imm(uint64_t(-4095)));
8282
a->cmp(a64::x(m_doexecve_reg_param.do_execve_key_reg), x11);
8383
a->b(CondCode::kCS, label_end);
8484
if (m_doexecve_reg_param.is_single_filename) {
Collapse file

‎patch_kernel_root/patch_kernel_root.cpp‎

Copy file name to clipboardExpand all lines: patch_kernel_root/patch_kernel_root.cpp
-30Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -108,36 +108,6 @@ int main(int argc, char* argv[]) {
108108
}
109109
KernelSymbolOffset sym = symbol_analyze.get_symbol_offset();
110110

111-
std::cout << "_text:" << sym._text << std::endl;
112-
std::cout << "_stext:" << sym._stext << std::endl;
113-
std::cout << "die:" << sym.die.offset << ", size:" << sym.die.size << std::endl;
114-
std::cout << "arm64_notify_die:" << sym.arm64_notify_die.offset << ", size:" << sym.arm64_notify_die.size << std::endl;
115-
std::cout << "kernel_halt:" << sym.kernel_halt.offset << ", size:" << sym.kernel_halt.size << std::endl;
116-
117-
std::cout << "drm_dev_printk:" << sym.drm_dev_printk.offset << ", size:" << sym.drm_dev_printk.size << std::endl;
118-
std::cout << "dev_printk:" << sym.dev_printk.offset << ", size:" << sym.dev_printk.size << std::endl;
119-
120-
std::cout << "__do_execve_file:" << sym.__do_execve_file << std::endl;
121-
std::cout << "do_execveat_common:" << sym.do_execveat_common << std::endl;
122-
std::cout << "do_execve_common:" << sym.do_execve_common << std::endl;
123-
std::cout << "do_execveat:" << sym.do_execveat << std::endl;
124-
std::cout << "do_execve:" << sym.do_execve << std::endl;
125-
126-
std::cout << "avc_denied:" << sym.avc_denied.offset << ", size:" << sym.avc_denied.size << std::endl;
127-
std::cout << "filldir64:" << sym.filldir64 << std::endl;
128-
std::cout << "freeze_task:" << sym.freeze_task << std::endl;
129-
130-
std::cout << "revert_creds:" << sym.revert_creds << std::endl;
131-
std::cout << "prctl_get_seccomp:" << sym.prctl_get_seccomp << std::endl;
132-
133-
std::cout << "__cfi_check:" << sym.__cfi_check.offset << ", size:" << sym.__cfi_check.size << std::endl;
134-
std::cout << "__cfi_check_fail:" << sym.__cfi_check_fail << std::endl;
135-
std::cout << "__cfi_slowpath_diag:" << sym.__cfi_slowpath_diag << std::endl;
136-
std::cout << "__cfi_slowpath:" << sym.__cfi_slowpath << std::endl;
137-
std::cout << "__ubsan_handle_cfi_check_fail_abort:" << sym.__ubsan_handle_cfi_check_fail_abort << std::endl;
138-
std::cout << "__ubsan_handle_cfi_check_fail:" << sym.__ubsan_handle_cfi_check_fail << std::endl;
139-
std::cout << "report_cfi_failure:" << sym.report_cfi_failure << std::endl;
140-
141111
std::string t_mode_name;
142112
std::vector<size_t> v_cred;
143113
std::vector<size_t> v_seccomp;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.