ANDROID: vendor_hooks: Add hook for fsnotify

Add hook for fsnotify when file open with write mode.

- android_vh_fsnotify_open

Bug: 350651631
Change-Id: Ibeada7ce1d5a4a78c49b9a255b1e3a436029b631
Signed-off-by: huzhanyuan  <huzhanyuan@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
This commit is contained in:
huzhanyuan
2024-07-02 17:19:21 +08:00
committed by Carlos Llamas
parent 281259f26a
commit aaae5b9d62
3 changed files with 29 additions and 0 deletions
+2
View File
@@ -69,6 +69,7 @@
#include <trace/hooks/madvise.h>
#include <trace/events/android_vendor_lmk.h>
#include <trace/hooks/blk.h>
#include <trace/hooks/fsnotify.h>
/*
* 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);
+4
View File
@@ -17,6 +17,9 @@
#include <linux/slab.h>
#include <linux/bug.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/fsnotify.h>
/* 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);
}
+23
View File
@@ -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 <trace/hooks/vendor_hooks.h>
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 <trace/define_trace.h>