From f9c728aecc319b47bba68d703d4fb1a0c0fe35fa Mon Sep 17 00:00:00 2001 From: bmax Date: Wed, 3 Jan 2024 22:26:02 +0800 Subject: [PATCH] kptools: add more suffixed_symbol --- tools/kptools.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/kptools.c b/tools/kptools.c index 4a67dbb8..15b12099 100644 --- a/tools/kptools.c +++ b/tools/kptools.c @@ -191,7 +191,9 @@ static int fillin_patch_symbol(kallsym_t *kallsym, char *img_buf, patch_symbol_t symbol->do_execveat_common = get_symbol_offset_zero(kallsym, img_buf, "do_execveat_common"); symbol->do_execve_common = get_symbol_offset_zero(kallsym, img_buf, "do_execve_common"); if (!symbol->__do_execve_file && !symbol->do_execveat_common && !symbol->do_execve_common) { - symbol->do_execveat_common = find_suffixed_symbol(kallsym, img_buf, "do_execve_common"); + symbol->__do_execve_file = find_suffixed_symbol(kallsym, img_buf, "__do_execve_file"); + symbol->do_execveat_common = find_suffixed_symbol(kallsym, img_buf, "do_execveat_common"); + symbol->do_execve_common = find_suffixed_symbol(kallsym, img_buf, "do_execve_common"); } if (!symbol->__do_execve_file && !symbol->do_execveat_common && !symbol->do_execve_common) return -1; @@ -208,10 +210,19 @@ static int fillin_patch_symbol(kallsym_t *kallsym, char *img_buf, patch_symbol_t symbol->vfs_statx = get_symbol_offset_zero(kallsym, img_buf, "vfs_statx"); symbol->do_statx = get_symbol_offset_zero(kallsym, img_buf, "do_statx"); symbol->vfs_fstatat = get_symbol_offset_zero(kallsym, img_buf, "vfs_fstatat"); + if (!symbol->vfs_statx && !symbol->do_statx && !symbol->vfs_fstatat) { + symbol->vfs_statx = find_suffixed_symbol(kallsym, img_buf, "vfs_statx"); + symbol->do_statx = find_suffixed_symbol(kallsym, img_buf, "do_statx"); + symbol->vfs_fstatat = find_suffixed_symbol(kallsym, img_buf, "vfs_fstatat"); + } if (!symbol->vfs_statx && !symbol->do_statx && !symbol->vfs_fstatat) return -1; symbol->do_faccessat = get_symbol_offset_zero(kallsym, img_buf, "do_faccessat"); symbol->sys_faccessat = get_symbol_offset_zero(kallsym, img_buf, "sys_faccessat"); + if (!symbol->do_faccessat && !symbol->sys_faccessat) { + symbol->do_faccessat = find_suffixed_symbol(kallsym, img_buf, "do_faccessat"); + symbol->sys_faccessat = find_suffixed_symbol(kallsym, img_buf, "sys_faccessat"); + } if (!symbol->do_faccessat && !symbol->sys_faccessat) return -1; if ((is_be() ^ target_is_be)) {