net-snmp: fix memory leak
Sorry for interupt.
Please revert my patch.
After I rebase the latest codes from kirkstone. I found my patch had a bad character. This caused net-snmp do_patch failure.
After some tries, I still failed to resolve this.
The cherry-pick in my side picked copyright change. But after sending the patch via git send-mail, the character changed.
Sorry again.
Thanks.
Jinfeng
Quoted 79 lines · Jinfeng (CN) via lists.openembedded.org
From: Jinfeng Wang <[email protected]>
Backport patch [1] to fix memory leak by freeing tclist
[1] https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62Signed-off-by Jinfeng Wang <[email protected]>--- ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++ .../net-snmp/net-snmp_5.9.3.bb | 1 + 2 files changed, 41 insertions(+)create mode 100644
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patchmeta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch new file +40
-0@@ -0,0 +1,40 @@ +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001 +From: JanSoundhouse <[email protected]> +Date: Mon, 5 Sep 2022 11:25:58 +0200 +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist + +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd. + +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62] + +Signed-off-by: Jinfeng Wang <[email protected]> +--- + snmplib/parse.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/snmplib/parse.c b/snmplib/parse.c +index b3e2f3ae5c..71bdf75ff8 100644 +--- a/snmplib/parse.c ++++ b/snmplib/parse.c +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + ******************************************************************/ + /* +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms specified in the COPYING file + * distributed with the Net-SNMP package. + */ +@@ -4215,7 +4215,8 @@ unload_all_mibs(void) + if (ptc->description) + free(ptc->description); + } +- memset(tclist, 0, tc_alloc * sizeof(struct tc)); ++ SNMP_FREE(tclist); ++ tc_alloc = 0; + + memset(buckets, 0, sizeof(buckets)); + memset(nbuckets, 0, sizeof(nbuckets)); +-- +2.34.1 +meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +1
-1@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ file://reproducibility-have-printcap.patch \ file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ file://CVE-2022-44792-CVE-2022-44793.patch \ + file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \ " SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#115527): https://lists.openembedded.org/g/openembedded-devel/message/115527
Mute This Topic: https://lists.openembedded.org/mt/111282761/8617462
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
From: [email protected] <[email protected]> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <[email protected]>
Sent: Monday, March 10, 2025 08:01
To: [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Warning
This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments. If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
See the SecureWay group in Yammer for more security information.
Sorry for interupt.
Please revert my patch.
After I rebase the latest codes from kirkstone. I found my patch had a bad character. This caused net-snmp do_patch failure.
After some tries, I still failed to resolve this.
The cherry-pick in my side picked copyright change. But after sending the patch via git send-mail, the character changed.
Sorry again.
Thanks.
Jinfeng
Quoted 66 lines · Jinfeng (CN) via lists.openembedded.org
From: Jinfeng Wang <[email protected]>
Backport patch [1] to fix memory leak by freeing tclist
[1] https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62Signed-off-by Jinfeng Wang <[email protected]>--- ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++ .../net-snmp/net-snmp_5.9.3.bb | 1 + 2 files changed, 41 insertions(+)create mode 100644
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patchmeta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch new file +40
-0@@ -0,0 +1,40 @@ +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001 +From: JanSoundhouse <[email protected]> +Date: Mon, 5 Sep 2022 11:25:58 +0200 +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist + +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd. + +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62] + +Signed-off-by: Jinfeng Wang <[email protected]> +--- + snmplib/parse.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/snmplib/parse.c b/snmplib/parse.c +index b3e2f3ae5c..71bdf75ff8 100644 +--- a/snmplib/parse.c ++++ b/snmplib/parse.c +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + ******************************************************************/ + /* +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms specified in the COPYING file + * distributed with the Net-SNMP package. + */ +@@ -4215,7 +4215,8 @@ unload_all_mibs(void) + if (ptc->description) + free(ptc->description); + } +- memset(tclist, 0, tc_alloc * sizeof(struct tc)); ++ SNMP_FREE(tclist); ++ tc_alloc = 0; + + memset(buckets, 0, sizeof(buckets)); + memset(nbuckets, 0, sizeof(nbuckets)); +-- +2.34.1 +meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +0
-0
meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ · line 33
Quoted 7 lines
meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +1
-0@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ file://reproducibility-have-printcap.patch \ file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ file://CVE-2022-44792-CVE-2022-44793.patch \ + file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \ " SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"
Hello,
The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working. See my patch below:
From 54ba004a7c12cddcbcb020878fb03bbf52db2855 Mon Sep 17 00:00:00 2001
From: Piotr Lewicki <[email protected]>
Date: Mon, 10 Mar 2025 10:18:27 +0100
Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
leak
In commit d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5e the patch that fixes a memory leak has been backported to kirkstone branch, but it was not adapted. This commit adapts the patch to apply properly on this branch.
--- ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch +2 -11
@@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <[email protected]> 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snmplib/parse.c b/snmplib/parse.c -index b3e2f3ae5c..71bdf75ff8 100644 +index 9406f4f..2f9a201 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c -@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. - ******************************************************************/ - /* -- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms specified in the COPYING file - * distributed with the Net-SNMP package. - */ -@@ -4215,7 +4215,8 @@ unload_all_mibs(void) +@@ -4225,7 +4225,8 @@ unload_all_mibs(void) if (ptc->description) free(ptc->description); }
--
2.34.1
Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.
That character change in the comment doesn't look material for the fix to take effect, it could be even left out of the backport completely.
Quoted 171 lines · Piotr L Lewicki via lists.openembedded.org
From: [email protected] <[email protected]> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <[email protected]>
Sent: Monday, March 10, 2025 08:01
To: [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Warning
This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments. If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
See the SecureWay group in Yammer for more security information.Sorry for interupt.
Please revert my patch.
After I rebase the latest codes from kirkstone. I found my patch had a bad character. This caused net-snmp
do_patchfailure.After some tries, I still failed to resolve this.
The cherry-pick in my side picked copyright change. But after sending the patch via git send-mail, the character changed.
Sorry again.
Thanks.
Jinfeng
Quoted 66 lines · Jinfeng (CN) via lists.openembedded.org
From: Jinfeng Wang <[email protected]>
Backport patch [1] to fix memory leak by freeing tclist
[1] https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62Signed-off-by Jinfeng Wang <[email protected]>--- ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++ .../net-snmp/net-snmp_5.9.3.bb | 1 + 2 files changed, 41 insertions(+)create mode 100644
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patchmeta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch new file +40
-0@@ -0,0 +1,40 @@ +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001 +From: JanSoundhouse <[email protected]> +Date: Mon, 5 Sep 2022 11:25:58 +0200 +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist + +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd. + +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62] + +Signed-off-by: Jinfeng Wang <[email protected]> +--- + snmplib/parse.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/snmplib/parse.c b/snmplib/parse.c +index b3e2f3ae5c..71bdf75ff8 100644 +--- a/snmplib/parse.c ++++ b/snmplib/parse.c +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + ******************************************************************/ + /* +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms specified in the COPYING file + * distributed with the Net-SNMP package. + */ +@@ -4215,7 +4215,8 @@ unload_all_mibs(void) + if (ptc->description) + free(ptc->description); + } +- memset(tclist, 0, tc_alloc * sizeof(struct tc)); ++ SNMP_FREE(tclist); ++ tc_alloc = 0; + + memset(buckets, 0, sizeof(buckets)); + memset(nbuckets, 0, sizeof(nbuckets)); +-- +2.34.1 +meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +0
-0meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ · line 33
Quoted 7 lines
meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +1
-0@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ file://reproducibility-have-printcap.patch \ file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ file://CVE-2022-44792-CVE-2022-44793.patch \ + file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \ " SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"Hello,
The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working. See my patch below:From
54ba004a7c12cddcbcb020878fb03bbf52db2855Mon Sep 17 00:00:00 2001
From: Piotr Lewicki <[email protected]>
Date: Mon, 10 Mar 2025 10:18:27 +0100
Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
leakIn commit
d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5ethe patch that fixes a memory leak has been backported to kirkstone branch, but it was not adapted. This commit adapts the patch to apply properly on this branch.Signed-off-by Piotr Lewicki <[email protected]>--- ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch +2
-12@@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <[email protected]> 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snmplib/parse.c b/snmplib/parse.c -index b3e2f3ae5c..71bdf75ff8 100644 +index 9406f4f..2f9a201 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c -@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. - ******************************************************************/ - /* -- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms specified in the COPYING file - * distributed with the Net-SNMP package. - */ -@@ -4215,7 +4215,8 @@ unload_all_mibs(void) +@@ -4225,7 +4225,8 @@ unload_all_mibs(void) if (ptc->description) free(ptc->description); } --2.34.1
Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115826): https://lists.openembedded.org/g/openembedded-devel/message/115826
Mute This Topic: https://lists.openembedded.org/mt/111282761/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Thanks for all your suggestions.
I tried to send my patch via "git send-mail", but every time after I saved my patch email, it failed to patch the *.eml in the git repo.
So could you please merge my pull request:
https://github.com/openembedded/meta-openembedded/pull/947
Thanks,
Jinfeng
Quoted 178 lines · Gyorgy Sarvari
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.That character change in the comment doesn't look material for the fix to take effect, it could be even left out of the backport completely.
Quoted 171 lines · Piotr L Lewicki via lists.openembedded.org
From: [email protected] <[email protected]> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <[email protected]>
Sent: Monday, March 10, 2025 08:01
To: [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Warning
This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments. If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
See the SecureWay group in Yammer for more security information.Sorry for interupt.
Please revert my patch.
After I rebase the latest codes from kirkstone. I found my patch had a bad character. This caused net-snmp
do_patchfailure.After some tries, I still failed to resolve this.
The cherry-pick in my side picked copyright change. But after sending the patch via git send-mail, the character changed.
Sorry again.
Thanks.
Jinfeng
Quoted 66 lines · Jinfeng (CN) via lists.openembedded.org
From: Jinfeng Wang <[email protected]>
Backport patch [1] to fix memory leak by freeing tclist
[1] https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62Signed-off-by Jinfeng Wang <[email protected]>--- ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++ .../net-snmp/net-snmp_5.9.3.bb | 1 + 2 files changed, 41 insertions(+)create mode 100644
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patchmeta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch new file +40
-0@@ -0,0 +1,40 @@ +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001 +From: JanSoundhouse <[email protected]> +Date: Mon, 5 Sep 2022 11:25:58 +0200 +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist + +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd. + +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62] + +Signed-off-by: Jinfeng Wang <[email protected]> +--- + snmplib/parse.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/snmplib/parse.c b/snmplib/parse.c +index b3e2f3ae5c..71bdf75ff8 100644 +--- a/snmplib/parse.c ++++ b/snmplib/parse.c +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + ******************************************************************/ + /* +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms specified in the COPYING file + * distributed with the Net-SNMP package. + */ +@@ -4215,7 +4215,8 @@ unload_all_mibs(void) + if (ptc->description) + free(ptc->description); + } +- memset(tclist, 0, tc_alloc * sizeof(struct tc)); ++ SNMP_FREE(tclist); ++ tc_alloc = 0; + + memset(buckets, 0, sizeof(buckets)); + memset(nbuckets, 0, sizeof(nbuckets)); +-- +2.34.1 +meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +0
-0meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ · line 33
Quoted 7 lines
meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +1
-0@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ file://reproducibility-have-printcap.patch \ file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ file://CVE-2022-44792-CVE-2022-44793.patch \ + file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \ " SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"Hello,
The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working. See my patch below:From
54ba004a7c12cddcbcb020878fb03bbf52db2855Mon Sep 17 00:00:00 2001
From: Piotr Lewicki <[email protected]>
Date: Mon, 10 Mar 2025 10:18:27 +0100
Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
leakIn commit
d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5ethe patch that fixes a memory leak has been backported to kirkstone branch, but it was not adapted. This commit adapts the patch to apply properly on this branch.Signed-off-by Piotr Lewicki <[email protected]>--- ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch +2
-12@@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <[email protected]> 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snmplib/parse.c b/snmplib/parse.c -index b3e2f3ae5c..71bdf75ff8 100644 +index 9406f4f..2f9a201 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c -@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. - ******************************************************************/ - /* -- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms specified in the COPYING file - * distributed with the Net-SNMP package. - */ -@@ -4215,7 +4215,8 @@ unload_all_mibs(void) +@@ -4225,7 +4225,8 @@ unload_all_mibs(void) if (ptc->description) free(ptc->description); } --2.34.1
Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115826): https://lists.openembedded.org/g/openembedded-devel/message/115826
Mute This Topic: https://lists.openembedded.org/mt/111282761/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
From: [email protected] <[email protected]> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <[email protected]>
Sent: Tuesday, March 11, 2025 07:46
To: Gyorgy Sarvari <[email protected]>; Piotr L Lewicki <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Warning
This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments. If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
See the SecureWay group in Yammer for more security information.
Thanks for all your suggestions.
I tried to send my patch via "git send-mail", but every time after I saved my patch email, it failed to patch the *.eml in the git repo.
So could you please merge my pull request:
https://github.com/openembedded/meta-openembedded/pull/947
Thanks,
Jinfeng
Quoted 166 lines · Gyorgy Sarvari
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.That character change in the comment doesn't look material for the fix to take effect, it could be even left out of the backport completely.
Quoted 159 lines · Piotr L Lewicki via lists.openembedded.org
From: [email protected] <[email protected]> on behalf of Wang, Jinfeng (CN) via lists.openembedded.org <[email protected]>
Sent: Monday, March 10, 2025 08:01
To: [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [oe] [kirkstone][meta-networking][PATCH] net-snmp: fix memory leak[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Warning
This email comes from outside of Hitachi Energy. Make sure you verify the sender before clicking any links or downloading/opening attachments. If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook.
See the SecureWay group in Yammer for more security information.Sorry for interupt.
Please revert my patch.
After I rebase the latest codes from kirkstone. I found my patch had a bad character. This caused net-snmp
do_patchfailure.After some tries, I still failed to resolve this.
The cherry-pick in my side picked copyright change. But after sending the patch via git send-mail, the character changed.
Sorry again.
Thanks.
Jinfeng
Quoted 66 lines · Jinfeng (CN) via lists.openembedded.org
From: Jinfeng Wang <[email protected]>
Backport patch [1] to fix memory leak by freeing tclist
[1] https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62Signed-off-by Jinfeng Wang <[email protected]>--- ...bs-fix-memory-leak-by-freeing-tclist.patch | 40 +++++++++++++++++++ .../net-snmp/net-snmp_5.9.3.bb | 1 + 2 files changed, 41 insertions(+)create mode 100644
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patchmeta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch new file +40
-0@@ -0,0 +1,40 @@ +From 4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62 Mon Sep 17 00:00:00 2001 +From: JanSoundhouse <[email protected]> +Date: Mon, 5 Sep 2022 11:25:58 +0200 +Subject: [PATCH] unload_all_mibs: fix memory leak by freeing tclist + +tclist is always allocated in netsnmp_init_mib_internals, when doing multiple init_snmp("")/snmp_shutdown("") this memory is never free'd. + +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/4bd0d9a8a2860c2c46307aef5ee1ccc69f7e3b62] + +Signed-off-by: Jinfeng Wang <[email protected]> +--- + snmplib/parse.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/snmplib/parse.c b/snmplib/parse.c +index b3e2f3ae5c..71bdf75ff8 100644 +--- a/snmplib/parse.c ++++ b/snmplib/parse.c +@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + ******************************************************************/ + /* +- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms specified in the COPYING file + * distributed with the Net-SNMP package. + */ +@@ -4215,7 +4215,8 @@ unload_all_mibs(void) + if (ptc->description) + free(ptc->description); + } +- memset(tclist, 0, tc_alloc * sizeof(struct tc)); ++ SNMP_FREE(tclist); ++ tc_alloc = 0; + + memset(buckets, 0, sizeof(buckets)); + memset(nbuckets, 0, sizeof(nbuckets)); +-- +2.34.1 +meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +0
-0meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ · line 33
Quoted 7 lines
meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.3.bb +1
-0@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ file://reproducibility-have-printcap.patch \ file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ file://CVE-2022-44792-CVE-2022-44793.patch \ + file://0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch \ " SRC_URI[sha256sum] = "2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a"Hello,
The 0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch file needs to be slightly adapted to be working. See my patch below:From
54ba004a7c12cddcbcb020878fb03bbf52db2855Mon Sep 17 00:00:00 2001
From: Piotr Lewicki <[email protected]>
Date: Mon, 10 Mar 2025 10:18:27 +0100
Subject: [meta-oe][kirkstone][PATCH] net-snmp: Adapt patch that fixes memory
leakIn commit
d0c2a3d383dac9fe7e85b7d87784b7f5b5c62c5ethe patch that fixes a memory leak has been backported to kirkstone branch, but it was not adapted. This commit adapts the patch to apply properly on this branch.Signed-off-by Piotr Lewicki <[email protected]>--- ...all_mibs-fix-memory-leak-by-freeing-tclist.patch | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)meta-networking/recipes-protocols/net-snmp/net-snmp/0001-unload_all_mibs-fix-memory-leak-by-freeing-tclist.patch +2
-12@@ -13,19 +13,10 @@ Signed-off-by: Jinfeng Wang <[email protected]> 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snmplib/parse.c b/snmplib/parse.c -index b3e2f3ae5c..71bdf75ff8 100644 +index 9406f4f..2f9a201 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c -@@ -28,7 +28,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. - ******************************************************************/ - /* -- * Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms specified in the COPYING file - * distributed with the Net-SNMP package. - */ -@@ -4215,7 +4215,8 @@ unload_all_mibs(void) +@@ -4225,7 +4225,8 @@ unload_all_mibs(void) if (ptc->description) free(ptc->description); } --2.34.1
Quoted 6 lines
Quoted 6 lines
Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.
The patch is not applying not only because of the special characters, but also due to wrong lines where the unload_all_mibs(void) is pointing to.
I suggest to:
1. Revert the "net-snmp: fix memory leak" patch, because all images that use net-snmp are not building at the moment (at least in my setup).
2. Fix the patch- all the info is in this email. Removing lines with special character is one thing, another is updating the line numbers in the second hunk so that it applies without any problems.
Best,
Piotr Lewicki
Common Linux Team
E-mail: [email protected]
http://www.hitachienergy.com/
---
Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.
Confirmed (if that's of interest),
I second Piotr Lewicki in all aspects, the patch in its current form breaks building of net-snmp recipe.
...Patching patches, patching patches.... :)
All the best,
Tim Dylla
Hi Tim,
If that's of any help - the net-snmp patch is already reverted in "kirkstone-next" branch.
It's unclear to me when/if this will also be ported to "kirkstone".
Best,
Piotr Lewicki
Hitachi Energy Services Sp. z o. o. z siedzibą w Warszawie, adres: Warszawa 04-713, ul. Żegańska 1, wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego w Sądzie Rejonowym dla m. st. Warszawy, XIV Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000787719, nr REGON: 383431370, nr NIP: 9522196923, nr BDO: 000147611, kapitał zakładowy 14 403 850,00 zł.
________________________________
Hitachi Energy Services Sp. z o. o. with registered seat at 1 Żeganska Street, 04-713 Warsaw, Poland, registered in the Register of Entrepreneurs of the Polish Court Register maintained by the District Court for the Capital City of Warsaw, XIV Economic Department, under KRS No. 0000787719, REGON No. (statistical number): 383431370, NIP No. (taxpayer identification number) PL9522196923, BDO No. (WEEE registration number) 000147611, share capital: 14 403 850,00 PLN.
I'm sorry for the incorrect patch.
I send v2.
In v2, I remove the special character and update the line number.
Best regards,
Jinfeng
Quoted 40 lines · tim.dylla.ext via lists.openembedded.org
**
*CAUTION: This email comes from a non Wind River email account!*
Do not click links or open attachments unless you recognize the sender and know the content is safe.[Edited Message Follows]
Confirmed (if that's of interest),
I second Piotr Lewicki in all aspects, the patch in its current form breaks building of net-snmp recipe....Patching patches, patching patches.... :)
All the best,
Tim DyllaThe patch is not applying not only because of the special characters, but also due to wrong lines where the
unload_all_mibs(void)is pointing to.
I suggest to:
1. Revert the "net-snmp: fix memory leak" patch, because all images that use net-snmp are not building at the moment (at least in my setup).
2. Fix the patch- all the info is in this email. Removing lines with special character is one thing, another is updating the line numbers in the second hunk so that it applies without any problems.Best,
Piotr Lewicki
Common Linux Team
E-mail: piotr.l.lewicki@...
http://www.hitachienergy.com/-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#116210):https://lists.openembedded.org/g/openembedded-devel/message/116210 Mute This Topic:https://lists.openembedded.org/mt/111282761/8617462
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-