From c0199c01548ffb732c682fc9fbbd63f8b763743f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 21 Jun 2022 18:29:35 +0200 Subject: [PATCH] Revert "ANDROID: module: Add vendor hook" This reverts commit 5ebe1623067b7f948ce63bd82bc09de14d358c01. It causes lots of conflicts in the 5.19-rc1 merge due to the rewrite and movement of the module core code. If this is still needed, it can be added back later. Bug: 181639260 Cc: Kuan-Ying Lee Signed-off-by: Greg Kroah-Hartman Change-Id: I742e7ef56c2dd7a9b6c9c296dc9f96bced84bc7c --- drivers/android/vendor_hooks.c | 6 ------ include/trace/hooks/memory.h | 23 ----------------------- include/trace/hooks/module.h | 24 ------------------------ kernel/module.c | 26 -------------------------- 4 files changed, 79 deletions(-) delete mode 100644 include/trace/hooks/memory.h delete mode 100644 include/trace/hooks/module.h diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 63826529b032..6ba0232e97f5 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -33,8 +33,6 @@ #include #include #include -#include -#include #include #include @@ -148,10 +146,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_commit_creds); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_exit_creds); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_override_creds); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_revert_creds); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_memory_nx); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_memory_rw); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_module_permit_before_init); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_module_permit_after_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_is_initialized); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open); diff --git a/include/trace/hooks/memory.h b/include/trace/hooks/memory.h deleted file mode 100644 index d7dbfdeacd4d..000000000000 --- a/include/trace/hooks/memory.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#undef TRACE_SYSTEM -#define TRACE_SYSTEM memory - -#define TRACE_INCLUDE_PATH trace/hooks -#if !defined(_TRACE_HOOK_MEMORY_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_HOOK_MEMORY_H -#include -/* - * Following tracepoints are not exported in tracefs and provide a - * mechanism for vendor modules to hook and extend functionality - */ -DECLARE_HOOK(android_vh_set_memory_nx, - TP_PROTO(unsigned long addr, int nr_pages), - TP_ARGS(addr, nr_pages)); - -DECLARE_HOOK(android_vh_set_memory_rw, - TP_PROTO(unsigned long addr, int nr_pages), - TP_ARGS(addr, nr_pages)); - -#endif /* _TRACE_HOOK_MEMORY_H */ -/* This part must be outside protection */ -#include diff --git a/include/trace/hooks/module.h b/include/trace/hooks/module.h deleted file mode 100644 index 78b49869ca65..000000000000 --- a/include/trace/hooks/module.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#undef TRACE_SYSTEM -#define TRACE_SYSTEM module - -#define TRACE_INCLUDE_PATH trace/hooks -#if !defined(_TRACE_HOOK_MODULE_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_HOOK_MODULE_H -#include -/* - * Following tracepoints are not exported in tracefs and provide a - * mechanism for vendor modules to hook and extend functionality - */ -struct module; -DECLARE_HOOK(android_vh_set_module_permit_before_init, - TP_PROTO(const struct module *mod), - TP_ARGS(mod)); - -DECLARE_HOOK(android_vh_set_module_permit_after_init, - TP_PROTO(const struct module *mod), - TP_ARGS(mod)); - -#endif /* _TRACE_HOOK_MODULE_H */ -/* This part must be outside protection */ -#include diff --git a/kernel/module.c b/kernel/module.c index 9d925d60026f..358e2eece5e1 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -63,10 +63,6 @@ #define CREATE_TRACE_POINTS #include -#undef CREATE_TRACE_POINTS -#include -#include - #ifndef ARCH_SHF_SMALL #define ARCH_SHF_SMALL 0 #endif @@ -2195,10 +2191,6 @@ static void free_module(struct module *mod) /* This may be empty, but that's OK */ module_arch_freeing_init(mod); - trace_android_vh_set_memory_rw((unsigned long)mod->init_layout.base, - (mod->init_layout.size)>>PAGE_SHIFT); - trace_android_vh_set_memory_nx((unsigned long)mod->init_layout.base, - (mod->init_layout.size)>>PAGE_SHIFT); module_memfree(mod->init_layout.base); kfree(mod->args); percpu_modfree(mod); @@ -2207,10 +2199,6 @@ static void free_module(struct module *mod) lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size); /* Finally, free the core (containing the module structure) */ - trace_android_vh_set_memory_rw((unsigned long)mod->core_layout.base, - (mod->core_layout.size)>>PAGE_SHIFT); - trace_android_vh_set_memory_nx((unsigned long)mod->core_layout.base, - (mod->core_layout.size)>>PAGE_SHIFT); module_memfree(mod->core_layout.base); } @@ -3654,15 +3642,7 @@ static void module_deallocate(struct module *mod, struct load_info *info) { percpu_modfree(mod); module_arch_freeing_init(mod); - trace_android_vh_set_memory_rw((unsigned long)mod->init_layout.base, - (mod->init_layout.size)>>PAGE_SHIFT); - trace_android_vh_set_memory_nx((unsigned long)mod->init_layout.base, - (mod->init_layout.size)>>PAGE_SHIFT); module_memfree(mod->init_layout.base); - trace_android_vh_set_memory_rw((unsigned long)mod->core_layout.base, - (mod->core_layout.size)>>PAGE_SHIFT); - trace_android_vh_set_memory_nx((unsigned long)mod->core_layout.base, - (mod->core_layout.size)>>PAGE_SHIFT); module_memfree(mod->core_layout.base); } @@ -3805,13 +3785,8 @@ static noinline int do_init_module(struct module *mod) rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms); #endif module_enable_ro(mod, true); - trace_android_vh_set_module_permit_after_init(mod); mod_tree_remove_init(mod); module_arch_freeing_init(mod); - trace_android_vh_set_memory_rw((unsigned long)mod->init_layout.base, - (mod->init_layout.size)>>PAGE_SHIFT); - trace_android_vh_set_memory_nx((unsigned long)mod->init_layout.base, - (mod->init_layout.size)>>PAGE_SHIFT); mod->init_layout.base = NULL; mod->init_layout.size = 0; mod->init_layout.ro_size = 0; @@ -3922,7 +3897,6 @@ static int complete_formation(struct module *mod, struct load_info *info) module_enable_ro(mod, false); module_enable_nx(mod); module_enable_x(mod); - trace_android_vh_set_module_permit_before_init(mod); /* * Mark state as coming so strong_try_module_get() ignores us,