diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 39f651ca61c7..f7af28d625bd 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -69,6 +69,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -466,3 +467,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_pages_reclaim_cycle_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_bd_link_disk_holder); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_fsnotify_open); diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 9161264db36c..712f285d7bb7 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -17,6 +17,9 @@ #include #include +#undef CREATE_TRACE_POINTS +#include + /* Are there any inode/mount/sb objects watched with priority prio or above? */ static inline bool fsnotify_sb_has_priority_watchers(struct super_block *sb, int prio) @@ -423,6 +426,7 @@ static inline void fsnotify_open(struct file *file) if (file->f_flags & __FMODE_EXEC) mask |= FS_OPEN_EXEC; + trace_android_vh_fsnotify_open(file, &mask); fsnotify_file(file, mask); } diff --git a/include/trace/hooks/fsnotify.h b/include/trace/hooks/fsnotify.h new file mode 100644 index 000000000000..2909261c3358 --- /dev/null +++ b/include/trace/hooks/fsnotify.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fsnotify + +#ifdef CREATE_TRACE_POINTS +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH trace/hooks +#define UNDEF_TRACE_INCLUDE_PATH +#endif + +#if !defined(_TRACE_HOOK_FSNOTIFY_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_FSNOTIFY_H + +#include + +DECLARE_HOOK(android_vh_fsnotify_open, + TP_PROTO(struct file *file, __u32 *mask), + TP_ARGS(file, mask)); + +#endif /* _TRACE_HOOK_FSNOTIFY_H */ + +/* This part must be outside protection */ +#include