summaryrefslogtreecommitdiff
path: root/net-libs/xdp-tools/files
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/files
parent77b74be093bdf4a0ed4121acc3f8e229103cf004 (diff)
gentoo auto-resync : 22:11:2023 - 17:18:34
Diffstat (limited to 'net-libs/xdp-tools/files')
-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
2 files changed, 34 insertions, 75 deletions
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}
-