pcapparse: Parsing code assumes unaligned memory accesses are OK
Describe your issue
The following test errors were observed:
=================================== 57/67 ====================================
test: elements_pcapparse
start time: 13:18:39
duration: 0.40s
result: exit status 2
command: GST_STATE_IGNORE_ELEMENTS='' GST_PLUGIN_LOADING_WHITELIST=gstreamer:gst-plugins-base:gst-plugins-good:gst-plugins-ugly:gst-libav:libnice:gst-plugins-bad@/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build GST_PLUGIN_SYSTEM_PATH_1_0='' GST_PLUGIN_SCANNER_1_0=/usr/libexec/gstreamer-1.0/gst-plugin-scanner LD_LIBRARY_PATH=/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/gst-libs/gst/basecamerabinsrc:/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/gst-libs/gst/interfaces:/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/gst-libs/gst/uridownloader GST_REGISTRY=/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/tests/check/elements_pcapparse.registry MALLOC_PERTURB_=210 GST_PLUGIN_PATH_1_0=/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build:/usr/lib/gstreamer-1.0:/usr/lib/gstreamer-1.0 CK_DEFAULT_TIMEOUT=20 /usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/tests/check/elements_pcapparse
----------------------------------- stdout -----------------------------------
Running suite(s): pcapparse
0%: Checks: 2, Failures: 0, Errors: 2
../tests/check/elements/parser.c:247:E:general:test_parse_frames_with_eth_padding:0: (after this point) Received signal 7 (Bus error)
../tests/check/elements/pcapparse.c:88:E:general:test_parse_zerosize_frames:0: (after this point) Received signal 7 (Bus error)
Check suite pcapparse ran in 0.226s (tests failed: 2)
==============================================================================
Expected Behavior
The tests pass.
Observed Behavior
Backtrace:
builder on aarch64 ~/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build $ CK_FORK=no meson test elements_pcapparse -v --gdb
ninja: Entering directory `/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build'
ninja: no work to do.
1/1 elements_pcapparse RUNNING
>>> GST_REGISTRY=/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/tests/check/elements_pcapparse.registry GST_STATE_IGNORE_ELEMENTS='' GST_PLUGIN_LOADING_WHITELIST=gstreamer:gst-plugins
-base:gst-plugins-good:gst-plugins-ugly:gst-libav:libnice:gst-plugins-bad@/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build MALLOC_PERTURB_=189 GST_PLUGIN_SCANNER_1_0=/usr/libexec/gstrea
mer-1.0/gst-plugin-scanner GST_PLUGIN_PATH_1_0=/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build:/usr/lib/gstreamer-1.0:/usr/lib/gstreamer-1.0 GST_PLUGIN_SYSTEM_PATH_1_0='' CK_DEFAULT_TI
MEOUT=20 LD_LIBRARY_PATH=/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/gst-libs/gst/basecamerabinsrc:/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/gst-libs/
gst/interfaces:/usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/gst-libs/gst/uridownloader gdb --quiet --args /usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/tes
ts/check/elements_pcapparse
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Reading symbols from /usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/tests/check/elements_pcapparse...
(gdb) r
Starting program: /usr/src/packages/user/gst-plugins-bad/src/gst-plugins-bad-1.20.2/build/tests/check/elements_pcapparse
Running suite(s): pcapparse
Program received signal SIGBUS, Bus error.
0xf7c95f4e in gst_pcap_parse_scan_frame (payload_size=<synthetic pointer>, payload=<synthetic pointer>, buf_size=<optimized out>, buf=0xf7c1f0b8 "", self=0xf7c30020) at ../gst/pcapparse/gstpcapparse.c:452
452 ip_dst_addr = *((guint32 *) (buf_ip + 16));
(gdb) bt
#0 0xf7c95f4e in gst_pcap_parse_scan_frame (payload_size=<synthetic pointer>, payload=<synthetic pointer>, buf_size=<optimized out>, buf=0xf7c1f0b8 "", self=0xf7c30020)
at ../gst/pcapparse/gstpcapparse.c:452
#1 gst_pcap_parse_chain (pad=<optimized out>, parent=0xf7c30020, buffer=<optimized out>) at ../gst/pcapparse/gstpcapparse.c:526
#2 0xf7edc6a2 in gst_pad_chain_data_unchecked (pad=pad@entry=0xf7c2e0c0, type=type@entry=4112, data=<optimized out>, data@entry=0xf7c1d8a8) at ../gst/gstpad.c:4447
#3 0xf7ede1f6 in gst_pad_push_data (pad=pad@entry=0xf7c2e370, type=type@entry=4112, data=data@entry=0xf7c1d8a8) at ../gst/gstpad.c:4711
#4 0xf7ee450a in gst_pad_push (pad=0xf7c2e370, buffer=buffer@entry=0xf7c1d8a8) at ../gst/gstpad.c:4830
#5 0x00401d20 in gst_parser_test_run (test=0x0, test@entry=0xfffeee64, out_caps=out_caps@entry=0x0) at ../tests/check/elements/parser.c:264
#6 0x00402222 in gst_parser_test_split (data=<optimized out>, size=size@entry=76) at ../tests/check/elements/parser.c:371
#7 0x0040169e in test_parse_frames_with_eth_padding (__i__=<optimized out>) at ../tests/check/elements/pcapparse.c:68
#8 0xf7d47c3c in tcase_run_tfun_nofork (sr=sr@entry=0xf7ad1e70, tc=0x0, tc@entry=0xf7acbd90, tfun=0x0, tfun@entry=0xf7ad3cd0, i=i@entry=0) at ../libs/gst/check/libcheck/check_run.c:395
#9 0xf7d47f7c in srunner_iterate_tcase_tfuns (tc=0xf7acbd90, sr=<optimized out>) at ../libs/gst/check/libcheck/check_run.c:245
#10 srunner_run_tcase (tc=0xf7acbd90, sr=<optimized out>) at ../libs/gst/check/libcheck/check_run.c:379
#11 srunner_iterate_suites (print_mode=<optimized out>, exclude_tags=<optimized out>, include_tags=<optimized out>, tcname=<optimized out>, sname=<optimized out>, sr=<optimized out>)
at ../libs/gst/check/libcheck/check_run.c:207
#12 srunner_run_tagged (sr=<optimized out>, sname=<optimized out>, tcname=<optimized out>, include_tags=<optimized out>, exclude_tags=<optimized out>, print_mode=<optimized out>)
at ../libs/gst/check/libcheck/check_run.c:743
#13 0xf7d4843a in srunner_run (sr=sr@entry=0xf7ad1e70, sname=sname@entry=0x0, tcname=tcname@entry=0x0, print_mode=print_mode@entry=CK_NORMAL) at ../libs/gst/check/libcheck/check_run.c:757
#14 0xf7d48454 in srunner_run_all (sr=sr@entry=0xf7ad1e70, print_mode=print_mode@entry=CK_NORMAL) at ../libs/gst/check/libcheck/check_run.c:695
#15 0xf7d3e8ac in gst_check_run_suite (suite=suite@entry=0xf7adca00, name=0x4025fc "pcapparse", fname=0x402530 "../tests/check/elements/pcapparse.c") at ../libs/gst/check/gstcheck.c:1132
#16 0x004012be in main (argc=<optimized out>, argv=<optimized out>) at ../tests/check/elements/pcapparse.c:139
(gdb) disas
Dump of assembler code for function gst_pcap_parse_chain:
...
0xf7c95f10 <+1140>: eors r2, r3
0xf7c95f12 <+1142>: mov.w r3, #0
0xf7c95f16 <+1146>: bne.w 0xf7c962ec <gst_pcap_parse_chain+2128>
0xf7c95f1a <+1150>: ldr r1, [r7, #12]
0xf7c95f1c <+1152>: adds r7, #148 ; 0x94
0xf7c95f1e <+1154>: ldr.w r0, [r4, #188] ; 0xbc
0xf7c95f22 <+1158>: mov sp, r7
0xf7c95f24 <+1160>: ldmia.w sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
0xf7c95f28 <+1164>: b.w 0xf7c953a0 <gst_pad_push_list@plt>
0xf7c95f2c <+1168>: ldr r0, [r7, #12]
0xf7c95f2e <+1170>: b.n 0xf7c95c66 <gst_pcap_parse_chain+458>
0xf7c95f30 <+1172>: ldrb.w r8, [r9, #9]
0xf7c95f34 <+1176>: cmp r1, #5
0xf7c95f36 <+1178>: bhi.w 0xf7c9629a <gst_pcap_parse_chain+2046>
0xf7c95f3a <+1182>: cmp.w r8, #17
0xf7c95f3e <+1186>: it ne
0xf7c95f40 <+1188>: cmpne.w r8, #6
0xf7c95f44 <+1192>: bne.w 0xf7c95db2 <gst_pcap_parse_chain+790>
0xf7c95f48 <+1196>: ldrh r2, [r6, #0]
0xf7c95f4a <+1198>: cmp.w r8, #17
=> 0xf7c95f4e <+1202>: ldrd r12, r0, [r9, #12]
0xf7c95f52 <+1206>: ldrh.w lr, [r6, #2]
0xf7c95f56 <+1210>: ldrh.w r9, [r9, #2]
0xf7c95f5a <+1214>: beq.w 0xf7c9625a <gst_pcap_parse_chain+1982>
0xf7c95f5e <+1218>: ldr r3, [r7, #4]
0xf7c95f60 <+1220>: add.w r1, r6, #12
0xf7c95f64 <+1224>: cmp r3, r1
0xf7c95f66 <+1226>: bls.w 0xf7c95db2 <gst_pcap_parse_chain+790>
0xf7c95f6a <+1230>: ldrb r1, [r6, #12]
0xf7c95f6c <+1232>: lsrs r1, r1, #4
0xf7c95f6e <+1234>: lsls r1, r1, #2
0xf7c95f70 <+1236>: add r6, r1
0xf7c95f72 <+1238>: cmp r3, r6
0xf7c95f74 <+1240>: bcc.w 0xf7c95db2 <gst_pcap_parse_chain+790>
0xf7c95f78 <+1244>: rev16.w r8, r9
0xf7c95f7c <+1248>: ldr r3, [r7, #0]
0xf7c95f7e <+1250>: uxth.w r8, r8
0xf7c95f82 <+1254>: sub.w r8, r8, r3
0xf7c95f86 <+1258>: sub.w r8, r8, r1
0xf7c95f8a <+1262>: ldrd r1, r3, [r4, #192] ; 0xc0
0xf7c95f8e <+1266>: cmp r3, #0
0xf7c95f90 <+1268>: blt.n 0xf7c95f9c <gst_pcap_parse_chain+1280>
...
Setup
- Operating System: Adélie Linux (armv7) -- development branch using GCC 13; we can provide a test environment if needed.
- Device: SV328R server with Ampere Altra Q80-30 CPU
-
GStreamer Version:
gst-plugins-bad-1.20.2
but appear to still be present upstream - Command line: ``
Steps to reproduce the bug
Attempt to run the test suite on a 32-bit ARM machine with GCC 13.
For now, we can provide access to a test machine. Steps to reproduce this locally will be provided soon; binaries are being built.
How reproducible is the bug?
- Not reproducible with GCC
8.5.0
; - Always reproducible with GCC
13.3.0
; - other versions not tested
Screenshots if relevant
Solutions you have tried
Related non-duplicate issues
Additional Information
We are tracking this issue here: