diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 85f0b87216c9..272870bf20cd 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -53,6 +53,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -259,3 +260,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_enqueue_task_fair); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dequeue_task_fair); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_prepare_update_load_avg_se); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_finish_update_load_avg_se); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_selinux_is_initialized); diff --git a/include/trace/hooks/selinux.h b/include/trace/hooks/selinux.h new file mode 100644 index 000000000000..2ad6484d2c55 --- /dev/null +++ b/include/trace/hooks/selinux.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM selinux + +#define TRACE_INCLUDE_PATH trace/hooks +#if !defined(_TRACE_HOOK_SELINUX_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_SELINUX_H +#include +#include +/* + * Following tracepoints are not exported in tracefs and provide a + * mechanism for vendor modules to hook and extend functionality + */ +struct selinux_state; +DECLARE_HOOK(android_vh_selinux_is_initialized, + TP_PROTO(const struct selinux_state *state), + TP_ARGS(state)); + +#endif /* _TRACE_HOOK_SELINUX_H */ +/* This part must be outside protection */ +#include diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 5d9b9d5daf6c..b70abc68aa19 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -66,6 +66,8 @@ #include "audit.h" #include "policycap_names.h" +#include + struct convert_context_args { struct selinux_state *state; struct policydb *oldp; @@ -2253,6 +2255,7 @@ void selinux_policy_commit(struct selinux_state *state, */ selinux_mark_initialized(state); selinux_complete_init(); + trace_android_vh_selinux_is_initialized(state); } /* Free the old policy */