Bug #5377
closedsegfault when executing 'no instance' command
100%
Description
We want to employ osmo-config-merge in docker-playground for generating the configuration files:
https://gerrit.osmocom.org/c/docker-playground/+/20622
however the generated osmo-bts.cfg for OML tests (see attached) provokes a segfault:
Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000560f15c98d3b in phy_instance_destroy () (gdb) bt #0 0x0000560f15c98d3b in phy_instance_destroy () #1 0x0000560f15ca5447 in cfg_phy_no_inst () #2 0x00007fafaee29c14 in cmd_execute_command_strict () from /usr/lib/x86_64-linux-gnu/libosmovty.so.9 #3 0x00007fafaee29d98 in config_from_file () from /usr/lib/x86_64-linux-gnu/libosmovty.so.9 #4 0x00007fafaee2d221 in vty_read_config_filep () from /usr/lib/x86_64-linux-gnu/libosmovty.so.9 #5 0x00007fafaee2da1a in vty_read_config_file () from /usr/lib/x86_64-linux-gnu/libosmovty.so.9 #6 0x0000560f15c98343 in bts_main () #7 0x0000560f15c595d4 in main ()
Files
Updated by fixeria over 2 years ago
I recompiled osmo-bts with "-O0 -g", and this is what I get:
Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000560f15c98d3b in phy_instance_destroy (pinst=0x560f16aa01a0) at phy_link.c:133 133 OSMO_ASSERT(pinst->trx->pinst == pinst);
So the problem is that pinst->trx is NULL at the moment of calling phy_instance_destroy():
(gdb) p pinst $1 = (struct phy_instance *) 0x560f16aa01a0 (gdb) p pinst->trx $2 = (struct gsm_bts_trx *) 0x0
Updated by fixeria over 2 years ago
- Status changed from New to Feedback
- % Done changed from 0 to 100
https://gerrit.osmocom.org/c/osmo-bts/+/26692 phy_instance_destroy(): fix NULL pointer dereference [NEW]
This patch fixes the segfault, but the configuration file is still not understood correctly:
Error occurred during reading the below line: phy 0 instance 1 % phy0 instance 1 does not exit
Not really related to this ticket, rather a conceptual problem of osmo-config-merge.
Updated by fixeria over 2 years ago
- Status changed from Feedback to Resolved
Applied in changeset osmo-bts|41d9e2c093e3df6f1d03c6723e190da7dbe7c503.