From b694513fabc211b72aafdeb151ff539a71534b32 Mon Sep 17 00:00:00 2001 From: Rafael David Tinoco Date: Mon, 13 Jun 2022 18:20:06 -0300 Subject: [PATCH] libbpfgo: mitigate tc error messages This is a workaround for the following issue: $ sudo ./dist/tracee-ebpf -o format:json -o option:parse-arguments -o option:detect-syscall -trace comm=bash -trace follow -trace event=net_packet -trace net=docker0 -capture net=docker0 libbpf: Kernel error message: Exclusivity flag on, cannot modify libbpf: Kernel error message: Exclusivity flag on, cannot modify Discussed at https://www.spinics.net/lists/bpf/msg44842.html without conclusions. --- libbpfgo.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libbpfgo.go b/libbpfgo.go index 7bd15395..fb0ec118 100644 --- a/libbpfgo.go +++ b/libbpfgo.go @@ -36,6 +36,16 @@ int libbpf_print_fn(enum libbpf_print_level level, const char *format, if (level != LIBBPF_WARN) return 0; + // BUG: https://github.com/aquasecurity/tracee/issues/1676 + + va_list check; va_copy(check, args); + char *str = va_arg(check, char *); + if (strstr(str, "Exclusivity flag on") != NULL) { + va_end(check); + return 0; + } + va_end(check); + return vfprintf(stderr, format, args); }