Project

General

Profile

Actions

Bug #5506

closed

Segmentation fault when osmo-bsc disconnects and then connects again

Added by fixeria over 2 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Start date:
03/31/2022
Due date:
% Done:

100%

Spec Reference:

Description

How to reproduce?

$ telnet localhost 4242
OsmoBSC> en
OsmoBSC# configure terminal
OsmoBSC(config-cbc)#
OsmoBSC(config-cbc)# show running-config
cbc
 mode disabled
 client
  remote-ip 127.0.0.1
OsmoBSC(config-cbc)# mode client  ! osmo-cbc works
OsmoBSC(config-cbc)# mode disabled
OsmoBSC(config-cbc)# mode client  ! osmo-cbc crashes

What happens?

DLINP DEBUG stream.c:950 accept()ed new link from 127.0.0.1 to port 48049
DCBSP DEBUG fsm.c:456 CBSP-SERVER[0x555555620440]{INIT}: Allocated

Thread 1 "osmo-cbc" received signal SIGSEGV, Segmentation fault.
0x00007ffff7ac3e4d in __strcasecmp_l_avx () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff7ac3e4d in __strcasecmp_l_avx () from /usr/lib/libc.so.6
#1  0x000055555555921d in cbc_peer_by_addr_proto (remote_host=remote_host@entry=0x7fffffffdcf0 "127.0.0.1", remote_port=remote_port@entry=41777, 
    proto=proto@entry=CBC_PEER_PROTO_CBSP) at ../../../src/osmo-cbc/src/cbc_data.c:102
#2  0x000055555555a77b in cbsp_cbc_accept_cb (link=0x55555564c3c0, fd=<optimized out>) at ../../../src/osmo-cbc/src/cbsp_server.c:146
#3  0x00007ffff7f5c4c6 in osmo_stream_srv_fd_cb (ofd=<optimized out>, what=<optimized out>) at ../../../src/libosmo-netif/src/stream.c:980
#4  0x00007ffff7c97a2a in poll_disp_fds (n_fd=<optimized out>) at ../../../src/libosmocore/src/select.c:361
#5  _osmo_select_main (polling=polling@entry=0) at ../../../src/libosmocore/src/select.c:399
#6  0x00007ffff7c97aff in osmo_select_main (polling=polling@entry=0) at ../../../src/libosmocore/src/select.c:438
#7  0x0000555555558c05 in main (argc=<optimized out>, argv=<optimized out>) at ../../../src/osmo-cbc/src/cbc_main.c:277
Actions #1

Updated by fixeria over 2 years ago

Here is a bit more information:

(gdb) frame 1
(gdb) p remote_host
$1 = 0x7fffffffdcf0 "127.0.0.1" 
(gdb) p peer
$2 = (struct cbc_peer *) 0x55555564cdf0
(gdb) p *peer
$3 = {list = {next = 0x5555555d6098, prev = 0x55555564e1d0},
      name = 0x0, remote_host = 0x0, remote_port = 0,
      unknown_dynamic_peer = true, proto = CBC_PEER_PROTO_CBSP, 
      client = {cbsp = 0x0, sabp = 0x0}}
(gdb) p peer->remote_host 
$4 = 0x0
Actions #2

Updated by fixeria over 2 years ago

I forgot to mention that I have unknown-peers accept in my config file. Here it is:

cbc
 unknown-peers accept
 cbsp
  local-ip 127.0.0.1
  local-port 48049
 ecbe
  local-ip 127.0.0.1
  local-port 12345
 peer osmo-bsc
  protocol cbsp
  remote-ip 127.0.0.1
  remote-port 48050

Despite the 'osmo-bsc' peer is defined in the configuration, I am still seeing:

DCBSP NOTICE cbsp_server.c:149 r=127.0.0.1:35091<->l=127.0.0.1:48049: Accepting unknown CBSP peer 127.0.0.1:35091
DCBSP NOTICE cbsp_server.c:170 r=127.0.0.1:35091<->l=127.0.0.1:48049: New CBSP client connection from 127.0.0.1:35091

Adding an additional debug print to cbc_peer_by_addr_proto() gives a bit more details:

DLINP DEBUG stream.c:950 accept()ed new link from 127.0.0.1 to port 48049
DCBSP DEBUG fsm.c:456 CBSP-SERVER[0x612000001d20]{INIT}: Allocated
DLGLOBAL FATAL cbc_data.c:104 cbc_peer_by_addr_proto(): comparing to peer=0x60e00002aea0, name=osmo-bsc
DLGLOBAL FATAL cbc_data.c:104 cbc_peer_by_addr_proto(): comparing to peer=0x60e00002b060, name=(null)
Actions #3

Updated by laforge over 2 years ago

  • Assignee set to laforge
Actions #4

Updated by laforge over 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 50
Actions #5

Updated by laforge over 2 years ago

fixeria wrote in #note-2:

Despite the 'osmo-bsc' peer is defined in the configuration, I am still seeing:

DCBSP NOTICE cbsp_server.c:149 r=127.0.0.1:35091<->l=127.0.0.1:48049: Accepting unknown CBSP peer 127.0.0.1:35091

this is due to the fact that the remote port is 35091, whereas your osmo-cbc peer is configured for remote port 49050. So the CBC is correct - this is a new, unknown peer.

So the only bug is the segfault; I cannot see any osmo-cbc fault regarding this comment.

Actions #6

Updated by laforge over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 100
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)