public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/xdp-tools/, net-libs/xdp-tools/files/
Date: Wed, 22 Nov 2023 12:02:54 +0000 (UTC)	[thread overview]
Message-ID: <1700654534.9cc05971105585d9bcd9193b4373f3f806c3cb06.sam@gentoo> (raw)

commit:     9cc05971105585d9bcd9193b4373f3f806c3cb06
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Wed Nov 22 11:52:46 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 22 12:02:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9cc05971

net-libs/xdp-tools: add fix for memory leak in libxdp

Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Closes: https://github.com/gentoo/gentoo/pull/33647
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...4.1-fix-memory-leak-in-xsk_setup_xdp_prog.patch | 34 ++++++++++++++++++++++
 ...ools-1.4.1.ebuild => xdp-tools-1.4.1-r1.ebuild} |  5 ++--
 2 files changed, 37 insertions(+), 2 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/xdp-tools-1.4.1.ebuild b/net-libs/xdp-tools/xdp-tools-1.4.1-r1.ebuild
similarity index 92%
rename from net-libs/xdp-tools/xdp-tools-1.4.1.ebuild
rename to net-libs/xdp-tools/xdp-tools-1.4.1-r1.ebuild
index 520357d07664..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,13 +33,14 @@ QA_PREBUILT="usr/lib/bpf/*.o"
 MAKEOPTS+=" V=1"
 
 PATCHES=(
+	"${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
+	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
+		lib/libxdp/tests/Makefile lib/util/Makefile || die
 
 	default
 }


             reply	other threads:[~2023-11-22 12:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 12:02 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-09 14:39 [gentoo-commits] repo/gentoo:master commit in: net-libs/xdp-tools/, net-libs/xdp-tools/files/ Arthur Zamarin
2024-03-21  2:41 Sam James
2023-10-27  2:59 Sam James
2023-10-27  2:59 Sam James
2023-10-27  2:59 Sam James
2023-07-10  5:30 Sam James
2023-03-10 12:06 Sam James
2022-09-20 22:53 Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1700654534.9cc05971105585d9bcd9193b4373f3f806c3cb06.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox