ANDROID: vendor_hooks: Add hook in mmap_region()

Add hook in mmap_region() to record the vma and address information
of monitored processes.

Bug: 198385827
Change-Id: I0bde29113b47ca7f4a9f5d42a54188e791ca3b7e
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
(cherry picked from commit 73c9d4a9d575107b90a6d9f415fa56f963264d06)
This commit is contained in:
Jiewen Wang
2021-09-06 16:50:35 +08:00
committed by Treehugger Robot
parent b165e16c2e
commit 1a6d07106c
3 changed files with 8 additions and 0 deletions

View File

@@ -552,3 +552,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_anonymous_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_uprobes_replace_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swap_writepage);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region);

View File

@@ -516,6 +516,9 @@ DECLARE_HOOK(android_vh_shmem_swapin_folio,
DECLARE_HOOK(android_vh_swap_writepage,
TP_PROTO(unsigned long *sis_flags, struct page *page),
TP_ARGS(sis_flags, page));
DECLARE_HOOK(android_vh_mmap_region,
TP_PROTO(struct vm_area_struct *vma, unsigned long addr),
TP_ARGS(vma, addr));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View File

@@ -57,6 +57,8 @@
#define CREATE_TRACE_POINTS
#include <trace/events/mmap.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/mm.h>
#include "internal.h"
@@ -1580,6 +1582,8 @@ expanded:
vma_set_page_prot(vma);
trace_android_vh_mmap_region(vma, addr);
return addr;
unmap_and_free_file_vma: