ANDROID: syscall_check: add vendor hook for open syscall

Through this vendor hook, we can get the timing to check
current running task for the validation of its credential
and open operation.

Bug: 191291287

Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Change-Id: Ia644ceb02dbc230ee1d25cad3630c2c3f908e41a
This commit is contained in:
Kuan-Ying Lee
2021-06-18 13:28:11 +08:00
committed by Todd Kjos
parent a5543c9cd7
commit a7a3b31d58
3 changed files with 7 additions and 0 deletions

View File

@@ -348,3 +348,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptype_head);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kfree_skb);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open);

View File

@@ -34,6 +34,7 @@
#include <linux/compat.h>
#include "internal.h"
#include <trace/hooks/syscall_check.h>
int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
struct file *filp)
@@ -800,6 +801,7 @@ static int do_dentry_open(struct file *f,
error = -ENODEV;
goto cleanup_all;
}
trace_android_vh_check_file_open(f);
error = security_file_open(f);
if (error)

View File

@@ -17,6 +17,10 @@ DECLARE_HOOK(android_vh_check_mmap_file,
unsigned long flag, unsigned long ret),
TP_ARGS(file, prot, flag, ret));
DECLARE_HOOK(android_vh_check_file_open,
TP_PROTO(const struct file *file),
TP_ARGS(file));
#endif /* _TRACE_HOOK_SYSCALL_CHECK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>