aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/main.h
diff options
context:
space:
mode:
authorMikhail Sokolovskiy <sokolmish@gmail.com>2023-03-30 13:27:33 +0300
committerMikhail Sokolovskiy <sokolmish@gmail.com>2023-03-30 13:27:33 +0300
commit8309517f23b314e588bf3ad623250f1440908bd3 (patch)
tree8b8a26389c4bdc7de48e2e0c27d6ad67b1aba102 /src/vlib/main.h
parent2844aa186f7d33bc35b99509bfd8e405e998df0b (diff)
vlib: fix segfault on panic in worker
Vlib panic uses longjmp to exit main loop, but workers don't set main_loop_exit field on initialization, so this jump corrupts registers and causes segfault. There I add clib_warning and abort if longjmp context hasn't been set. Type: fix Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com> Change-Id: I0d705f1f139c4083af75066aeb525964ed0aa202
Diffstat (limited to 'src/vlib/main.h')
-rw-r--r--src/vlib/main.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vlib/main.h b/src/vlib/main.h
index a9cfab4f841..94b8c4fa954 100644
--- a/src/vlib/main.h
+++ b/src/vlib/main.h
@@ -377,7 +377,13 @@ always_inline void
vlib_panic_with_error (vlib_main_t * vm, clib_error_t * error)
{
vm->main_loop_error = error;
- clib_longjmp (&vm->main_loop_exit, VLIB_MAIN_LOOP_EXIT_PANIC);
+ if (vm->main_loop_exit_set)
+ clib_longjmp (&vm->main_loop_exit, VLIB_MAIN_LOOP_EXIT_PANIC);
+ else
+ {
+ clib_warning ("panic: %U", format_clib_error, error);
+ abort ();
+ }
}
#define vlib_panic_with_msg(vm,args...) \