diff --git a/0.8.1.tar.gz b/0.8.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..4f23bbad61aea4f8859b19fbebc570fdeb79ac28 Binary files /dev/null and b/0.8.1.tar.gz differ diff --git a/backport-libbpf-Fix-determine_ptr_size-guessing.patch b/backport-libbpf-Fix-determine_ptr_size-guessing.patch new file mode 100644 index 0000000000000000000000000000000000000000..4cb99afa5e81dbaba91332e5ea8f9771fb65c56e --- /dev/null +++ b/backport-libbpf-Fix-determine_ptr_size-guessing.patch @@ -0,0 +1,77 @@ +From a5d75daa8c467a863ecf297982b70ed284adc0e9 Mon Sep 17 00:00:00 2001 +From: Douglas Raillard +Date: Tue, 24 May 2022 10:44:47 +0100 +Subject: [PATCH] libbpf: Fix determine_ptr_size() guessing + +One strategy employed by libbpf to guess the pointer size is by finding +the size of "unsigned long" type. This is achieved by looking for a type +of with the expected name and checking its size. + +Unfortunately, the C syntax is friendlier to humans than to computers +as there is some variety in how such a type can be named. Specifically, +gcc and clang do not use the same names for integer types in debug info: + + - clang uses "unsigned long" + - gcc uses "long unsigned int" + +Lookup all the names for such a type so that libbpf can hope to find the +information it wants. + +Signed-off-by: Douglas Raillard +Signed-off-by: Andrii Nakryiko +Acked-by: Yonghong Song +Link: https://lore.kernel.org/bpf/20220524094447.332186-1-douglas.raillard@arm.com +--- + src/btf.c | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/src/btf.c b/src/btf.c +index bb1e06eb1..3d6c30d9a 100644 +--- a/src/btf.c ++++ b/src/btf.c +@@ -472,9 +472,22 @@ const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 type_id) + + static int determine_ptr_size(const struct btf *btf) + { ++ static const char * const long_aliases[] = { ++ "long", ++ "long int", ++ "int long", ++ "unsigned long", ++ "long unsigned", ++ "unsigned long int", ++ "unsigned int long", ++ "long unsigned int", ++ "long int unsigned", ++ "int unsigned long", ++ "int long unsigned", ++ }; + const struct btf_type *t; + const char *name; +- int i, n; ++ int i, j, n; + + if (btf->base_btf && btf->base_btf->ptr_sz > 0) + return btf->base_btf->ptr_sz; +@@ -485,15 +498,16 @@ static int determine_ptr_size(const struct btf *btf) + if (!btf_is_int(t)) + continue; + ++ if (t->size != 4 && t->size != 8) ++ continue; ++ + name = btf__name_by_offset(btf, t->name_off); + if (!name) + continue; + +- if (strcmp(name, "long int") == 0 || +- strcmp(name, "long unsigned int") == 0) { +- if (t->size != 4 && t->size != 8) +- continue; +- return t->size; ++ for (j = 0; j < ARRAY_SIZE(long_aliases); j++) { ++ if (strcmp(name, long_aliases[j]) == 0) ++ return t->size; + } + } + diff --git a/backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch b/backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch deleted file mode 100644 index dc6f17e1a50fa6002b599f98b37452deecd39cad..0000000000000000000000000000000000000000 --- a/backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch +++ /dev/null @@ -1,34 +0,0 @@ -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-0.3.tar.gz b/libbpf-0.3.tar.gz deleted file mode 100644 index dc95de423876f1c8ed0fe8ca6c52c020884e4cea..0000000000000000000000000000000000000000 Binary files a/libbpf-0.3.tar.gz and /dev/null differ diff --git a/libbpf.spec b/libbpf.spec index 671247ee7d065506500392750417ac554fa2b91b..a748f41e198bbd4f239744ee885f91b004438cd6 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -1,18 +1,18 @@ %global githubname libbpf -%global githubver 0.3 +%global githubver 0.8.1 %global githubfull %{githubname}-%{githubver} Name: %{githubname} Version: %{githubver} -Release: 3 +Release: 1 Summary: Libbpf library License: LGPLv2 or BSD URL: https://github.com/%{githubname}/%{githubname} -Source: https://github.com/%{githubname}/%{githubname}/archive/%{githubname}-%{githubver}.tar.gz +Source: https://github.com/%{githubname}/%{githubname}/archive/refs/tags/%{githubver}.tar.gz BuildRequires: gcc elfutils-libelf-devel elfutils-devel -Patch6000: backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch +Patch0000: backport-libbpf-Fix-determine_ptr_size-guessing.patch # This package supersedes libbpf from kernel-tools, # which has default Epoch: 0. By having Epoch: 1 @@ -27,7 +27,7 @@ ABI. %package devel Summary: Development files for %{name} Requires: %{name} = 2:%{version}-%{release} -Requires: kernel-headers >= 5.4.0-1 +Requires: kernel-headers >= 5.10.0 %description devel The %{name}-devel package contains libraries header files for @@ -53,7 +53,7 @@ developing applications that use %{name} %make_install -C ./src %{make_flags} %files -%{_libdir}/libbpf.so.0.3.0 +%{_libdir}/libbpf.so.%{githubver} %{_libdir}/libbpf.so.0 %files devel @@ -65,6 +65,9 @@ developing applications that use %{name} %{_libdir}/libbpf.a %changelog +* Fri Dec 2 2022 zhangmingyi - 2:0.8.1-1 +- update master + * Mon Aug 22 2022 hujiawang - 2:0.3-3 - Change the package name