From d254d610d85e0688f3c6624cac152ee3896bdd1d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 18 May 2021 02:42:33 -0400 Subject: [PATCH] import bcc-0.16.0-3.el8 --- .bcc.metadata | 2 +- ...BUILD_MODNAME-flag-to-default-cflags.patch | 24 --- ...-existing-kbuild_modname-definitions.patch | 184 ------------------ ...-0.14.0-Fix-KFUNC_PROBE-return-value.patch | 92 --------- ...mpolines-for-archs-other-than-x86_64.patch | 47 ----- ...-more-explicit-message-when-pthread_.patch | 28 --- ...o-install-the-right-kernel-devel-pac.patch | 33 ---- ...xistent-x-argument-from-tcpconnect-m.patch | 28 --- ...on-3-map-issue-in-dbstat-and-dbslowe.patch | 49 ----- ...ls-opensnoop-Fix-compilation-problem.patch | 31 --- ...-Manpages-remove-unstable-statement.patch} | 94 +++++---- ...op-Add-memcg_cache_params-struct-def.patch | 39 ++++ .../bcc-0.16.0-sync-with-libbpf-repo.patch | 121 ++++++++++++ ...-include-kasan-header-in-slabtoprate.patch | 42 ++++ ...r-fix-alignement-in-tcp_ipv6_event_t.patch | 46 +++++ SPECS/bcc.spec | 59 ++++-- 16 files changed, 349 insertions(+), 570 deletions(-) delete mode 100644 SOURCES/bcc-0.14.0-Add-KBUILD_MODNAME-flag-to-default-cflags.patch delete mode 100644 SOURCES/bcc-0.14.0-Delete-existing-kbuild_modname-definitions.patch delete mode 100644 SOURCES/bcc-0.14.0-Fix-KFUNC_PROBE-return-value.patch delete mode 100644 SOURCES/bcc-0.14.0-Forbid-trampolines-for-archs-other-than-x86_64.patch delete mode 100644 SOURCES/bcc-0.14.0-deadlock-print-a-more-explicit-message-when-pthread_.patch delete mode 100644 SOURCES/bcc-0.14.0-loader-suggest-to-install-the-right-kernel-devel-pac.patch delete mode 100644 SOURCES/bcc-0.14.0-man-remove-non-existent-x-argument-from-tcpconnect-m.patch delete mode 100644 SOURCES/bcc-0.14.0-tools-fix-a-python-3-map-issue-in-dbstat-and-dbslowe.patch delete mode 100644 SOURCES/bcc-0.14.0-tools-opensnoop-Fix-compilation-problem.patch rename SOURCES/{bcc-0.14.0-Manpages-remove-unstable-statement.patch => bcc-0.16.0-Manpages-remove-unstable-statement.patch} (94%) create mode 100644 SOURCES/bcc-0.16.0-slabratetop-Add-memcg_cache_params-struct-def.patch create mode 100644 SOURCES/bcc-0.16.0-sync-with-libbpf-repo.patch create mode 100644 SOURCES/bcc-0.16.0-tools-include-kasan-header-in-slabtoprate.patch create mode 100644 SOURCES/bcc-0.16.0-tools-tcptracer-fix-alignement-in-tcp_ipv6_event_t.patch diff --git a/.bcc.metadata b/.bcc.metadata index c84dac0..21fd784 100644 --- a/.bcc.metadata +++ b/.bcc.metadata @@ -1 +1 @@ -a94aa5005d66f17284f2244ff2018821f35ff4df SOURCES/bcc-src-with-submodule.tar.gz +ae5102ef4109f8af03c7282c1f9f2c3201c3a400 SOURCES/bcc-src-with-submodule.tar.gz diff --git a/SOURCES/bcc-0.14.0-Add-KBUILD_MODNAME-flag-to-default-cflags.patch b/SOURCES/bcc-0.14.0-Add-KBUILD_MODNAME-flag-to-default-cflags.patch deleted file mode 100644 index 90f4ee4..0000000 --- a/SOURCES/bcc-0.14.0-Add-KBUILD_MODNAME-flag-to-default-cflags.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 68abb51ed067c4317b991cec0bbc2ea4e7f6ddab Mon Sep 17 00:00:00 2001 -From: William Findlay -Date: Wed, 17 Jun 2020 12:07:48 -0400 -Subject: [PATCH] Add KBUILD_MODNAME flag to default cflags - ---- - src/cc/frontends/clang/kbuild_helper.cc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc -index db5ca7f6..e3aade89 100644 ---- a/src/cc/frontends/clang/kbuild_helper.cc -+++ b/src/cc/frontends/clang/kbuild_helper.cc -@@ -101,6 +101,7 @@ int KBuildHelper::get_flags(const char *uname_machine, vector *cflags) { - cflags->push_back("-D__HAVE_BUILTIN_BSWAP16__"); - cflags->push_back("-D__HAVE_BUILTIN_BSWAP32__"); - cflags->push_back("-D__HAVE_BUILTIN_BSWAP64__"); -+ cflags->push_back("-DKBUILD_MODNAME=\"bcc\""); - - // If ARCH env variable is set, pass this along. - if (archenv) --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-Delete-existing-kbuild_modname-definitions.patch b/SOURCES/bcc-0.14.0-Delete-existing-kbuild_modname-definitions.patch deleted file mode 100644 index 1a851df..0000000 --- a/SOURCES/bcc-0.14.0-Delete-existing-kbuild_modname-definitions.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 8999b2f610e84a2413dbea1717fe6e2ebcd1eea0 Mon Sep 17 00:00:00 2001 -From: William Findlay -Date: Wed, 17 Jun 2020 18:59:43 -0400 -Subject: [PATCH] Delete existing kbuild_modname definitions - ---- - examples/networking/xdp/xdp_drop_count.py | 1 - - examples/networking/xdp/xdp_macswap_count.py | 1 - - examples/networking/xdp/xdp_redirect_cpu.py | 1 - - examples/networking/xdp/xdp_redirect_map.py | 1 - - examples/tracing/nflatency.py | 1 - - tests/python/test_clang.py | 8 -------- - tools/tcplife.lua | 1 - - tools/tcplife.py | 1 - - tools/tcpstates.py | 1 - - 9 files changed, 16 deletions(-) - -diff --git a/examples/networking/xdp/xdp_drop_count.py b/examples/networking/xdp/xdp_drop_count.py -index f03273e9..512e0a20 100755 ---- a/examples/networking/xdp/xdp_drop_count.py -+++ b/examples/networking/xdp/xdp_drop_count.py -@@ -52,7 +52,6 @@ mode = BPF.XDP - - # load BPF program - b = BPF(text = """ --#define KBUILD_MODNAME "foo" - #include - #include - #include -diff --git a/examples/networking/xdp/xdp_macswap_count.py b/examples/networking/xdp/xdp_macswap_count.py -index 0e2b21ca..770ce8ca 100755 ---- a/examples/networking/xdp/xdp_macswap_count.py -+++ b/examples/networking/xdp/xdp_macswap_count.py -@@ -50,7 +50,6 @@ mode = BPF.XDP - - # load BPF program - b = BPF(text = """ --#define KBUILD_MODNAME "foo" - #include - #include - #include -diff --git a/examples/networking/xdp/xdp_redirect_cpu.py b/examples/networking/xdp/xdp_redirect_cpu.py -index 15b0d09b..470079f4 100755 ---- a/examples/networking/xdp/xdp_redirect_cpu.py -+++ b/examples/networking/xdp/xdp_redirect_cpu.py -@@ -30,7 +30,6 @@ max_cpu = cpu_count() - - # load BPF program - b = BPF(text = """ --#define KBUILD_MODNAME "foo" - #include - #include - #include -diff --git a/examples/networking/xdp/xdp_redirect_map.py b/examples/networking/xdp/xdp_redirect_map.py -index 4a622723..4936ac1e 100755 ---- a/examples/networking/xdp/xdp_redirect_map.py -+++ b/examples/networking/xdp/xdp_redirect_map.py -@@ -29,7 +29,6 @@ out_idx = ip.link_lookup(ifname=out_if)[0] - - # load BPF program - b = BPF(text = """ --#define KBUILD_MODNAME "foo" - #include - #include - #include -diff --git a/examples/tracing/nflatency.py b/examples/tracing/nflatency.py -index 76716490..c201930a 100755 ---- a/examples/tracing/nflatency.py -+++ b/examples/tracing/nflatency.py -@@ -12,7 +12,6 @@ import time - from bcc import BPF - - BPF_SRC = """ --#define KBUILD_MODNAME "bpf_hook_nflatency" - #include - #include - #include -diff --git a/tests/python/test_clang.py b/tests/python/test_clang.py -index 886eebed..648494cf 100755 ---- a/tests/python/test_clang.py -+++ b/tests/python/test_clang.py -@@ -78,7 +78,6 @@ int count_foo(struct pt_regs *ctx, unsigned long a, unsigned long b) { - - def test_probe_read3(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;}) - int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) { -@@ -90,7 +89,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) { - - def test_probe_read4(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;}) - int test(struct pt_regs *ctx, struct sk_buff *skb) { -@@ -102,7 +100,6 @@ int test(struct pt_regs *ctx, struct sk_buff *skb) { - - def test_probe_read_whitelist1(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) { - // The below define is in net/tcp.h: -@@ -120,7 +117,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) { - - def test_probe_read_whitelist2(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) { - // The below define is in net/tcp.h: -@@ -1072,7 +1068,6 @@ int test(struct __sk_buff *ctx) { - - def test_probe_read_return(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - #include - static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) { -@@ -1088,7 +1083,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) { - - def test_probe_read_multiple_return(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - #include - static inline u64 error_function() { -@@ -1109,7 +1103,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) { - - def test_probe_read_return_expr(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - #include - static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) { -@@ -1125,7 +1118,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) { - - def test_probe_read_return_call(self): - text = """ --#define KBUILD_MODNAME "foo" - #include - #include - static inline struct tcphdr *my_skb_transport_header(struct sk_buff *skb) { -diff --git a/tools/tcplife.lua b/tools/tcplife.lua -index 3f4f6afd..5e311631 100755 ---- a/tools/tcplife.lua -+++ b/tools/tcplife.lua -@@ -25,7 +25,6 @@ uint16_t ntohs(uint16_t netshort); - - local program = [[ - #include --#define KBUILD_MODNAME "foo" - #include - #include - #include -diff --git a/tools/tcplife.py b/tools/tcplife.py -index d4e679dd..c2bd8236 100755 ---- a/tools/tcplife.py -+++ b/tools/tcplife.py -@@ -66,7 +66,6 @@ debug = 0 - # define BPF program - bpf_text = """ - #include --#define KBUILD_MODNAME "foo" - #include - #include - #include -diff --git a/tools/tcpstates.py b/tools/tcpstates.py -index 48f87884..0fe5d89a 100755 ---- a/tools/tcpstates.py -+++ b/tools/tcpstates.py -@@ -61,7 +61,6 @@ debug = 0 - # define BPF program - bpf_header = """ - #include --#define KBUILD_MODNAME "foo" - #include - #include - #include --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-Fix-KFUNC_PROBE-return-value.patch b/SOURCES/bcc-0.14.0-Fix-KFUNC_PROBE-return-value.patch deleted file mode 100644 index 622c0cd..0000000 --- a/SOURCES/bcc-0.14.0-Fix-KFUNC_PROBE-return-value.patch +++ /dev/null @@ -1,92 +0,0 @@ -From cdfa74f35910421e807d7e1deb212a5bca138413 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mauricio=20V=C3=A1squez?= -Date: Thu, 21 May 2020 11:50:52 -0500 -Subject: [PATCH 1/3] Fix KFUNC_PROBE return value -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The KFUNC_PROBE macro is using "void" as return type, this is causing problems -in some tools that have a filtering enable that returns 0. - -Reproducer: (Notice that it requires BTF support) - -``` -$ python opensnoop.py --pid 5 -/virtual/main.c:33:21: error: void function '____kretfunc__do_sys_open' should not return a value [-Wreturn-type] - if (pid != 5) { return 0; } - ^ ~ -1 error generated. -... -``` - -Signed-off-by: Mauricio Vásquez ---- - src/cc/export/helpers.h | 4 ++-- - tools/klockstat.py | 6 +++--- - tools/opensnoop.py | 2 ++ - 3 files changed, 7 insertions(+), 5 deletions(-) - -diff --git a/src/cc/export/helpers.h b/src/cc/export/helpers.h -index b38b3f20..c6edc9cd 100644 ---- a/src/cc/export/helpers.h -+++ b/src/cc/export/helpers.h -@@ -998,7 +998,7 @@ int raw_tracepoint__##event(struct bpf_raw_tracepoint_args *ctx) - #define BPF_PROG(name, args...) \ - int name(unsigned long long *ctx); \ - __attribute__((always_inline)) \ --static void ____##name(unsigned long long *ctx, ##args); \ -+static int ____##name(unsigned long long *ctx, ##args); \ - int name(unsigned long long *ctx) \ - { \ - _Pragma("GCC diagnostic push") \ -@@ -1007,7 +1007,7 @@ int name(unsigned long long *ctx) \ - _Pragma("GCC diagnostic pop") \ - return 0; \ - } \ --static void ____##name(unsigned long long *ctx, ##args) -+static int ____##name(unsigned long long *ctx, ##args) - - #define KFUNC_PROBE(event, args...) \ - BPF_PROG(kfunc__ ## event, args) -diff --git a/tools/klockstat.py b/tools/klockstat.py -index 540dd4e7..7cb15ad3 100755 ---- a/tools/klockstat.py -+++ b/tools/klockstat.py -@@ -352,17 +352,17 @@ int mutex_lock_enter(struct pt_regs *ctx) - program_kfunc = """ - KFUNC_PROBE(mutex_unlock, void *lock) - { -- do_mutex_unlock_enter(); -+ return do_mutex_unlock_enter(); - } - - KRETFUNC_PROBE(mutex_lock, void *lock, int ret) - { -- do_mutex_lock_return(); -+ return do_mutex_lock_return(); - } - - KFUNC_PROBE(mutex_lock, void *lock) - { -- do_mutex_lock_enter(ctx, 3); -+ return do_mutex_lock_enter(ctx, 3); - } - - """ -diff --git a/tools/opensnoop.py b/tools/opensnoop.py -index b28d7d55..9a526625 100755 ---- a/tools/opensnoop.py -+++ b/tools/opensnoop.py -@@ -197,6 +197,8 @@ KRETFUNC_PROBE(do_sys_open, int dfd, const char *filename, int flags, int mode, - data.ret = ret; - - events.perf_submit(ctx, &data, sizeof(data)); -+ -+ return 0: - } - """ - --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-Forbid-trampolines-for-archs-other-than-x86_64.patch b/SOURCES/bcc-0.14.0-Forbid-trampolines-for-archs-other-than-x86_64.patch deleted file mode 100644 index 76742c1..0000000 --- a/SOURCES/bcc-0.14.0-Forbid-trampolines-for-archs-other-than-x86_64.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 3a8276749b291404ec160c1eb0b51925037161aa Mon Sep 17 00:00:00 2001 -From: Jiri Olsa -Date: Wed, 19 Aug 2020 12:47:48 +0200 -Subject: [PATCH 3/3] Forbid trampolines for archs other than x86_64 - -The trampoline support check in bcc does not work properly, -so the feature is detected even on architectures that do not -support it - all archs other than x86_64. - -We are checking for bpf_trampoline_link_prog to exist in -kernel, which works fine on x86_64 to check if the feature -is supported, but it's global function, so it exists also -in other archs even when the feature is not supported -so it returns True also on other archs. - -Adding explicit x86_64 check to support_kfunc function. - -Signed-off-by: Jiri Olsa ---- - src/python/bcc/__init__.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py -index 5b3ff7b2..60ba6ec5 100644 ---- a/src/python/bcc/__init__.py -+++ b/src/python/bcc/__init__.py -@@ -22,6 +22,7 @@ import re - import struct - import errno - import sys -+import platform - - from .libbcc import lib, bcc_symbol, bcc_symbol_option, bcc_stacktrace_build_id, _SYM_CB_TYPE - from .table import Table, PerfEventArray -@@ -884,6 +885,9 @@ DEBUG_BTF = 0x20 - - @staticmethod - def support_kfunc(): -+ # there's no trampoline support for other than x86_64 arch -+ if platform.machine() != 'x86_64': -+ return False; - if not lib.bpf_has_kernel_btf(): - return False; - # kernel symbol "bpf_trampoline_link_prog" indicates kfunc support --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-deadlock-print-a-more-explicit-message-when-pthread_.patch b/SOURCES/bcc-0.14.0-deadlock-print-a-more-explicit-message-when-pthread_.patch deleted file mode 100644 index b068ff6..0000000 --- a/SOURCES/bcc-0.14.0-deadlock-print-a-more-explicit-message-when-pthread_.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c263daf925a7a74f7ae64b049cf3def8b298beee Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Wed, 10 Jun 2020 10:28:42 +0200 -Subject: [PATCH 1/4] deadlock: print a more explicit message when - pthread_mutex_unlock can't be attached - -Most likely, this happen because of a missing --binary argument. Let's -be friendly to our user and print a more useful messsage. ---- - tools/deadlock.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/deadlock.py b/tools/deadlock.py -index 17848720..81122adb 100755 ---- a/tools/deadlock.py -+++ b/tools/deadlock.py -@@ -483,7 +483,7 @@ import time - pid=args.pid, - ) - except Exception as e: -- print('%s. Failed to attach to symbol: %s' % (str(e), symbol)) -+ print('%s. Failed to attach to symbol: %s\nIs --binary argument missing?' % (str(e), symbol)) - sys.exit(1) - for symbol in args.lock_symbols: - try: --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-loader-suggest-to-install-the-right-kernel-devel-pac.patch b/SOURCES/bcc-0.14.0-loader-suggest-to-install-the-right-kernel-devel-pac.patch deleted file mode 100644 index 6dc155c..0000000 --- a/SOURCES/bcc-0.14.0-loader-suggest-to-install-the-right-kernel-devel-pac.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f7e7347dc1b4873f70a26392c997228999d346a8 Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Wed, 10 Jun 2020 11:41:59 +0200 -Subject: [PATCH 3/4] loader: suggest to install the right kernel devel package - -Unfortunately, some package dependency system do not allow to make -sure that the kernel development package installed is the same version -as the running kernel. When this happen, the loader, unable to find -the kernel header, will suggest to rebuild the kernel with -CONFIG_IKHEADERS. For most users, this is probably not an option, but -installing the kernel development package corresponding to the running -kernel version is. ---- - src/cc/frontends/clang/loader.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/cc/frontends/clang/loader.cc b/src/cc/frontends/clang/loader.cc -index 9d768d30..79558dd3 100644 ---- a/src/cc/frontends/clang/loader.cc -+++ b/src/cc/frontends/clang/loader.cc -@@ -151,7 +151,8 @@ int ClangLoader::parse(unique_ptr *mod, TableStorage &ts, - kpath = tmpdir; - } else { - std::cout << "Unable to find kernel headers. "; -- std::cout << "Try rebuilding kernel with CONFIG_IKHEADERS=m (module)\n"; -+ std::cout << "Try rebuilding kernel with CONFIG_IKHEADERS=m (module) "; -+ std::cout << "or installing the kernel development package for your running kernel version.\n"; - } - } - --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-man-remove-non-existent-x-argument-from-tcpconnect-m.patch b/SOURCES/bcc-0.14.0-man-remove-non-existent-x-argument-from-tcpconnect-m.patch deleted file mode 100644 index fcc49c5..0000000 --- a/SOURCES/bcc-0.14.0-man-remove-non-existent-x-argument-from-tcpconnect-m.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1762f5c28832842ea2c67ab68feaf7fddb94a543 Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Wed, 10 Jun 2020 11:30:35 +0200 -Subject: [PATCH 2/4] man: remove non-existent -x argument from tcpconnect man - page - -There's no -x option in tcpconnect. I don't know how it get into the -man page sysnopsis, but it doesn't belong there. ---- - man/man8/tcpconnect.8 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/man/man8/tcpconnect.8 b/man/man8/tcpconnect.8 -index 60aac1e2..8180f0fe 100644 ---- a/man/man8/tcpconnect.8 -+++ b/man/man8/tcpconnect.8 -@@ -2,7 +2,7 @@ - .SH NAME - tcpconnect \- Trace TCP active connections (connect()). Uses Linux eBPF/bcc. - .SH SYNOPSIS --.B tcpconnect [\-h] [\-c] [\-t] [\-x] [\-p PID] [-P PORT] [\-\-cgroupmap MAPPATH] -+.B tcpconnect [\-h] [\-c] [\-t] [\-p PID] [-P PORT] [\-\-cgroupmap MAPPATH] - .SH DESCRIPTION - This tool traces active TCP connections (eg, via a connect() syscall; - accept() are passive connections). This can be useful for general --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-tools-fix-a-python-3-map-issue-in-dbstat-and-dbslowe.patch b/SOURCES/bcc-0.14.0-tools-fix-a-python-3-map-issue-in-dbstat-and-dbslowe.patch deleted file mode 100644 index 603368a..0000000 --- a/SOURCES/bcc-0.14.0-tools-fix-a-python-3-map-issue-in-dbstat-and-dbslowe.patch +++ /dev/null @@ -1,49 +0,0 @@ -From fc72365ad7a3fb66902b3e2d0b0fb712eb8735d3 Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Wed, 10 Jun 2020 18:29:11 +0200 -Subject: [PATCH 4/4] tools: fix a python 3 map issue in dbstat and dbslower - -In python 3, map returns an iterator and not a list anymore. This -patch cast the map into a list. It fixes the following error: - -$ /usr/share/bcc/tools/dbstat mysql -Traceback (most recent call last): - File "/usr/share/bcc/tools/dbstat", line 95, in - bpf = BPF(text=program, usdt_contexts=usdts) - File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 339, in __init__ - ctx_array = (ct.c_void_p * len(usdt_contexts))() -TypeError: object of type 'map' has no len() ---- - tools/dbslower.py | 2 +- - tools/dbstat.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tools/dbslower.py b/tools/dbslower.py -index 2f1b6a8b..e2ee7ad0 100755 ---- a/tools/dbslower.py -+++ b/tools/dbslower.py -@@ -188,7 +188,7 @@ int query_end(struct pt_regs *ctx) { - args.pids = map(int, subprocess.check_output( - "pidof postgres".split()).split()) - -- usdts = map(lambda pid: USDT(pid=pid), args.pids) -+ usdts = list(map(lambda pid: USDT(pid=pid), args.pids)) - for usdt in usdts: - usdt.enable_probe("query__start", "query_start") - usdt.enable_probe("query__done", "query_end") -diff --git a/tools/dbstat.py b/tools/dbstat.py -index a89b0971..a7d301b1 100755 ---- a/tools/dbstat.py -+++ b/tools/dbstat.py -@@ -83,7 +83,7 @@ program = program.replace("SCALE", str(1000 if args.microseconds else 1000000)) - program = program.replace("FILTER", "" if args.threshold == 0 else - "if (delta / 1000000 < %d) { return 0; }" % args.threshold) - --usdts = map(lambda pid: USDT(pid=pid), args.pids) -+usdts = list(map(lambda pid: USDT(pid=pid), args.pids)) - for usdt in usdts: - usdt.enable_probe("query__start", "probe_start") - usdt.enable_probe("query__done", "probe_end") --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-tools-opensnoop-Fix-compilation-problem.patch b/SOURCES/bcc-0.14.0-tools-opensnoop-Fix-compilation-problem.patch deleted file mode 100644 index 0dbeff5..0000000 --- a/SOURCES/bcc-0.14.0-tools-opensnoop-Fix-compilation-problem.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 39a4af00c99327d9498c2e1232afdfa49fa1e564 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mauricio=20V=C3=A1squez?= -Date: Mon, 8 Jun 2020 08:12:08 -0500 -Subject: [PATCH 2/3] tools/opensnoop: Fix compilation problem -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fix stupid bug introduced by myself. - -Signed-off-by: Mauricio Vásquez ---- - tools/opensnoop.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/opensnoop.py b/tools/opensnoop.py -index 9a526625..b7408e7c 100755 ---- a/tools/opensnoop.py -+++ b/tools/opensnoop.py -@@ -198,7 +198,7 @@ KRETFUNC_PROBE(do_sys_open, int dfd, const char *filename, int flags, int mode, - - events.perf_submit(ctx, &data, sizeof(data)); - -- return 0: -+ return 0; - } - """ - --- -2.25.4 - diff --git a/SOURCES/bcc-0.14.0-Manpages-remove-unstable-statement.patch b/SOURCES/bcc-0.16.0-Manpages-remove-unstable-statement.patch similarity index 94% rename from SOURCES/bcc-0.14.0-Manpages-remove-unstable-statement.patch rename to SOURCES/bcc-0.16.0-Manpages-remove-unstable-statement.patch index 2981e68..7832153 100644 --- a/SOURCES/bcc-0.14.0-Manpages-remove-unstable-statement.patch +++ b/SOURCES/bcc-0.16.0-Manpages-remove-unstable-statement.patch @@ -1,4 +1,4 @@ -From 0f53d4de3416d78d0af5c0f70b9a29cb988719c3 Mon Sep 17 00:00:00 2001 +From c42e75d3a80e9fcee66a27edf256452451a3a9b1 Mon Sep 17 00:00:00 2001 From: Jerome Marchand Date: Tue, 6 Aug 2019 14:44:33 +0200 Subject: [PATCH] Manpages: remove unstable statement @@ -30,6 +30,7 @@ enough. man/man8/dcsnoop.8 | 2 -- man/man8/dcstat.8 | 2 -- man/man8/deadlock.8 | 2 -- + man/man8/dirtop.8 | 2 -- man/man8/drsnoop.8 | 2 -- man/man8/execsnoop.8 | 2 -- man/man8/exitsnoop.8 | 2 -- @@ -39,6 +40,7 @@ enough. man/man8/fileslower.8 | 2 -- man/man8/filetop.8 | 2 -- man/man8/funccount.8 | 2 -- + man/man8/funcinterval.8 | 2 -- man/man8/funclatency.8 | 2 -- man/man8/funcslower.8 | 2 -- man/man8/gethostlatency.8 | 2 -- @@ -100,7 +102,7 @@ enough. man/man8/xfsslower.8 | 2 -- man/man8/zfsdist.8 | 2 -- man/man8/zfsslower.8 | 2 -- - 94 files changed, 190 deletions(-) + 96 files changed, 194 deletions(-) diff --git a/man/man8/argdist.8 b/man/man8/argdist.8 index 4116cd4d..aa128d2d 100644 @@ -128,10 +130,10 @@ index bc68a491..705c514e 100644 Brendan Gregg .SH SEE ALSO diff --git a/man/man8/bindsnoop.8 b/man/man8/bindsnoop.8 -index ec7ca1da..2ac4b69e 100644 +index f8fa1850..05ed95a7 100644 --- a/man/man8/bindsnoop.8 +++ b/man/man8/bindsnoop.8 -@@ -136,8 +136,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -141,8 +141,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -282,10 +284,10 @@ index 5642fa1d..1fe4067b 100644 Emmanuel Bretelle .SH SEE ALSO diff --git a/man/man8/capable.8 b/man/man8/capable.8 -index dfb8a6aa..7e545638 100644 +index 342946f8..2b7d13ba 100644 --- a/man/man8/capable.8 +++ b/man/man8/capable.8 -@@ -84,8 +84,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -87,8 +87,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -409,6 +411,19 @@ index 0be3f4ab..7300446a 100644 -Unstable - in development. .SH AUTHOR Kenny Yu +diff --git a/man/man8/dirtop.8 b/man/man8/dirtop.8 +index cc61a676..9a0fd3d9 100644 +--- a/man/man8/dirtop.8 ++++ b/man/man8/dirtop.8 +@@ -105,8 +105,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing + example usage, output, and commentary for this tool. + .SH OS + Linux +-.SH STABILITY +-Unstable - in development. + .SH AUTHOR + Erwan Velu + .SH INSPIRATION diff --git a/man/man8/drsnoop.8 b/man/man8/drsnoop.8 index 572c0dce..3563da81 100644 --- a/man/man8/drsnoop.8 @@ -422,10 +437,10 @@ index 572c0dce..3563da81 100644 .SH AUTHOR Wenbo Zhang diff --git a/man/man8/execsnoop.8 b/man/man8/execsnoop.8 -index 4a88e007..f8db4944 100644 +index e42ad38a..9daaf4b1 100644 --- a/man/man8/execsnoop.8 +++ b/man/man8/execsnoop.8 -@@ -137,8 +137,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -141,8 +141,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -435,10 +450,10 @@ index 4a88e007..f8db4944 100644 Brendan Gregg .SH SEE ALSO diff --git a/man/man8/exitsnoop.8 b/man/man8/exitsnoop.8 -index fb1942b4..f4b0b563 100644 +index 86a43921..c37e1caf 100644 --- a/man/man8/exitsnoop.8 +++ b/man/man8/exitsnoop.8 -@@ -95,8 +95,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -102,8 +102,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -513,10 +528,10 @@ index ba0cbd6e..1f818d68 100644 Brendan Gregg .SH INSPIRATION diff --git a/man/man8/funccount.8 b/man/man8/funccount.8 -index 9039ab33..70e222f2 100644 +index 16ce4fc0..1c7b71c1 100644 --- a/man/man8/funccount.8 +++ b/man/man8/funccount.8 -@@ -97,8 +97,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -104,8 +104,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -525,6 +540,19 @@ index 9039ab33..70e222f2 100644 .SH AUTHOR Brendan Gregg, Sasha Goldshtein .SH SEE ALSO +diff --git a/man/man8/funcinterval.8 b/man/man8/funcinterval.8 +index 89a4a7b4..c9e1f31a 100755 +--- a/man/man8/funcinterval.8 ++++ b/man/man8/funcinterval.8 +@@ -106,8 +106,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing + example usage, output, and commentary for this tool. + .SH OS + Linux +-.SH STABILITY +-Unstable - in development. + .SH AUTHOR + Edward Wu + .SH SEE ALSO diff --git a/man/man8/funclatency.8 b/man/man8/funclatency.8 index b82626cf..3c8e248e 100644 --- a/man/man8/funclatency.8 @@ -592,10 +620,10 @@ index 2ab80dbb..85b36b6e 100644 .SH AUTHOR Howard McLauchlan diff --git a/man/man8/killsnoop.8 b/man/man8/killsnoop.8 -index b90162f0..ff44a306 100644 +index acb376ea..2543b6a6 100644 --- a/man/man8/killsnoop.8 +++ b/man/man8/killsnoop.8 -@@ -75,8 +75,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -82,8 +82,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -644,10 +672,10 @@ index 9d10ca87..3c3b9bba 100644 Brendan Gregg .SH SEE ALSO diff --git a/man/man8/memleak.8 b/man/man8/memleak.8 -index fa52c8cf..718ae3c2 100644 +index 2fd26764..d56cf207 100644 --- a/man/man8/memleak.8 +++ b/man/man8/memleak.8 -@@ -129,7 +129,5 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -135,7 +135,5 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -721,10 +749,10 @@ index be5387b9..270991d8 100644 Brendan Gregg .SH SEE ALSO diff --git a/man/man8/offwaketime.8 b/man/man8/offwaketime.8 -index cdc49a71..b0027832 100644 +index 7334b6f8..f0704e92 100644 --- a/man/man8/offwaketime.8 +++ b/man/man8/offwaketime.8 -@@ -101,8 +101,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -107,8 +107,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -747,10 +775,10 @@ index b6d6f9e1..965ba545 100644 Brendan Gregg .SH SEE ALSO diff --git a/man/man8/opensnoop.8 b/man/man8/opensnoop.8 -index 54a7788a..8a1b9949 100644 +index fee83263..953af623 100644 --- a/man/man8/opensnoop.8 +++ b/man/man8/opensnoop.8 -@@ -145,8 +145,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -148,8 +148,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -773,7 +801,7 @@ index 2164ffaf..9d272c81 100644 Brendan Gregg .SH SEE ALSO diff --git a/man/man8/profile.8 b/man/man8/profile.8 -index 823ff699..7739058f 100644 +index 30871afe..8523a731 100644 --- a/man/man8/profile.8 +++ b/man/man8/profile.8 @@ -148,8 +148,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing @@ -909,7 +937,7 @@ index ffad57c5..df80437f 100644 Jiri Olsa .SH SEE ALSO diff --git a/man/man8/sslsniff.8 b/man/man8/sslsniff.8 -index 72836e27..b9254645 100644 +index 7b945b00..b23f4c68 100644 --- a/man/man8/sslsniff.8 +++ b/man/man8/sslsniff.8 @@ -43,8 +43,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing @@ -974,10 +1002,10 @@ index d13793be..88343e14 100644 Sasha Goldshtein .SH SEE ALSO diff --git a/man/man8/tcpaccept.8 b/man/man8/tcpaccept.8 -index 43219260..4176a32b 100644 +index 603a5ca4..4e7dfc9e 100644 --- a/man/man8/tcpaccept.8 +++ b/man/man8/tcpaccept.8 -@@ -101,8 +101,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -104,8 +104,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -987,10 +1015,10 @@ index 43219260..4176a32b 100644 Brendan Gregg .SH SEE ALSO diff --git a/man/man8/tcpconnect.8 b/man/man8/tcpconnect.8 -index 60aac1e2..856873c0 100644 +index c96058b0..843aaa9c 100644 --- a/man/man8/tcpconnect.8 +++ b/man/man8/tcpconnect.8 -@@ -118,8 +118,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -125,8 +125,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -1078,10 +1106,10 @@ index 525b8082..daf41583 100644 Rodrigo Manyari .SH INSPIRATION diff --git a/man/man8/tcptop.8 b/man/man8/tcptop.8 -index 631c00c3..eddab761 100644 +index e636f456..633b0c93 100644 --- a/man/man8/tcptop.8 +++ b/man/man8/tcptop.8 -@@ -110,8 +110,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -113,8 +113,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -1091,10 +1119,10 @@ index 631c00c3..eddab761 100644 Brendan Gregg .SH INSPIRATION diff --git a/man/man8/tcptracer.8 b/man/man8/tcptracer.8 -index 728c80af..cd444ee4 100644 +index d2346c77..893604d6 100644 --- a/man/man8/tcptracer.8 +++ b/man/man8/tcptracer.8 -@@ -96,8 +96,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -99,8 +99,6 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -1116,10 +1144,10 @@ index da5edf37..f7e459da 100644 .SH AUTHOR Sasha Goldshtein diff --git a/man/man8/trace.8 b/man/man8/trace.8 -index 0b27dbd6..fb33599a 100644 +index e4f06fc7..7b68d833 100644 --- a/man/man8/trace.8 +++ b/man/man8/trace.8 -@@ -206,7 +206,5 @@ Also look in the bcc distribution for a companion _examples.txt file containing +@@ -210,7 +210,5 @@ Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. .SH OS Linux @@ -1310,5 +1338,5 @@ index d1e2f9c1..31d382f6 100644 Brendan Gregg .SH SEE ALSO -- -2.25.3 +2.25.4 diff --git a/SOURCES/bcc-0.16.0-slabratetop-Add-memcg_cache_params-struct-def.patch b/SOURCES/bcc-0.16.0-slabratetop-Add-memcg_cache_params-struct-def.patch new file mode 100644 index 0000000..590df46 --- /dev/null +++ b/SOURCES/bcc-0.16.0-slabratetop-Add-memcg_cache_params-struct-def.patch @@ -0,0 +1,39 @@ +From fe1f2189326a54e3496b2fcfdc1b08839f3165b4 Mon Sep 17 00:00:00 2001 +From: Daniel Rank +Date: Sun, 27 Sep 2020 16:55:22 -0700 +Subject: [PATCH] slabratetop: Add memcg_cache_params struct def + +struct memcg_cache_params moved from include/linux/slab.h to +mm/slab.h in kernel v5.4, causing a compiler error when including +slub_def.h or slab_def.h in slabratetop's bpf program. + +It has been removed completely from kernel version 5.9. + +Add an empty memcg_cache_params struct in slabratetop's bpf +program so it will compile with kernel versions 5.4 to 5.8. +--- + tools/slabratetop.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tools/slabratetop.py b/tools/slabratetop.py +index 066f79d6..182dbd1d 100755 +--- a/tools/slabratetop.py ++++ b/tools/slabratetop.py +@@ -62,7 +62,13 @@ loadavg = "/proc/loadavg" + bpf_text = """ + #include + #include +-#include ++ ++// memcg_cache_params is a part of kmem_cache, but is not publicly exposed in ++// kernel versions 5.4 to 5.8. Define an empty struct for it here to allow the ++// bpf program to compile. It has been completely removed in kernel version ++// 5.9, but it does not hurt to have it here for versions 5.4 to 5.8. ++struct memcg_cache_params {}; ++ + #ifdef CONFIG_SLUB + #include + #else +-- +2.29.2 + diff --git a/SOURCES/bcc-0.16.0-sync-with-libbpf-repo.patch b/SOURCES/bcc-0.16.0-sync-with-libbpf-repo.patch new file mode 100644 index 0000000..d1f2323 --- /dev/null +++ b/SOURCES/bcc-0.16.0-sync-with-libbpf-repo.patch @@ -0,0 +1,121 @@ +From da9ec2b1673ddf6b956304dca6ed6918d89d4631 Mon Sep 17 00:00:00 2001 +From: Yonghong Song +Date: Sat, 22 Aug 2020 15:19:46 -0700 +Subject: [PATCH] sync with libbpf repo + +sync with latest libbpf repo. + +Strut definition for btf_ext_header is defined in libbpf/src/btf.h +previously and used by bcc. Now, the struct is moved to +libbpf/src/libbpf_internal.h and not available to bcc. +We do not want to include libbpf/src/libbpf_internal.h as +it is really libbpf internal. Let us define bcc version +of btf_ext_header with struct name bcc_btf_ext_header. +The new name is to avoid conflict when compiling with +old libbpf package. + +Signed-off-by: Yonghong Song +--- + src/cc/bcc_btf.cc | 2 +- + src/cc/bcc_btf.h | 17 +++++++++++++++++ + src/cc/compat/linux/virtual_bpf.h | 17 ++++++++++++----- + 4 files changed, 31 insertions(+), 7 deletions(-) + +diff --git a/src/cc/bcc_btf.cc b/src/cc/bcc_btf.cc +index e220f117..1056950c 100644 +--- a/src/cc/bcc_btf.cc ++++ b/src/cc/bcc_btf.cc +@@ -185,7 +185,7 @@ void BTF::adjust(uint8_t *btf_sec, uintptr_t btf_sec_size, + } + + struct btf_header *hdr = (struct btf_header *)btf_sec; +- struct btf_ext_header *ehdr = (struct btf_ext_header *)btf_ext_sec; ++ struct bcc_btf_ext_header *ehdr = (struct bcc_btf_ext_header *)btf_ext_sec; + + // Fixup btf for old kernels or kernel requirements. + fixup_btf(btf_sec + hdr->hdr_len + hdr->type_off, hdr->type_len, +diff --git a/src/cc/bcc_btf.h b/src/cc/bcc_btf.h +index 438c1f73..75b47cc3 100644 +--- a/src/cc/bcc_btf.h ++++ b/src/cc/bcc_btf.h +@@ -45,6 +45,23 @@ class BTFStringTable { + }; + + class BTF { ++ struct bcc_btf_ext_header { ++ uint16_t magic; ++ uint8_t version; ++ uint8_t flags; ++ uint32_t hdr_len; ++ ++ /* All offsets are in bytes relative to the end of this header */ ++ uint32_t func_info_off; ++ uint32_t func_info_len; ++ uint32_t line_info_off; ++ uint32_t line_info_len; ++ ++ /* optional part of .BTF.ext header */ ++ uint32_t core_relo_off; ++ uint32_t core_relo_len; ++}; ++ + public: + BTF(bool debug, sec_map_def §ions); + ~BTF(); +diff --git a/src/cc/compat/linux/virtual_bpf.h b/src/cc/compat/linux/virtual_bpf.h +index 38262630..0387b970 100644 +--- a/src/cc/compat/linux/virtual_bpf.h ++++ b/src/cc/compat/linux/virtual_bpf.h +@@ -768,7 +768,7 @@ union bpf_attr { + * + * Also, note that **bpf_trace_printk**\ () is slow, and should + * only be used for debugging purposes. For this reason, a notice +- * bloc (spanning several lines) is printed to kernel logs and ++ * block (spanning several lines) is printed to kernel logs and + * states that the helper should not be used "for production use" + * the first time this helper is used (or more precisely, when + * **trace_printk**\ () buffers are allocated). For passing values +@@ -1034,14 +1034,14 @@ union bpf_attr { + * + * int ret; + * struct bpf_tunnel_key key = {}; +- * ++ * + * ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); + * if (ret < 0) + * return TC_ACT_SHOT; // drop packet +- * ++ * + * if (key.remote_ipv4 != 0x0a000001) + * return TC_ACT_SHOT; // drop packet +- * ++ * + * return TC_ACT_OK; // accept packet + * + * This interface can also be used with all encapsulation devices +@@ -1148,7 +1148,7 @@ union bpf_attr { + * Description + * Retrieve the realm or the route, that is to say the + * **tclassid** field of the destination for the *skb*. The +- * indentifier retrieved is a user-provided tag, similar to the ++ * identifier retrieved is a user-provided tag, similar to the + * one used with the net_cls cgroup (see description for + * **bpf_get_cgroup_classid**\ () helper), but here this tag is + * held by a route (a destination entry), not by a task. +@@ -4072,6 +4072,13 @@ struct bpf_link_info { + __u64 cgroup_id; + __u32 attach_type; + } cgroup; ++ struct { ++ __aligned_u64 target_name; /* in/out: target_name buffer ptr */ ++ __u32 target_name_len; /* in/out: target_name buffer len */ ++ union { ++ __u32 map_id; ++ } map; ++ } iter; + struct { + __u32 netns_ino; + __u32 attach_type; +-- +2.29.2 + diff --git a/SOURCES/bcc-0.16.0-tools-include-kasan-header-in-slabtoprate.patch b/SOURCES/bcc-0.16.0-tools-include-kasan-header-in-slabtoprate.patch new file mode 100644 index 0000000..8576ebb --- /dev/null +++ b/SOURCES/bcc-0.16.0-tools-include-kasan-header-in-slabtoprate.patch @@ -0,0 +1,42 @@ +From 33393d3008969e43d26f0e4b3e71198130f9f44d Mon Sep 17 00:00:00 2001 +From: Jerome Marchand +Date: Thu, 18 Feb 2021 11:33:20 +0100 +Subject: [PATCH] tools: include kasan header in slabtoprate + +slabtoprate fails on 5.10 kernels because of a missing kasan_reset_tag +declaration. We need to include the kasan header file. + +Fixes the following error: +In file included from /virtual/main.c:12: +include/linux/slub_def.h:181:27: warning: implicit declaration of function 'kasan_reset_tag' is invalid in C99 [-Wimplicit-function-declaration] + return reciprocal_divide(kasan_reset_tag(obj) - addr, + ^ +include/linux/slub_def.h:181:48: error: invalid operands to binary expression ('int' and 'void *') + return reciprocal_divide(kasan_reset_tag(obj) - addr, + ~~~~~~~~~~~~~~~~~~~~ ^ ~~~~ +1 warning and 1 error generated. +Traceback (most recent call last): + File "/usr/share/bcc/tools/slabratetop", line 115, in + b = BPF(text=bpf_text) + File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 364, in __init__ + raise Exception("Failed to compile BPF module %s" % (src_file or "")) +Exception: Failed to compile BPF module +--- + tools/slabratetop.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/slabratetop.py b/tools/slabratetop.py +index 182dbd1d..75280c6d 100755 +--- a/tools/slabratetop.py ++++ b/tools/slabratetop.py +@@ -62,6 +62,7 @@ loadavg = "/proc/loadavg" + bpf_text = """ + #include + #include ++#include + + // memcg_cache_params is a part of kmem_cache, but is not publicly exposed in + // kernel versions 5.4 to 5.8. Define an empty struct for it here to allow the +-- +2.29.2 + diff --git a/SOURCES/bcc-0.16.0-tools-tcptracer-fix-alignement-in-tcp_ipv6_event_t.patch b/SOURCES/bcc-0.16.0-tools-tcptracer-fix-alignement-in-tcp_ipv6_event_t.patch new file mode 100644 index 0000000..ff7675e --- /dev/null +++ b/SOURCES/bcc-0.16.0-tools-tcptracer-fix-alignement-in-tcp_ipv6_event_t.patch @@ -0,0 +1,46 @@ +From 52c4e8cec4dd560503ff011f8fe7eec5f67b33c9 Mon Sep 17 00:00:00 2001 +From: Jerome Marchand +Date: Thu, 17 Sep 2020 10:37:02 +0200 +Subject: [PATCH 2/2] tools: tcptracer: fix alignement in tcp_ipv6_event_t + +On IPv6, tcptracer ports always appears as zeros: + +Tracing TCP established connections. Ctrl-C to end. +T PID COMM IP SADDR DADDR SPORT DPORT +X 7055 nc 4 127.0.0.1 127.0.0.1 49476 9999 +C 7074 nc 4 127.0.0.1 127.0.0.1 49478 9999 +X 7074 nc 4 127.0.0.1 127.0.0.1 49478 9999 +C 7085 nc 6 [::] [0:0:0:1::] 0 0 +X 7085 nc 6 [::] [0:0:0:1::] 0 0 +C 7086 nc 6 [::] [0:0:0:1::] 0 0 + +This seems related to alignment issue wrt to the __int128 type in +tcp_ipv6_event_t structure. Moving the u8 field ip to the end of the +structure fixes the issue. + +Fixes #2781 +--- + tools/tcptracer.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/tcptracer.py b/tools/tcptracer.py +index 2e486b15..3220105e 100755 +--- a/tools/tcptracer.py ++++ b/tools/tcptracer.py +@@ -73,12 +73,12 @@ struct tcp_ipv6_event_t { + u32 type; + u32 pid; + char comm[TASK_COMM_LEN]; +- u8 ip; + unsigned __int128 saddr; + unsigned __int128 daddr; + u16 sport; + u16 dport; + u32 netns; ++ u8 ip; + }; + BPF_PERF_OUTPUT(tcp_ipv6_event); + +-- +2.25.4 + diff --git a/SPECS/bcc.spec b/SPECS/bcc.spec index 0591175..e891758 100644 --- a/SPECS/bcc.spec +++ b/SPECS/bcc.spec @@ -1,11 +1,15 @@ # luajit is not available RHEL 8 %bcond_with lua -%bcond_without llvm_static +%bcond_with llvm_static + +%if %{without llvm_static} +%global with_llvm_shared 1 +%endif Name: bcc -Version: 0.14.0 -Release: 4%{?dist} +Version: 0.16.0 +Release: 3%{?dist} Summary: BPF Compiler Collection (BCC) License: ASL 2.0 URL: https://github.com/iovisor/bcc @@ -13,36 +17,34 @@ URL: https://github.com/iovisor/bcc Source0: %{url}/releases/download/v%{version}/%{name}-src-with-submodule.tar.gz #Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Patch0: %{name}-%{version}-Manpages-remove-unstable-statement.patch -Patch1: %{name}-%{version}-deadlock-print-a-more-explicit-message-when-pthread_.patch -Patch2: %{name}-%{version}-man-remove-non-existent-x-argument-from-tcpconnect-m.patch -Patch3: %{name}-%{version}-loader-suggest-to-install-the-right-kernel-devel-pac.patch -Patch4: %{name}-%{version}-tools-fix-a-python-3-map-issue-in-dbstat-and-dbslowe.patch -Patch5: %{name}-%{version}-Add-KBUILD_MODNAME-flag-to-default-cflags.patch -Patch6: %{name}-%{version}-Delete-existing-kbuild_modname-definitions.patch -Patch7: %{name}-%{version}-Fix-KFUNC_PROBE-return-value.patch -Patch8: %{name}-%{version}-tools-opensnoop-Fix-compilation-problem.patch -Patch9: %{name}-%{version}-Forbid-trampolines-for-archs-other-than-x86_64.patch +Patch1: %{name}-%{version}-tools-tcptracer-fix-alignement-in-tcp_ipv6_event_t.patch +Patch2: %{name}-%{version}-sync-with-libbpf-repo.patch +Patch3: %{name}-%{version}-slabratetop-Add-memcg_cache_params-struct-def.patch +Patch4: %{name}-%{version}-tools-include-kasan-header-in-slabtoprate.patch # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches ExcludeArch: i686 -BuildRequires: bison, cmake >= 2.8.7, flex, libxml2-devel +BuildRequires: bison +BuildRequires: cmake >= 2.8.7 +BuildRequires: flex +BuildRequires: libxml2-devel BuildRequires: python3-devel BuildRequires: elfutils-libelf-devel BuildRequires: llvm-devel BuildRequires: clang-devel -BuildRequires: ncurses-devel -%if %{with lua} -BuildRequires: pkgconfig(luajit) -%endif %if %{with llvm_static} BuildRequires: llvm-static %endif - -BuildRequires: clang +BuildRequires: ncurses-devel +%if %{with lua} +BuildRequires: pkgconfig(luajit) +%endif +BuildRequires: libbpf-devel >= 0.0.9, libbpf-static >= 0.0.9 Requires: %{name}-tools = %{version}-%{release} +Requires: libbpf >= 0.0.9 %description BCC is a toolkit for creating efficient kernel tracing and manipulation @@ -109,9 +111,12 @@ Command line tools for BPF Compiler Collection (BCC) %build %cmake . \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3 + -DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3 \ + -DCMAKE_USE_LIBBPF_PACKAGE:BOOL=TRUE \ + %{?with_llvm_shared:-DENABLE_LLVM_SHARED=1} %make_build + %install %make_install @@ -155,12 +160,14 @@ done %license LICENSE.txt %{_libdir}/lib%{name}.so.* %{_libdir}/libbcc_bpf.so.* +%{_libdir}/libbcc-no-libbpf.so.* %files devel %exclude %{_libdir}/lib%{name}*.a %exclude %{_libdir}/lib%{name}*.la %{_libdir}/lib%{name}.so %{_libdir}/libbcc_bpf.so +%{_libdir}/libbcc-no-libbpf.so %{_libdir}/pkgconfig/lib%{name}.pc %{_includedir}/%{name}/ @@ -211,6 +218,18 @@ done %changelog +* Mon Feb 22 2021 Jerome Marchand - 0.16.0-3 +- Fix slabratetop header issues +- Rebuild with latest libbpf + +* Fri Jan 22 2021 Jerome Marchand - 0.16.0-2 +- Build with libbpf package +- spec file cleanups + +* Mon Oct 26 2020 Jerome Marchand - 0.16.0-1 +- Rebase on bcc-0.16.0 +- Fix IPv6 ports + * Wed Sep 02 2020 Jerome Marchand - 0.14.0-4 - Fix KFUNC_PROBE return value - Forbid trampolines on unsupported arches