aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Ambardar <itugrok@yahoo.com>2020-12-14 21:39:19 -0800
committerPetr Štetiar <ynezz@true.cz>2021-01-25 14:37:41 +0100
commit23be333401f06a49d7081b051b2cdf84f8a75149 (patch)
tree1ab431f4554a49121a9c52da31a1164815c71cfe
parent0faa17235669da7f8a7cd7ab922a77b06d6d230a (diff)
downloadupstream-23be333401f06a49d7081b051b2cdf84f8a75149.tar.gz
upstream-23be333401f06a49d7081b051b2cdf84f8a75149.tar.bz2
upstream-23be333401f06a49d7081b051b2cdf84f8a75149.zip
bpftools: update to 5.10.10
Use the latest stable kernel since the previous 5.8.x series is EOL. Also drop the following patches recently accepted upstream: * 001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch * 002-libbpf-fix-build-failure-from-uninitialized-variable.patch * 003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch * 004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
-rw-r--r--package/network/utils/bpftools/Makefile4
-rw-r--r--package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch31
-rw-r--r--package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch41
-rw-r--r--package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch21
-rw-r--r--package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch231
5 files changed, 2 insertions, 326 deletions
diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile
index e760d50c5e..06a7a7adfd 100644
--- a/package/network/utils/bpftools/Makefile
+++ b/package/network/utils/bpftools/Makefile
@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bpftools
-PKG_VERSION:=5.8.9
+PKG_VERSION:=5.10.10
PKG_RELEASE:=1
PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
-PKG_HASH:=99d8bc1b82f17d7d79f9af4a94af4c0e3772159e9e6e278761bde8569f93e15f
+PKG_HASH:=60ed866fa951522a5255ea37ec3ac2006d3f3427d4783a13ef478464f37cdb19
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
diff --git a/package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch b/package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch
deleted file mode 100644
index 18000b6940..0000000000
--- a/package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From fafb2e7eaec6d33ce16e28f481edf781219d5d27 Mon Sep 17 00:00:00 2001
-From: Tony Ambardar <Tony.Ambardar@gmail.com>
-Date: Fri, 24 Jul 2020 23:58:17 -0700
-Subject: [PATCH] tools/libbpf: ensure no local symbols counted in ABI check
-
-This avoids finding versioned local symbols such as _init and _fini in
-the libbpf.so file.
-
-Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
----
- tools/lib/bpf/Makefile | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/tools/lib/bpf/Makefile
-+++ b/tools/lib/bpf/Makefile
-@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --
- awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
- sort -u | wc -l)
- VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
-+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
- grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
-
- CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
-@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so
- awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
- sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
- readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
-+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
- grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
- sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
- diff -u $(OUTPUT)libbpf_global_syms.tmp \
diff --git a/package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch b/package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch
deleted file mode 100644
index 96ab2084b7..0000000000
--- a/package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 74d0dcf7608b1bab116e297468ac51b57eb97ce0 Mon Sep 17 00:00:00 2001
-From: Tony Ambardar <Tony.Ambardar@gmail.com>
-Date: Thu, 20 Aug 2020 10:06:24 -0700
-Subject: [PATCH] libbpf: fix build failure from uninitialized variable warning
-
-While compiling libbpf, some GCC versions (at least 8.4.0) have difficulty
-determining control flow and a emit warning for potentially uninitialized
-usage of 'map', which results in a build error if using "-Werror":
-
-In file included from libbpf.c:56:
-libbpf.c: In function '__bpf_object__open':
-libbpf_internal.h:59:2: warning: 'map' may be used uninitialized in this function [-Wmaybe-uninitialized]
- libbpf_print(level, "libbpf: " fmt, ##__VA_ARGS__); \
- ^~~~~~~~~~~~
-libbpf.c:5032:18: note: 'map' was declared here
- struct bpf_map *map, *targ_map;
- ^~~
-
-The warning/error is false based on code inspection, so silence it with a
-NULL initialization.
-
-Fixes: 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map support")
-Ref: 063e68813391 ("libbpf: Fix false uninitialized variable warning")
-
-Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
----
- tools/lib/bpf/libbpf.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/tools/lib/bpf/libbpf.c
-+++ b/tools/lib/bpf/libbpf.c
-@@ -5030,8 +5030,8 @@ static int bpf_object__collect_map_relos
- int i, j, nrels, new_sz;
- const struct btf_var_secinfo *vi = NULL;
- const struct btf_type *sec, *var, *def;
-+ struct bpf_map *map = NULL, *targ_map;
- const struct btf_member *member;
-- struct bpf_map *map, *targ_map;
- const char *name, *mname;
- Elf_Data *symbols;
- unsigned int moff;
diff --git a/package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch b/package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch
deleted file mode 100644
index 1c569afe6b..0000000000
--- a/package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From 668d1c2951e18512a27aec20b80dea627d01bf04 Mon Sep 17 00:00:00 2001
-From: Tony Ambardar <Tony.Ambardar@gmail.com>
-Date: Thu, 20 Aug 2020 16:05:48 -0700
-Subject: [PATCH] tools/bpftool: allow passing BPFTOOL_VERSION to make
-
-Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
----
- tools/bpf/bpftool/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -25,7 +25,7 @@ endif
-
- LIBBPF = $(LIBBPF_PATH)libbpf.a
-
--BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
-+BPFTOOL_VERSION ?= $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
-
- $(LIBBPF): FORCE
- $(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))
diff --git a/package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch b/package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch
deleted file mode 100644
index 99ce513723..0000000000
--- a/package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch
+++ /dev/null
@@ -1,231 +0,0 @@
-From 6edda7633e4fdf33b91c2e86c05cab805a0dabb3 Mon Sep 17 00:00:00 2001
-From: Tony Ambardar <tony.ambardar@gmail.com>
-Date: Mon, 20 Jul 2020 19:48:16 -0700
-Subject: [PATCH] bpftool: Use only nftw for file tree parsing
-
-The bpftool sources include code to walk file trees, but use multiple
-frameworks to do so: nftw and fts. While nftw conforms to POSIX/SUSv3 and
-is widely available, fts is not conformant and less common, especially on
-non-glibc systems. The inconsistent framework usage hampers maintenance
-and portability of bpftool, in particular for embedded systems.
-
-Standardize code usage by rewriting one fts-based function to use nftw and
-clean up some related function warnings by extending use of "const char *"
-arguments. This change helps in building bpftool against musl for OpenWrt.
-
-Also fix an unsafe call to dirname() by duplicating the string to pass,
-since some implementations may directly alter it. The same approach is
-used in libbpf.c.
-
-Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Reviewed-by: Quentin Monnet <quentin@isovalent.com>
-Link: https://lore.kernel.org/bpf/20200721024817.13701-1-Tony.Ambardar@gmail.com
----
- tools/bpf/bpftool/common.c | 137 ++++++++++++++++++++++---------------
- tools/bpf/bpftool/main.h | 4 +-
- 2 files changed, 82 insertions(+), 59 deletions(-)
-
---- a/tools/bpf/bpftool/common.c
-+++ b/tools/bpf/bpftool/common.c
-@@ -1,10 +1,11 @@
- // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
- /* Copyright (C) 2017-2018 Netronome Systems, Inc. */
-
-+#define _GNU_SOURCE
- #include <ctype.h>
- #include <errno.h>
- #include <fcntl.h>
--#include <fts.h>
-+#include <ftw.h>
- #include <libgen.h>
- #include <mntent.h>
- #include <stdbool.h>
-@@ -123,24 +124,35 @@ int mount_tracefs(const char *target)
- return err;
- }
-
--int open_obj_pinned(char *path, bool quiet)
-+int open_obj_pinned(const char *path, bool quiet)
- {
-- int fd;
-+ char *pname;
-+ int fd = -1;
-
-- fd = bpf_obj_get(path);
-+ pname = strdup(path);
-+ if (!pname) {
-+ if (!quiet)
-+ p_err("mem alloc failed");
-+ goto out_ret;
-+ }
-+
-+ fd = bpf_obj_get(pname);
- if (fd < 0) {
- if (!quiet)
-- p_err("bpf obj get (%s): %s", path,
-- errno == EACCES && !is_bpffs(dirname(path)) ?
-+ p_err("bpf obj get (%s): %s", pname,
-+ errno == EACCES && !is_bpffs(dirname(pname)) ?
- "directory not in bpf file system (bpffs)" :
- strerror(errno));
-- return -1;
-+ goto out_free;
- }
-
-+out_free:
-+ free(pname);
-+out_ret:
- return fd;
- }
-
--int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type)
-+int open_obj_pinned_any(const char *path, enum bpf_obj_type exp_type)
- {
- enum bpf_obj_type type;
- int fd;
-@@ -330,71 +342,82 @@ void print_hex_data_json(uint8_t *data,
- jsonw_end_array(json_wtr);
- }
-
-+/* extra params for nftw cb */
-+static struct pinned_obj_table *build_fn_table;
-+static enum bpf_obj_type build_fn_type;
-+
-+static int do_build_table_cb(const char *fpath, const struct stat *sb,
-+ int typeflag, struct FTW *ftwbuf)
-+{
-+ struct bpf_prog_info pinned_info;
-+ __u32 len = sizeof(pinned_info);
-+ struct pinned_obj *obj_node;
-+ enum bpf_obj_type objtype;
-+ int fd, err = 0;
-+
-+ if (typeflag != FTW_F)
-+ goto out_ret;
-+
-+ fd = open_obj_pinned(fpath, true);
-+ if (fd < 0)
-+ goto out_ret;
-+
-+ objtype = get_fd_type(fd);
-+ if (objtype != build_fn_type)
-+ goto out_close;
-+
-+ memset(&pinned_info, 0, sizeof(pinned_info));
-+ if (bpf_obj_get_info_by_fd(fd, &pinned_info, &len))
-+ goto out_close;
-+
-+ obj_node = calloc(1, sizeof(*obj_node));
-+ if (!obj_node) {
-+ err = -1;
-+ goto out_close;
-+ }
-+
-+ obj_node->id = pinned_info.id;
-+ obj_node->path = strdup(fpath);
-+ if (!obj_node->path) {
-+ err = -1;
-+ free(obj_node);
-+ goto out_close;
-+ }
-+
-+ hash_add(build_fn_table->table, &obj_node->hash, obj_node->id);
-+out_close:
-+ close(fd);
-+out_ret:
-+ return err;
-+}
-+
- int build_pinned_obj_table(struct pinned_obj_table *tab,
- enum bpf_obj_type type)
- {
-- struct bpf_prog_info pinned_info = {};
-- struct pinned_obj *obj_node = NULL;
-- __u32 len = sizeof(pinned_info);
- struct mntent *mntent = NULL;
-- enum bpf_obj_type objtype;
- FILE *mntfile = NULL;
-- FTSENT *ftse = NULL;
-- FTS *fts = NULL;
-- int fd, err;
-+ int flags = FTW_PHYS;
-+ int nopenfd = 16;
-+ int err = 0;
-
- mntfile = setmntent("/proc/mounts", "r");
- if (!mntfile)
- return -1;
-
-+ build_fn_table = tab;
-+ build_fn_type = type;
-+
- while ((mntent = getmntent(mntfile))) {
-- char *path[] = { mntent->mnt_dir, NULL };
-+ char *path = mntent->mnt_dir;
-
- if (strncmp(mntent->mnt_type, "bpf", 3) != 0)
- continue;
--
-- fts = fts_open(path, 0, NULL);
-- if (!fts)
-- continue;
--
-- while ((ftse = fts_read(fts))) {
-- if (!(ftse->fts_info & FTS_F))
-- continue;
-- fd = open_obj_pinned(ftse->fts_path, true);
-- if (fd < 0)
-- continue;
--
-- objtype = get_fd_type(fd);
-- if (objtype != type) {
-- close(fd);
-- continue;
-- }
-- memset(&pinned_info, 0, sizeof(pinned_info));
-- err = bpf_obj_get_info_by_fd(fd, &pinned_info, &len);
-- if (err) {
-- close(fd);
-- continue;
-- }
--
-- obj_node = malloc(sizeof(*obj_node));
-- if (!obj_node) {
-- close(fd);
-- fts_close(fts);
-- fclose(mntfile);
-- return -1;
-- }
--
-- memset(obj_node, 0, sizeof(*obj_node));
-- obj_node->id = pinned_info.id;
-- obj_node->path = strdup(ftse->fts_path);
-- hash_add(tab->table, &obj_node->hash, obj_node->id);
--
-- close(fd);
-- }
-- fts_close(fts);
-+ err = nftw(path, do_build_table_cb, nopenfd, flags);
-+ if (err)
-+ break;
- }
- fclose(mntfile);
-- return 0;
-+ return err;
- }
-
- void delete_pinned_obj_table(struct pinned_obj_table *tab)
---- a/tools/bpf/bpftool/main.h
-+++ b/tools/bpf/bpftool/main.h
-@@ -196,8 +196,8 @@ int cmd_select(const struct cmd *cmds, i
- int get_fd_type(int fd);
- const char *get_fd_type_name(enum bpf_obj_type type);
- char *get_fdinfo(int fd, const char *key);
--int open_obj_pinned(char *path, bool quiet);
--int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type);
-+int open_obj_pinned(const char *path, bool quiet);
-+int open_obj_pinned_any(const char *path, enum bpf_obj_type exp_type);
- int mount_bpffs_for_pin(const char *name);
- int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(int *, char ***));
- int do_pin_fd(int fd, const char *name);