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

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