[DTrace-devel] [PATCH 7/7] tests: filter-out spurious references to bpf module symbols from kallmodsyms
eugene.loh at oracle.com
eugene.loh at oracle.com
Fri Aug 14 10:43:24 PDT 2020
From: David Mc Lean <david.mclean at oracle.com>
We see references to symbols assigned to a "bpf" module in
/proc/kallmodsyms. We filter these references out in a few tests and in
libdtrace/dt_module.c.
The tests which were failing before the changes here include:
test/unittest/aggs/tst.aggmod_full.sh
test/unittest/aggs/tst.aggmod_full2.sh
test/unittest/consumer/tst.merge_ranges_bug25767469.c
test/unittest/consumer/tst.symbols.c
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Signed-off-by: David Mc Lean <david.mclean at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
---
libdtrace/dt_module.c | 3 +++
test/unittest/aggs/tst.aggmod_full.sh | 1 +
test/unittest/aggs/tst.aggmod_full2.sh | 4 ++++
test/unittest/consumer/tst.symbols.c | 2 ++
4 files changed, 10 insertions(+)
diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
index 8e50a315..8af3695d 100644
--- a/libdtrace/dt_module.c
+++ b/libdtrace/dt_module.c
@@ -1123,6 +1123,9 @@ dt_modsym_update(dtrace_hdl_t *dtp, const char *line, int flag)
|| (sym_type == 'w') || (sym_type == 'W');
mod_name[strlen(mod_name)-1] = '\0'; /* chop trailing ] */
+ if (strcmp(mod_name, "bpf") == 0)
+ return 0;
+
/*
* Symbols of "absolute" type are typically defined per CPU.
* Their "addresses" here are very low and are actually offsets.
diff --git a/test/unittest/aggs/tst.aggmod_full.sh b/test/unittest/aggs/tst.aggmod_full.sh
index 22b6f670..b876d736 100755
--- a/test/unittest/aggs/tst.aggmod_full.sh
+++ b/test/unittest/aggs/tst.aggmod_full.sh
@@ -86,6 +86,7 @@ NF == 4 && $4 == "__init_scratch_begin" {
NF == 4 {$5 = "[vmlinux]"};
$3 == "a" {$2 = 0};
$3 == "A" {$2 = 0};
+$5 == "[bpf]" {$2 = 0};
$2 != 0 { print $1 >> $5 }
' /proc/kallmodsyms
diff --git a/test/unittest/aggs/tst.aggmod_full2.sh b/test/unittest/aggs/tst.aggmod_full2.sh
index 0472facc..e2716a09 100755
--- a/test/unittest/aggs/tst.aggmod_full2.sh
+++ b/test/unittest/aggs/tst.aggmod_full2.sh
@@ -43,6 +43,7 @@ cat > test.c << EOF
#include <string.h>
#include <unistd.h>
#include <linux/limits.h>
+#include <time.h>
#include "prov.h"
/*
@@ -92,6 +93,9 @@ int main(int argc, char **argv) {
if (size == 0)
continue;
+ if (strcmp(modname, "bpf]") == 0)
+ continue;
+
/* trim the trailing ']' and print modname to stdout */
modname[strlen(modname)-1] = '\0';
printf("%s\n", modname);
diff --git a/test/unittest/consumer/tst.symbols.c b/test/unittest/consumer/tst.symbols.c
index 24d16d1f..66f044a3 100644
--- a/test/unittest/consumer/tst.symbols.c
+++ b/test/unittest/consumer/tst.symbols.c
@@ -107,6 +107,8 @@ int read_symbols() {
continue;
}
#undef KERNEL_FLAG_INIT_SCRATCH
+ if (strcmp(modname, "bpf]") == 0)
+ continue;
/*
* In libdtrace/dt_module.c function dt_modsym_update(),
--
2.18.4
More information about the DTrace-devel
mailing list