<p>neels <strong>uploaded patch set #4</strong> to the change originally created by fixeria.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix crashes due to OSMO_ASSERT(conn->lchan)<br><br>Starting from ttcn3-bsc-test-sccplite build #777, it was noticed<br>that osmo-bsc crashes with the following message:<br><br>  Assert failed conn->lchan include/osmocom/bsc/gsm_data.h:1376<br><br>The cause of this is a recently merged patch that calls conn_get_bts() during<br>assignment_fsm rate counter dispatch:<br>"Count assignment rates per BTS as well"<br>commit b5ccf09fc4042c7fb1fdaaa6263961c40b32564e<br>Change-Id I0009e51d4caf68e762138d98e2e23d49acc3cc1a<br><br>The root cause being that the assignment_fsm attempts to count an Assignment<br>event for a BTS after the lchan has already been released and disassociated<br>from the conn.<br><br>The assertion is found in conn_get_bts(), which is used in various places. In<br>fact, each caller is a potential DoS risk -- though most are in code paths that<br>are guaranteed to have an lchan and bts present, having an OSMO_ASSERT() on the<br>relatively volatile presence of an lchan is not a good idea for osmo-bsc's<br>stability and error resilience.<br><br>- Change conn_get_bts() to return NULL in the lack of an lchan.<br>- Adjust all callers of conn_get_bts() to gracefully handle a NULL return val.<br>- Same for cgi_for_msc() and callers, closely related.<br><br>Here is a backtrace:<br><br>  Program received signal SIGABRT<br>  pwndbg> bt<br>    0x0000555555be6e52 in conn_get_bts (conn=0x622000057160) at include/osmocom/bsc/gsm_data.h:1376<br>    0x0000555555c1edc8 in assignment_fsm_timer_cb (fi=0x612000060220) at assignment_fsm.c:758<br>    0x00007ffff72b1104 in fsm_tmr_cb (data=0x612000060220) at libosmocore/src/fsm.c:325<br>    0x00007ffff72ab062 in osmo_timers_update () at libosmocore/src/timer.c:257<br>    0x00007ffff72ab5d2 in _osmo_select_main (polling=0) at libosmocore/src/select.c:260<br>    0x00007ffff72abd2f in osmo_select_main_ctx (polling=<optimized out>) at libosmocore/src/select.c:291<br>    0x0000555555e1b81b in main (argc=3, argv=0x7fffffffe1b8) at osmo_bsc_main.c:953<br>    0x00007ffff6752002 in __libc_start_main () from /usr/lib/libc.so.6<br>    0x0000555555b61bbe in _start ()<br><br>In the case of the assignment_fsm counter, we now miss a chance to increase a<br>BTS counter for a failed Assignment, but this is a separate problem. The main<br>point of this patch is that osmo-bsc must not crash.<br><br>Related: OS#4620, OS#4619<br>Patch-by: fixeria<br>Tweaked-by: neels<br>Fixes: I0009e51d4caf68e762138d98e2e23d49acc3cc1a<br>Change-Id: Id681dfb0ad654bdb4b71805d1ad4f39a8bf6bbd1<br>---<br>M include/osmocom/bsc/gsm_data.h<br>M include/osmocom/bsc/paging.h<br>M src/osmo-bsc/assignment_fsm.c<br>M src/osmo-bsc/bsc_vty.c<br>M src/osmo-bsc/gsm_08_08.c<br>M src/osmo-bsc/gsm_data.c<br>M src/osmo-bsc/osmo_bsc_bssap.c<br>M src/osmo-bsc/osmo_bsc_filter.c<br>M src/osmo-bsc/osmo_bsc_msc.c<br>M src/osmo-bsc/osmo_bsc_sigtran.c<br>10 files changed, 73 insertions(+), 25 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/07/18907/4</pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907">change 18907</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Id681dfb0ad654bdb4b71805d1ad4f39a8bf6bbd1 </div>
<div style="display:none"> Gerrit-Change-Number: 18907 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Assignee: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>