osmo-bts/src/common
Pau Espin 5f17e6138e l1sap: Avoid assumption that l1sap is at head of msgb
This assumption used while sending the rx data to gsmtap in l1sap_up was
making osmo-bts-virtual crash, since that bts model is allocating the
l1sap in the stack rather than inside the msgb.
Instead, let's use the assumption that l2h is set correctly in msgb by
the bts model lower layer.

crash report:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6234ec3 in __memmove_sse2_unaligned_erms () from /usr/lib/libc.so.6
(gdb) bt
0  0x00007ffff6234ec3 in __memmove_sse2_unaligned_erms () from /usr/lib/libc.so.6
1  0x00007ffff6dbf4c8 in gsmtap_makemsg_ex (type=<optimized out>, arfcn=arfcn@entry=17255, ts=ts@entry=6 '\006',
    chan_type=<optimized out>, ss=ss@entry=0 '\000', fn=fn@entry=11249, signal_dbm=0 '\000', snr=0 '\000',
    data=0x5555557d5b50 "", len=4294967263) at libosmocore/src/gsmtap_util.c:179
2  0x00007ffff6dbf6d8 in gsmtap_send_ex (gti=0x555555877f10, type=type@entry=1 '\001', arfcn=arfcn@entry=17255,
    ts=ts@entry=6 '\006', chan_type=<optimized out>, ss=<optimized out>, fn=11249, signal_dbm=0 '\000', snr=0 '\000',
    data=0x5555557d5b50 "", len=4294967263) at libosmocore/src/gsmtap_util.c:311
3  0x00007ffff6dbf765 in gsmtap_send (gti=<optimized out>, arfcn=arfcn@entry=17255, ts=ts@entry=6 '\006',
    chan_type=<optimized out>, ss=<optimized out>, fn=fn@entry=11249, signal_dbm=0 '\000', snr=0 '\000',
    data=0x5555557d5b50 "", len=4294967263) at libosmocore/src/gsmtap_util.c:330
4  0x0000555555573571 in to_gsmtap (trx=0x7ffff7ef8070, l1sap=0x7fffffffde80)
    at osmo-bts/src/common/l1sap.c:397
5  0x0000555555573b9c in l1sap_up (trx=0x7ffff7ef8070, l1sap=l1sap@entry=0x7fffffffde80)
    at osmo-bts/src/common/l1sap.c:1285
6  0x000055555555ec06 in virt_um_rcv_cb (vui=<optimized out>, msg=<optimized out>)
    at osmo-bts/src/osmo-bts-virtual/l1_if.c:170
7  0x000055555555f5c6 in virt_um_fd_cb (ofd=0x55555587cc30, what=<optimized out>)
    at osmo-bts/src/osmo-bts-virtual/virtual_um.c:50
8  0x00007ffff6db6991 in osmo_fd_disp_fds (_eset=0x7fffffffe090, _wset=0x7fffffffe010, _rset=0x7fffffffdf90)
    at libosmocore/src/select.c:216
9  osmo_select_main (polling=polling@entry=0) at libosmocore/src/select.c:256
10 0x0000555555576fbc in bts_main (argc=5, argv=0x7fffffffe288)
    at osmo-bts/src/common/main.c:364
11 0x00007ffff61b5f4a in __libc_start_main () from /usr/lib/libc.so.6
12 0x000055555555c4ca in _start ()

In the old code when the sizeof(osmo_phsap_prim) was being substracted
it resulted on a negative len which later was casted to unsigned int and
became a really big number.

Fixes: OS#3092

Change-Id: I51a880328497673a06d153bfb76c428265b8cbb8
2018-03-21 19:56:10 +01:00
..
Makefile.am split scheduler_mframe.c from scheduler.c 2018-02-26 15:01:08 +01:00
abis.c omldummy: Suppress RSL transmission errors 2018-03-17 16:45:37 +01:00
amr.c Fix some spelling errors 2016-12-22 14:04:22 +00:00
bts.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
bts_ctrl_commands.c Add ctrl command to send OML alert 2017-01-25 13:29:03 +01:00
bts_ctrl_lookup.c CTRL: make the CTRL-Interface IP address configurable 2017-01-10 15:45:59 +00:00
cbch.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
dtx_dl_amr_fsm.c Fix Downlink AMR FSM name to avoid illegal space character 2017-10-24 18:43:45 +02:00
gsm_data_shared.c Add 'osmo-bts-omldummy' to bring up only OML without RSL 2018-03-17 15:22:51 +01:00
handover.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
l1sap.c l1sap: Avoid assumption that l1sap is at head of msgb 2018-03-21 19:56:10 +01:00
lchan.c cosmetic: common ts_is_pdch() 2016-08-30 07:35:47 +00:00
load_indication.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
logging.c scheduler_trx: L1P is for PH (data), L1M for MPH (control) 2017-12-02 21:05:34 +01:00
main.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
measurement.c measurement: Keep average of high-accurate ToA value in lchan 2018-02-27 20:00:16 +01:00
msg_utils.c Fix AMR HR DTX FSM logic. 2017-02-01 19:13:16 +00:00
oml.c fix inverted logic bug in omldummy patch 2018-03-17 16:40:57 +01:00
paging.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
pcu_sock.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
phy_link.c phy_link: Fix typo in state being printed 2017-05-24 19:26:48 +02:00
power_control.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
rsl.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
scheduler.c L1SAP: Increase resolution of reported burst timing 2018-02-27 20:00:16 +01:00
scheduler_mframe.c split scheduler_mframe.c from scheduler.c 2018-02-26 15:01:08 +01:00
sysinfo.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00
tx_power.c Cosmetic fixes for power ramping code. 2018-02-19 08:51:25 +00:00
vty.c Get rid of 'struct gsm_bts_role_bts' 2018-03-17 13:40:03 +01:00