View Issue Details

IDProjectCategoryView StatusLast Update
0008810GNUnetDHT servicepublic2024-06-08 12:03
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86-64OSGuix SystemOS Versiona1d711c92e
Product VersionGit master 
Fixed in Version0.21.2 
Summary0008810: segmentation fault when stopping gnunet-service-dht
DescriptionSome time back, the DHT underlay plugins were switched to being compiled-in. At that time, GDS_Underlay.libname stopped being set, but was still present in the struct, taking on the default value of NULL because GNUNET_malloc zeroes the memory it returns. A call to GNUNET_PLUGIN_unload that passes in libname remained, however, despite there now being hardcoded logic in shutdown_task that does the cleanup for the underlays itself. The resulting NULL is passed to strcmp, causing a segmentation fault.
Steps To Reproduce1. Build gnunet with --enable-sanitizer (or don't, it will just be less obvious where it's happening)
2. Start the node with gnunet-arm -s
3. Stop the node after a bit with gnunet-arm -e
4. Observe segmentation fault wherever you've configured dht to log to
Additional InformationPatch attached which removes the GDS_Underlay.libname field and the call to GNUNET_PLUGIN_unload.
TagsNo tags attached.
Attached Files
0001-dht-remove-vestigial-GNUNET_PLUGIN_unload.patch (1,181 bytes)   
From b1abcc15de281f6efe4de7b631e200f7ce52110b Mon Sep 17 00:00:00 2001
From: ulfvonbelow <striness@tilde.club>
Date: Sat, 4 May 2024 20:25:19 -0500
Subject: [PATCH] dht: remove vestigial GNUNET_PLUGIN_unload.

u->libname is no longer set, so this passes in NULL, which is then passed to
strcmp() and causes a segfault.

Also remove the libname field from struct GDS_Underlay entirely.
---
 src/service/dht/gnunet-service-dht.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/service/dht/gnunet-service-dht.c b/src/service/dht/gnunet-service-dht.c
index ab9e179bc..4579bfc2b 100644
--- a/src/service/dht/gnunet-service-dht.c
+++ b/src/service/dht/gnunet-service-dht.c
@@ -79,11 +79,6 @@ struct GDS_Underlay
    * Name of the underlay (i.e. "gnunet" or "ip").
    */
   char *name;
-
-  /**
-   * Name of the library providing the underlay.
-   */
-  char *libname;
 };
 
 
@@ -383,8 +378,6 @@ shutdown_task (void *cls)
 
   while (NULL != (u = u_head))
   {
-    GNUNET_PLUGIN_unload (u->libname,
-                          u->dhtu);
     GNUNET_CONTAINER_DLL_remove (u_head,
                                  u_tail,
                                  u);
-- 
2.41.0

Activities

schanzen

2024-05-13 10:46

administrator   ~0022394

Applied

schanzen

2024-06-08 12:03

administrator   ~0022535

0.21.2 released

Issue History

Date Modified Username Field Change
2024-05-07 05:24 ulfvonbelow New Issue
2024-05-07 05:24 ulfvonbelow File Added: 0001-dht-remove-vestigial-GNUNET_PLUGIN_unload.patch
2024-05-13 10:46 schanzen Assigned To => schanzen
2024-05-13 10:46 schanzen Status new => resolved
2024-05-13 10:46 schanzen Resolution open => fixed
2024-05-13 10:46 schanzen Fixed in Version => 0.21.2
2024-05-13 10:46 schanzen Note Added: 0022394
2024-06-08 12:03 schanzen Note Added: 0022535
2024-06-08 12:03 schanzen Status resolved => closed