Blame SOURCES/bcc-0.16.0-tools-include-kasan-header-in-slabtoprate.patch

61e0c9
From 33393d3008969e43d26f0e4b3e71198130f9f44d Mon Sep 17 00:00:00 2001
61e0c9
From: Jerome Marchand <jmarchan@redhat.com>
61e0c9
Date: Thu, 18 Feb 2021 11:33:20 +0100
61e0c9
Subject: [PATCH] tools: include kasan header in slabtoprate
61e0c9
61e0c9
slabtoprate fails on 5.10 kernels because of a missing kasan_reset_tag
61e0c9
declaration. We need to include the kasan header file.
61e0c9
61e0c9
Fixes the following error:
61e0c9
In file included from /virtual/main.c:12:
61e0c9
include/linux/slub_def.h:181:27: warning: implicit declaration of function 'kasan_reset_tag' is invalid in C99 [-Wimplicit-function-declaration]
61e0c9
        return reciprocal_divide(kasan_reset_tag(obj) - addr,
61e0c9
                                 ^
61e0c9
include/linux/slub_def.h:181:48: error: invalid operands to binary expression ('int' and 'void *')
61e0c9
        return reciprocal_divide(kasan_reset_tag(obj) - addr,
61e0c9
                                 ~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
61e0c9
1 warning and 1 error generated.
61e0c9
Traceback (most recent call last):
61e0c9
  File "/usr/share/bcc/tools/slabratetop", line 115, in <module>
61e0c9
    b = BPF(text=bpf_text)
61e0c9
  File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 364, in __init__
61e0c9
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
61e0c9
Exception: Failed to compile BPF module <text>
61e0c9
---
61e0c9
 tools/slabratetop.py | 1 +
61e0c9
 1 file changed, 1 insertion(+)
61e0c9
61e0c9
diff --git a/tools/slabratetop.py b/tools/slabratetop.py
61e0c9
index 182dbd1d..75280c6d 100755
61e0c9
--- a/tools/slabratetop.py
61e0c9
+++ b/tools/slabratetop.py
61e0c9
@@ -62,6 +62,7 @@ loadavg = "/proc/loadavg"
61e0c9
 bpf_text = """
61e0c9
 #include <uapi/linux/ptrace.h>
61e0c9
 #include <linux/mm.h>
61e0c9
+#include <linux/kasan.h>
61e0c9
 
61e0c9
 // memcg_cache_params is a part of kmem_cache, but is not publicly exposed in
61e0c9
 // kernel versions 5.4 to 5.8.  Define an empty struct for it here to allow the
61e0c9
-- 
61e0c9
2.29.2
61e0c9