x86, mpx: trace attempts to find bounds tables
This event traces any time we go looking to unmap a bounds table
for a given virtual address range. This is useful to ensure
that the kernel actually "tried" to free a bounds table versus
times it succeeded.
It might try and fail if it realized that a table was shared
with an adjacent VMA which is not being unmapped.
diff --git a/arch/x86/include/asm/trace/mpx.h b/arch/x86/include/asm/trace/mpx.h
index ae1ee73..dcc24f5 100644
--- a/arch/x86/include/asm/trace/mpx.h
+++ b/arch/x86/include/asm/trace/mpx.h
@@ -84,6 +84,28 @@
)
);
+TRACE_EVENT(mpx_unmap_search,
+
+ TP_PROTO(unsigned long start,
+ unsigned long end),
+ TP_ARGS(start, end),
+
+ TP_STRUCT__entry(
+ __field(unsigned long, start)
+ __field(unsigned long, end)
+ ),
+
+ TP_fast_assign(
+ __entry->start = start;
+ __entry->end = end;
+ ),
+
+ TP_printk("0x%llx -> 0x%llx",
+ (u64)__entry->start,
+ (u64)__entry->end
+ )
+);
+
#endif /* CONFIG_X86_INTEL_MPX */
#undef TRACE_INCLUDE_PATH
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
index e14257b..3b0b5e6 100644
--- a/arch/x86/mm/mpx.c
+++ b/arch/x86/mm/mpx.c
@@ -1004,6 +1004,7 @@
long __user *bd_entry, *bde_start, *bde_end;
unsigned long bt_addr;
+ trace_mpx_unmap_search(start, end);
/*
* "Edge" bounds tables are those which are being used by the region
* (start -> end), but that may be shared with adjacent areas. If they