We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
内核日志: [26821.176645] [+] KP D load_module_path: /data/local/tmp/mod_main.kpm [26821.176674] [+] KP D load_module_path: module size: 8668 [26821.176714] [+] KP D loading module: [26821.176714] [+] KP D name: IO Redirect [26821.176715] [+] KP D version: 1.0.0 [26821.176716] [+] KP D license: (null) [26821.176716] [+] KP D author: yuuki [26821.176717] [+] KP D description: Prevent your phone from being maliciously formatted [26821.176730] [+] KP I alloc module size: 3935 [26821.176735] [+] KP D final section addresses: [26821.176735] [+] KP D .text ffffffe4ec1c3130 5e4 [26821.176736] [+] KP D .rodata.str1.8 ffffffe4ec1c4130 325 [26821.176737] [+] KP D .kpm.info ffffffe4ec1c4455 6c [26821.176738] [+] KP D .data ffffffe4ec1c5130 10 [26821.176738] [+] KP D .kpm.ctl0 ffffffe4ec1c5140 8 [26821.176739] [+] KP D .kpm.exit ffffffe4ec1c5148 8 [26821.176739] [+] KP D .kpm.init ffffffe4ec1c5150 8 [26821.176740] [+] KP D .bss ffffffe4ec1c5158 50 [26821.176740] [+] KP D .symtab ffffffe4ec1c6130 648 [26821.176741] [+] KP D .strtab ffffffe4ec1c6896 1cf [26821.176743] [-] KP E unknown symbol: memset
代码: #include "data_parse.h"
char *my_strdup(const char *src) { if (src == NULL) { return NULL; }
size_t len = strlen(src) + 1; char *copy = (char*)kf_vmalloc(len); if (copy == NULL) { return NULL; } memcpy(copy, src, len); return copy;
}
char *my_strtok(char *str, const char *delim) { static char *saved_str = NULL; char *start = NULL; char *end = NULL;
if (str != NULL) { saved_str = str; } if (saved_str == NULL) { return NULL; } start = saved_str; while (*start && strchr(delim, *start) != NULL) { start++; } if (*start == '\0') { saved_str = NULL; return NULL; } end = start; while (*end && strchr(delim, *end) == NULL) { end++; } if (*end != '\0') { *end = '\0'; saved_str = end + 1; } else { saved_str = NULL; } return start;
void parsePaths(const char *input, char source_path[][PATH_MAX], char redirect_path[][PATH_MAX], int *line_count) { char *temp = my_strdup(input); char *line = my_strtok(temp, "\n"); *line_count = 0;
while (line != NULL) { char *arrow = strstr(line, " -> "); if (arrow != NULL) { // 分隔符前后的路径 size_t path_len = arrow - line; strncpy(source_path[*line_count], line, path_len); source_path[*line_count][path_len] = '\0'; // 确保字符串以 '\0' 结尾 strncpy(redirect_path[*line_count], arrow + 4, PATH_MAX - 1); redirect_path[*line_count][PATH_MAX - 1] = '\0'; // 确保字符串以 '\0' 结尾 (*line_count)++; } line = my_strtok(NULL, "\n"); } kf_vfree(temp);
//static long mod_control0(const char *args, char *__user out_msg, int outlen) { pr_info("[yuuki] kpm hello control0, args: %s\n", args);
char source_paths[MAX_LINES][PATH_MAX] = {0}; char redirect_paths[MAX_LINES][PATH_MAX] = {0}; int line_count = 0; // 解析输入 parsePaths(args, source_paths, redirect_paths, &line_count); // 输出结果 for (int i = 0; i < line_count; i++) { pr_info("[yuuki] source_path: %s redirect_path: %s\n", source_paths[i], redirect_paths[i]); } //control_internal(true); return 0;
我都没有使用到memset这个函数,但是加载失败提示unknown symbol: memset 我尝试使用void *(*kf_memset)(void *s, int c, size_t count) = NULL; kf_memset = (typeof(kf_memset))kallsyms_lookup_name("memset");依然会报这个错误,请问大佬们这个问题如何解决
The text was updated successfully, but these errors were encountered:
你自己编译器优化的问题
Sorry, something went wrong.
No branches or pull requests
内核日志:
[26821.176645] [+] KP D load_module_path: /data/local/tmp/mod_main.kpm
[26821.176674] [+] KP D load_module_path: module size: 8668
[26821.176714] [+] KP D loading module:
[26821.176714] [+] KP D name: IO Redirect
[26821.176715] [+] KP D version: 1.0.0
[26821.176716] [+] KP D license: (null)
[26821.176716] [+] KP D author: yuuki
[26821.176717] [+] KP D description: Prevent your phone from being maliciously formatted
[26821.176730] [+] KP I alloc module size: 3935
[26821.176735] [+] KP D final section addresses:
[26821.176735] [+] KP D .text ffffffe4ec1c3130 5e4
[26821.176736] [+] KP D .rodata.str1.8 ffffffe4ec1c4130 325
[26821.176737] [+] KP D .kpm.info ffffffe4ec1c4455 6c
[26821.176738] [+] KP D .data ffffffe4ec1c5130 10
[26821.176738] [+] KP D .kpm.ctl0 ffffffe4ec1c5140 8
[26821.176739] [+] KP D .kpm.exit ffffffe4ec1c5148 8
[26821.176739] [+] KP D .kpm.init ffffffe4ec1c5150 8
[26821.176740] [+] KP D .bss ffffffe4ec1c5158 50
[26821.176740] [+] KP D .symtab ffffffe4ec1c6130 648
[26821.176741] [+] KP D .strtab ffffffe4ec1c6896 1cf
[26821.176743] [-] KP E unknown symbol: memset
代码:
#include "data_parse.h"
char *my_strdup(const char *src) {
if (src == NULL) {
return NULL;
}
}
char *my_strtok(char *str, const char *delim) {
static char *saved_str = NULL;
char *start = NULL;
char *end = NULL;
}
void parsePaths(const char *input, char source_path[][PATH_MAX], char redirect_path[][PATH_MAX], int *line_count) {
char *temp = my_strdup(input);
char *line = my_strtok(temp, "\n");
*line_count = 0;
}
//static long mod_control0(const char *args, char *__user out_msg, int outlen) {
pr_info("[yuuki] kpm hello control0, args: %s\n", args);
}
我都没有使用到memset这个函数,但是加载失败提示unknown symbol: memset
我尝试使用void *(*kf_memset)(void *s, int c, size_t count) = NULL;
kf_memset = (typeof(kf_memset))kallsyms_lookup_name("memset");依然会报这个错误,请问大佬们这个问题如何解决
The text was updated successfully, but these errors were encountered: