Source: coturn Version: 4.5.0.7-1 Severity: important User: debian-...@lists.debian.org Usertags: alignment
Hi! I've been doing a full rebuild of the Debian archive, building all source packages targeting armel and armhf using arm64 hardware. We are planning in future to move all of our 32-bit armel/armhf builds to using arm64 machines, so this rebuild is to identify packages that might have problems with this configuration. A feature of the arm64 kernel is that it does *not* support fixing up code with broken alignment, so code that might have built and run OK on our older armel/armhf build machines due to kernel fixups will now fail. When building your package, I've found a bus error (aka alignment fault). The full log is online at https://www.einval.com/debian/arm/rebuild-logs/armel/FAIL/coturn_4.5.0.7-1_armel.log for reference I've done a quick bit of debugging to find the source of the bug. Here's a gdb stacktrace and variable printout to demonstrate the problem. (sid-armel)steve@mjolnir:~/build/coturn-4.5.0.8$ gdb bin/turnutils_rfc5769check core GNU gdb (Debian 8.2-1) 8.2 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-gnueabi". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from bin/turnutils_rfc5769check...done. warning: core file may not match specified executable file. [New LWP 2415] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux-gnueabi/libthread_db.so.1". Core was generated by `bin/turnutils_rfc5769check'. Program terminated with signal SIGBUS, Bus error. #0 decode_oauth_token_gcm (server_name=0xf797d968 <__stack_chk_guard> "", etoken=0xffa9ac60, key=<optimized out>, dtoken=0xffa9a550) at src/client/ns_turn_msg.c:2611 2611 dtoken->enc_block.timestamp = nswap64(*((uint64_t*)(decoded_field+len))); (gdb) bt #0 decode_oauth_token_gcm (server_name=0xf797d968 <__stack_chk_guard> "", etoken=0xffa9ac60, key=<optimized out>, dtoken=0xffa9a550) at src/client/ns_turn_msg.c:2611 #1 0x00a7ca74 in check_oauth () at src/apps/rfc5769/rfc5769check.c:157 #2 main (argc=<optimized out>, argv=<optimized out>) at src/apps/rfc5769/rfc5769check.c:568 (gdb) p dtoken $1 = (oauth_token *) 0xffa9a550 (gdb) p decoded_field $2 = "\000\024ZksjpweoixXmvn67534m\000\000T\031\353m\000\000\000\000\016\020\064m\000\000T\031\353m\000\000\000\000\016\020", '\000' <repeats 975 times> (gdb) p len $3 = 22 Simply casting things like nswap64(*((uint64_t*)(decoded_field+len))) is not safe unless you know it's guaranteed to be aligned. In this case, it's not. -- System Information: Debian Release: 9.6 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)