From 8cdc5452d7ef888038497f2ce776579c9b827ec8 Mon Sep 17 00:00:00 2001 From: Lv Ying Date: Wed, 10 Nov 2021 10:06:24 +0800 Subject: [PATCH] [Backport]libbpf: Support detecting and attaching of writable tracepoint program https://lore.kernel.org/bpf/20211004094857.30868-3-hotforest@gmail.com Signed-off-by: Lv Ying --- ...etecting-and-attaching-of-writable-t.patch | 34 +++++++++++++++++++ libbpf.spec | 10 ++++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch diff --git a/backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch b/backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch new file mode 100644 index 0000000..dc6f17e --- /dev/null +++ b/backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch @@ -0,0 +1,34 @@ +From 4d32ba754a242fb31827923c4a6f051063b32fea Mon Sep 17 00:00:00 2001 +From: Hou Tao +Date: Mon, 4 Oct 2021 17:48:56 +0800 +Subject: [PATCH] libbpf: Support detecting and attaching of writable + tracepoint program + +Program on writable tracepoint is BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, +but its attachment is the same as BPF_PROG_TYPE_RAW_TRACEPOINT. + +Signed-off-by: Hou Tao +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20211004094857.30868-3-hotforest@gmail.com +--- + src/libbpf.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/libbpf.c b/src/libbpf.c +index d9ece93..02e9d33 100644 +--- a/src/libbpf.c ++++ b/src/libbpf.c +@@ -6894,6 +6894,10 @@ static const struct bpf_sec_def section_defs[] = { + .attach_fn = attach_raw_tp), + SEC_DEF("raw_tp/", RAW_TRACEPOINT, + .attach_fn = attach_raw_tp), ++ SEC_DEF("raw_tracepoint.w/", RAW_TRACEPOINT_WRITABLE, ++ .attach_fn = attach_raw_tp), ++ SEC_DEF("raw_tp.w/", RAW_TRACEPOINT_WRITABLE, ++ .attach_fn = attach_raw_tp), + SEC_DEF("tp_btf/", TRACING, + .expected_attach_type = BPF_TRACE_RAW_TP, + .is_attach_btf = true, +-- +2.29.2 + diff --git a/libbpf.spec b/libbpf.spec index 9a28eaf..4ae9a5c 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -4,7 +4,7 @@ Name: %{githubname} Version: %{githubver} -Release: 1 +Release: 2 Summary: Libbpf library License: LGPLv2 or BSD @@ -12,6 +12,8 @@ URL: https://github.com/%{githubname}/%{githubname} Source: https://github.com/%{githubname}/%{githubname}/archive/v%{githubver}.tar.gz BuildRequires: gcc elfutils-libelf-devel elfutils-devel +Patch6000: backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch + # This package supersedes libbpf from kernel-tools, # which has default Epoch: 0. By having Epoch: 1 # this libbpf will take over smoothly @@ -42,7 +44,7 @@ developing applications that use %{name} %global make_flags DESTDIR=%{buildroot} OBJDIR=%{_builddir} CFLAGS="%{build_cflags} -fPIC" LDFLAGS="%{build_ldflags} -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1 %prep -%autosetup -n %{githubfull} +%autosetup -n %{githubfull} -p1 %build %make_build -C ./src %{make_flags} @@ -63,6 +65,10 @@ developing applications that use %{name} %{_libdir}/libbpf.a %changelog +* Wed Nov 10 2021 Lv Ying - 0.1.1-2 +- support detecting and attaching of writable tracepoint program + https://lore.kernel.org/bpf/20211004094857.30868-3-hotforest@gmail.com + * Tue Nov 17 2020 nlgwcy - 0.1.1-1 - update libbpf from v0.0.6 to v0.1.1 -- Gitee