From: Frank Ch. Eigler Date: Mon, 1 Nov 2021 14:08:13 +0000 (-0400) Subject: runtime: port to kernel 5.15-rc X-Git-Tag: release-4.6~19 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=a0ecbdf1fce79af43626074f46cbd8479f40a39c;p=systemtap.git runtime: port to kernel 5.15-rc get_mm_exe_file got unexported. Deal with it the usual way. --- diff --git a/buildrun.cxx b/buildrun.cxx index 086ecca61..2a18fe3b7 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -370,7 +370,7 @@ compile_pass (systemtap_session& s) output_exportconf(s, o2, "synchronize_sched", "STAPCONF_SYNCHRONIZE_SCHED"); output_autoconf(s, o, cs, "autoconf-task-uid.c", "STAPCONF_TASK_UID", NULL); output_autoconf(s, o, cs, "autoconf-from_kuid_munged.c", "STAPCONF_FROM_KUID_MUNGED", NULL); - output_exportconf(s, o2, "get_mm_exe_file", "STAPCONF_GET_MM_EXE_FILE"); + output_exportconf(s, o2, "get_mm_exe_file", "STAPCONF_GET_MM_EXE_FILE_EXPORTED"); output_dual_exportconf(s, o2, "alloc_vm_area", "free_vm_area", "STAPCONF_VM_AREA"); output_autoconf(s, o, cs, "autoconf-procfs-owner.c", "STAPCONF_PROCFS_OWNER", NULL); output_autoconf(s, o, cs, "autoconf-alloc-percpu-align.c", "STAPCONF_ALLOC_PERCPU_ALIGN", NULL); diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h index 880c1fa4a..77291f092 100644 --- a/runtime/linux/runtime.h +++ b/runtime/linux/runtime.h @@ -255,6 +255,9 @@ static void *kallsyms_signal_wake_up; #if !defined(STAPCONF___LOCK_TASK_SIGHAND_EXPORTED) static void *kallsyms___lock_task_sighand; #endif +#if !defined(STAPCONF_GET_MM_EXE_FILE_EXPORTED) +static void *kallsyms_get_mm_exe_file; +#endif #include "access_process_vm.h" #include "loc2c-runtime.h" diff --git a/runtime/task_finder_vma.c b/runtime/task_finder_vma.c index 81a96c7cf..134df8c50 100644 --- a/runtime/task_finder_vma.c +++ b/runtime/task_finder_vma.c @@ -420,8 +420,14 @@ stap_find_exe_file(struct mm_struct* mm) // still use our own code. The original get_mm_exe_file() can // sleep (since it calls down_read()), so we'll have to roll // our own. -#if defined(STAPCONF_DPATH_PATH) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)) +#if defined(STAPCONF_GET_MM_EXE_FILE_EXPORTED) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)) return get_mm_exe_file(mm); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)) + typedef typeof(&get_mm_exe_file) get_mm_exe_file_fn; + if (kallsyms_get_mm_exe_file == NULL) + return NULL; /* can't happen; _stp_handle_start would abort before this point */ + else + return (* (get_mm_exe_file_fn) kallsyms_get_mm_exe_file)(mm); #else struct file *exe_file = NULL; diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index 9b9d6cbe2..3e128c92c 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -363,6 +363,13 @@ static int _stp_handle_kallsyms_lookups(void) goto err0; } #endif +#if !defined(STAPCONF_GET_MM_EXE_FILE_EXPORTED) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)) + kallsyms_get_mm_exe_file = (void*) kallsyms_lookup_name ("get_mm_exe_file"); + if (kallsyms_get_mm_exe_file == NULL) { + _stp_error("Can't resolve get_mm_exe_file!"); + goto err0; + } +#endif #endif #if defined(CONFIG_KALLSYMS) && !defined(STAPCONF_KALLSYMS_LOOKUP_NAME_EXPORTED) {