summaryrefslogtreecommitdiff
path: root/net-libs/xdp-tools
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-11-22 17:18:34 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-11-22 17:18:34 +0000
commitfd87b7c771378b2116981e3924bee5805148e118 (patch)
tree91ed28393c7b534787d3c073e269fe598d0fd535 /net-libs/xdp-tools
parent77b74be093bdf4a0ed4121acc3f8e229103cf004 (diff)
gentoo auto-resync : 22:11:2023 - 17:18:34
Diffstat (limited to 'net-libs/xdp-tools')
-rw-r--r--net-libs/xdp-tools/Manifest4
-rw-r--r--net-libs/xdp-tools/files/1.4.1-fix-memory-leak-in-xsk_setup_xdp_prog.patch34
-rw-r--r--net-libs/xdp-tools/files/1.4.1-no-Werror.patch75
-rw-r--r--net-libs/xdp-tools/xdp-tools-1.4.1-r1.ebuild (renamed from net-libs/xdp-tools/xdp-tools-1.4.1.ebuild)24
4 files changed, 55 insertions, 82 deletions
diff --git a/net-libs/xdp-tools/Manifest b/net-libs/xdp-tools/Manifest
index e65e3f54c4af..5223f409aed8 100644
--- a/net-libs/xdp-tools/Manifest
+++ b/net-libs/xdp-tools/Manifest
@@ -1,8 +1,8 @@
AUX 1.4.0-no-Werror.patch 2521 BLAKE2B e424b9fb203b78d45f49c5a1264c01509b6da2a95914ca713e43d9e444a5a3b360323b44bdba547035dff46d880197626eb0999532772c5f2757205c280ff272 SHA512 06a10e5c7bf4bf841dfab692c9dc18b8d1a1730426f4ef92de278a604a98aa7833dff547fd6ecc284d0f0111c0e1011bd8d14315451f0e5963ca64264e8891b7
AUX 1.4.0-toolchain.patch 2479 BLAKE2B c907fa98fff2ad93d0f72d75237bff6fc7aab05e10e76d5b30555b0a7d64f6012f1555d806acf0127019d0ec2f39eeeb7741d62bf858ab1d9da5e9c85fc33c48 SHA512 6321960eca342a2d89e2118c0c8826dd415871e79e9f7685e1d4b44d1e2af987cc7a4c893c1b98578df8075e0705d1279131c6e2356ca5fd86d4c3d8ba22495d
-AUX 1.4.1-no-Werror.patch 2572 BLAKE2B 84b12eb07711e98d1152a4edc2b128875c3097bb83dca81939654a201c31ca4db8ad5dae93408d1735bff93330a703b98bdfebae7f4a23312b591b8f8101c514 SHA512 d2ba04104e601bdae59ebeede4ffb950f342b559363e09944c9f3da83ad277db2a9410268bf14fc59136890f3e0cfd20a29041a1879f4cb70e70788f033dfdf1
+AUX 1.4.1-fix-memory-leak-in-xsk_setup_xdp_prog.patch 1120 BLAKE2B c922ec5fec6b4a7d73289a56aab40505dfca1d79ec36038631e6c337fcc5aa6c22671110b278bfd9e8fc68410a212bf3a1b9bdc8a61e867d0c803c554607e266 SHA512 05387a2625dc25349d8ac941c16fc0fd9216453c771cdd166bfef0afba61df512888bd9e14b55222f51b5956fd54db41b45be0487fd8fc0fd65d861109837aac
DIST xdp-tools-1.4.0.tar.gz 337221 BLAKE2B 008dda0fcfd403e47ab2b8c801fc0a5c4e103fb3b9869f1d1bf5af258fc646dd5a0285d3126c012c9b81805408b9669da886b9fcf2fdf33b256f74bbf898222a SHA512 c17bd6e9e6e4cf59c33f4b9ae4e3e0434863d147abf80f87b425215261b96d4574898fa09cc2b201a427a5e9d49ad64d0c70e50e3f72e3a18c6fbdf7f4cd4a3a
DIST xdp-tools-1.4.1.tar.gz 339878 BLAKE2B 30ed245dd0da8404cf67313ea4d5f9a148507d14bd7330bdac3b03c07d1cc0b38eb1a376636551cb8ea14c8a2e77d02527da363733a1059e1c2ebaee9ac90392 SHA512 9d2ad42713aa53c10ccbde2c344bf2696524e317544f3693114b343ab74240187699c3802cfc6efa05b3e9f9bfec80fd2537799aa3ae050717bb1f6aab435996
EBUILD xdp-tools-1.4.0.ebuild 2015 BLAKE2B 76c9ad09ca28716601086b670346d2325f22913cfc216bdc23e34b1a72670e936b757e23954a8b3195697c584054100e70965dbf9f5efcf91cd790d485d79b19 SHA512 934a9be5bd6846c1f143f0dc2b9dcf7de34a96f4751d004ecf7ecd4a485361f65bae153c04cb212ceffbfe5ba137712874bfd8f33e1b28d41aa6208c5b4a331d
-EBUILD xdp-tools-1.4.1.ebuild 1979 BLAKE2B c34afc8b4fedffdc13f73f42291916a644fcf02107c9d21fad8a3e6d566561e1d1fd8cc4bb437bd6d26e1ed579d743e47b5c02c3115d30c6a1b56c5747578cc3 SHA512 5fc6d6adcd5bbb02692a006d0571706bec5e2befa4b029700329c97ee5b751bdd802d0e24993bbc5131cd74139390ef3858ddcaaa15ab7cb74c02003ff770d08
+EBUILD xdp-tools-1.4.1-r1.ebuild 2329 BLAKE2B 4cf52b9296546ce05f589884df22df36829276adbca4a29cec03004e883ce071617cff6d6dcf1b3926332cd7771f702e9d6ecbddbafe382be70e97646846f0ae SHA512 f9def7fc956d91f74ad7e36621b764fc3b1ec128ae90fa2c6bc67285cd38f96237050e628c9ecc338854920cf36df94d84a23a82ce8329d900490d37af7564a5
MISC metadata.xml 731 BLAKE2B a9c958d31f9ece376e4518e213823c14474df47747205020b76da7a0a67f7ed926ec55002b586143ce84cb965a23ad1794a42862597278682ef3605fc7d07911 SHA512 78774e4bcc6e05d56fe82b0aacd46e4d23e3bd89aa5bb55900adb94648d06b3251c575d4d0b6108cdad0f2ffbabcc2973e50e804b120a73e8923cd679601384f
diff --git a/net-libs/xdp-tools/files/1.4.1-fix-memory-leak-in-xsk_setup_xdp_prog.patch b/net-libs/xdp-tools/files/1.4.1-fix-memory-leak-in-xsk_setup_xdp_prog.patch
new file mode 100644
index 000000000000..6c95a970f876
--- /dev/null
+++ b/net-libs/xdp-tools/files/1.4.1-fix-memory-leak-in-xsk_setup_xdp_prog.patch
@@ -0,0 +1,34 @@
+
+Patch from:
+https://github.com/xdp-project/xdp-tools/commit/cae9c91353cd3ed51753168203ed101905b9ac9e
+
+From cae9c91353cd3ed51753168203ed101905b9ac9e Mon Sep 17 00:00:00 2001
+From: Ric Li <ming3.li@intel.com>
+Date: Tue, 21 Nov 2023 15:36:57 +0800
+Subject: [PATCH] libxdp: Fix xdp prog memory leak in xsk_setup_xdp_prog
+
+In the xsk_setup_xdp_prog function, the xsk structure
+temporarily takes ownership of an xdp_prog and stores it in
+ctx->xdp_prog. However, the allocated memory is not freed
+in xsk_destroy_xsk_struct, leading to a memory leak. This
+commit addresses the issue by adding a call to
+xdp_program_close to properly release the allocated
+xdp_prog memory.
+
+Signed-off-by: Ric Li <ming3.li@intel.com>
+---
+ lib/libxdp/xsk.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/libxdp/xsk.c b/lib/libxdp/xsk.c
+index a854f771..b3527fb6 100644
+--- a/lib/libxdp/xsk.c
++++ b/lib/libxdp/xsk.c
+@@ -978,6 +978,7 @@ static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk,
+
+ static void xsk_destroy_xsk_struct(struct xsk_socket *xsk)
+ {
++ xdp_program__close(xsk->ctx->xdp_prog);
+ free(xsk->ctx);
+ free(xsk);
+ }
diff --git a/net-libs/xdp-tools/files/1.4.1-no-Werror.patch b/net-libs/xdp-tools/files/1.4.1-no-Werror.patch
deleted file mode 100644
index 52c50261f5d8..000000000000
--- a/net-libs/xdp-tools/files/1.4.1-no-Werror.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-
-Bug: https://bugs.gentoo.org/899744
-
-diff --git a/lib/Makefile b/lib/Makefile
-index 5ee035d..5342ab3 100644
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -1,5 +1,5 @@
-
--LIBBPF_CFLAGS:=$(if $(CFLAGS),$(CFLAGS),-g -O2 -Werror -Wall) -fPIC
-+LIBBPF_CFLAGS:=$(if $(CFLAGS),$(CFLAGS),-g -O2 -Wall) -fPIC
-
- LIB_DIR = .
- include defines.mk
-diff --git a/lib/common.mk b/lib/common.mk
-index b680a75..8dbcb39 100644
---- a/lib/common.mk
-+++ b/lib/common.mk
-@@ -116,7 +116,6 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EXTRA_DEPS) $(BPF_HEADERS) $(LIBMK)
- -Wno-unused-value \
- -Wno-pointer-sign \
- -Wno-compare-distinct-pointer-types \
-- -Werror \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-
-diff --git a/lib/defines.mk b/lib/defines.mk
-index 54b259f..ed246c0 100644
---- a/lib/defines.mk
-+++ b/lib/defines.mk
-@@ -40,7 +40,7 @@ endif
-
- DEFINES += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-
--CFLAGS += -std=gnu11 -Wextra -Werror $(DEFINES) $(ARCH_INCLUDES)
-+CFLAGS += -std=gnu11 -Wextra $(DEFINES) $(ARCH_INCLUDES)
- BPF_CFLAGS += $(DEFINES) $(filter -ffile-prefix-map=%,$(CFLAGS)) $(ARCH_INCLUDES)
-
- CONFIGMK := $(LIB_DIR)/../config.mk
-diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
-index 431932a..a0c625d 100644
---- a/lib/libxdp/Makefile
-+++ b/lib/libxdp/Makefile
-@@ -142,7 +142,6 @@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(LIBMK)
- -Wno-unused-value \
- -Wno-pointer-sign \
- -Wno-compare-distinct-pointer-types \
-- -Werror \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-
-diff --git a/lib/libxdp/tests/Makefile b/lib/libxdp/tests/Makefile
-index 3c22901..a4463f3 100644
---- a/lib/libxdp/tests/Makefile
-+++ b/lib/libxdp/tests/Makefile
-@@ -72,7 +72,6 @@ $(BPF_OBJS): %.o: %.c $(BPF_HEADERS) $(LIBMK) $(EXTRA_DEPS)
- -Wno-unused-value \
- -Wno-pointer-sign \
- -Wno-compare-distinct-pointer-types \
-- -Werror \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-
-diff --git a/lib/util/Makefile b/lib/util/Makefile
-index 24070f0..37485b3 100644
---- a/lib/util/Makefile
-+++ b/lib/util/Makefile
-@@ -26,7 +26,6 @@ $(UTIL_BPF_OBJS): %.o: %.c $(KERN_USER_H) $(BPF_HEADERS) $(LIBMK)
- -Wno-unused-value \
- -Wno-pointer-sign \
- -Wno-compare-distinct-pointer-types \
-- -Werror \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-
diff --git a/net-libs/xdp-tools/xdp-tools-1.4.1.ebuild b/net-libs/xdp-tools/xdp-tools-1.4.1-r1.ebuild
index 53974f63d493..a56fcf10ba5b 100644
--- a/net-libs/xdp-tools/xdp-tools-1.4.1.ebuild
+++ b/net-libs/xdp-tools/xdp-tools-1.4.1-r1.ebuild
@@ -33,12 +33,29 @@ QA_PREBUILT="usr/lib/bpf/*.o"
MAKEOPTS+=" V=1"
PATCHES=(
- "${FILESDIR}"/1.4.1-no-Werror.patch
+ "${FILESDIR}"/1.4.1-fix-memory-leak-in-xsk_setup_xdp_prog.patch
)
+src_prepare() {
+ # remove -Werror: #899744
+ sed -i 's/-Werror//g' lib/Makefile lib/defines.mk || die
+ sed -i '/-Werror/d' lib/common.mk lib/libxdp/Makefile \
+ lib/libxdp/tests/Makefile lib/util/Makefile || die
+
+ default
+}
+
src_configure() {
+ # filter LTO: #861587
+ filter-lto
+
+ # filter LDFLAGS some more: #916591
+ filter-ldflags -Wl,--{icf,lto}*
+
+ # force ld.bfd: #916591
+ tc-ld-force-bfd
+
export CC="$(tc-getCC)"
- export LD="$(tc-getLD)"
export PREFIX="${EPREFIX}/usr"
export LIBDIR="${PREFIX}/$(get_libdir)"
export BPF_OBJECT_DIR="${PREFIX}/lib/bpf"
@@ -46,9 +63,6 @@ src_configure() {
export DYNAMIC_LIBXDP=1
export FORCE_SYSTEM_LIBBPF=1
- # bug 861587
- filter-lto
-
default
}