From 3d1a41e10ab75a37319a432bd124902ee650f4db Mon Sep 17 00:00:00 2001 From: Sergey Nikitin Date: Wed, 22 Apr 2026 13:48:17 +0300 Subject: [PATCH] tools/ip: avoid segfault in stackdump if libpcap-dev is missing Initialize 'stacks_list' before calling sockbuf_filter_prepare() to avoid using it uninitialized on exit. Before the patch (on Ubuntu without libpcap-dev): $ sudo onload_stackdump --filter "dst port 80" Onload was compiled without the libpcap development package. You need to install the libpcap-devel or libpcap-dev package to use the --filter option of this tool.Segmentation fault Signed-off-by: Sergey Nikitin --- src/tools/ip/libstack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/ip/libstack.c b/src/tools/ip/libstack.c index 3d1f4143d..90559b868 100644 --- a/src/tools/ip/libstack.c +++ b/src/tools/ip/libstack.c @@ -2891,11 +2891,11 @@ static void signal_handler(int signum) int libstack_init() { + ci_set_log_prefix(""); + ci_dllist_init(&stacks_list); if( cfg_filter ) if( ! sockbuf_filter_prepare(&sft, cfg_filter) ) return -1; - ci_set_log_prefix(""); - ci_dllist_init(&stacks_list); if( libstack_mappings_init() ) return -1; CI_TEST(signal(SIGUSR1, signal_handler) != SIG_ERR);