Summary: | multimedia/ffmpeg crashes with SIGBUS on armv6 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Randy Westlund <rwestlun> | ||||||||||
Component: | Individual Port(s) | Assignee: | Thomas Zander <riggs> | ||||||||||
Status: | Closed FIXED | ||||||||||||
Severity: | Affects Many People | CC: | mikael, riggs | ||||||||||
Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(multimedia) |
||||||||||
Version: | Latest | ||||||||||||
Hardware: | Any | ||||||||||||
OS: | Any | ||||||||||||
Attachments: |
|
Description
Randy Westlund
2015-06-03 02:04:07 UTC
I get the same SIGBUS crash when I build this with GCC 4.9 instead of clang. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200714 I don't know how to investigate this further. Created attachment 157896 [details]
sigbus fix
Hi,
The crash is caused by an unaligned access:
0x20213778 <adts_aac_probe+96>: ldrh r1, [r7]
r7 0x22c6d811 583456785
Can you try the attached patch, It should also fix the build with gcc (make CC=gcc48)
Created attachment 157963 [details] update to fix_sigbus_patch (In reply to mikael.urankar from comment #2) After your patch: ===> Configuring for ffmpeg-2.3.6_4,1 env: -no-integrated-as: No such file or directory ===> Script "configure" failed unexpectedly. Please report the problem to multimedia@FreeBSD.org [maintainer] and attach the "/usr/ports/multimedia/ffmpeg/work/ffmpeg-2.3.6/config.err" including the output of the failure of your make command. Also, it might be a good idea to provide an overview of all packages installed on your system (e.g. a /usr/local/sbin/pkg-static info -g -Ea). *** Error code 1 Stop. make[1]: stopped in /usr/ports/multimedia/ffmpeg *** Error code 1 Stop. make: stopped in /usr/ports/multimedia/ffmpeg root@beaglebone:/usr/ports/multimedia/ffmpeg # I removed a tab character from the second CONFIGURE_ENV line and it built successfully with Clang. The SIGBUS is gone. Updated patch attached. When I build with make USE_GCC=4.9, it still passes -no-integrated-as to GCC, which causes the build to fail. Shouldn't USE_GCC set CHOSEN_COMPILER_TYPE? (In reply to Randy Westlund from comment #3) From the porters handbook: USE_GCC The port requires GCC (gcc or g++) to build. It is not the case here as we can build ffmpeg with clang, if you want to compile the port with gcc you have to use 'make CC=gcc48' Sorry for the extra tab and thanks for fixing my patch :-) (In reply to mikael.urankar from comment #4) Thanks for the clarification. I haven't finished reading the Porter's Handbook yet. I can confirm that this patch resolves both this PR and https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200714. Is this patch still needed with the most recent ffmpeg? (In reply to Thomas Zander from comment #6) I don't have the hardware with me to test it, but I'm sure that it is still necessary. ARM doesn't like the unaligned memory accesses. Committing this patch will resolve both this PR and https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200714. I will give it a shot today I still see the sigbus without the patch. With the patch I have the following error now: ffmpeg -i test.mp4 test.wav Illegal instruction (core dumped) #0 0x2048cb90 in avcodec_register_all () from /usr/local/lib/libavcodec.so.56 (gdb) disassemble $pc-16 $pc+16 Dump of assembler code from 0x2048cb80 to 0x2048cba0: 0x2048cb80 <avcodec_register_all+100232>: flds s0, [r9, #-4] 0x2048cb84 <avcodec_register_all+100236>: flds s1, [r9, #-12] 0x2048cb88 <avcodec_register_all+100240>: flds s2, [r2, #12] 0x2048cb8c <avcodec_register_all+100244>: flds s3, [r2, #4] 0x2048cb90 <avcodec_register_all+100248>: fmuls s8, s0, s16 0x2048cb94 <avcodec_register_all+100252>: fldmias r7!, {s20-s21} 0x2048cb98 <avcodec_register_all+100256>: fldmdbs r11!, {s22-s23} 0x2048cb9c <avcodec_register_all+100260>: flds s4, [r2] Bummer. I won't have access to any ARM hardware until the 22nd. I can only help test after that :/ Created attachment 159912 [details]
ffmpeg_disable_arm_unalighed_patch
Just tested with ffmpeg-2.7.2,1. I still see the SIGBUS with the version in the tree.
I've modified the patch to work with the current version of ffmpeg (part of it was committed in PR 200714). With the patch, ffmpeg works for me on my beaglebone black. I ran the following two commands for testing:
ffmpeg -i test.mp4 test.wav
ffmpeg -i test.wav -strict -2 test2.mp4
A commit references this bug: Author: riggs Date: Sun Aug 16 16:00:17 UTC 2015 New revision: 394414 URL: https://svnweb.freebsd.org/changeset/ports/394414 Log: Fix SIGBUS crashes on several popular ARM SoCs PR: 200609 Submitted by: rwestlun@gmail.com MFH: 2015Q3 Changes: head/multimedia/ffmpeg/Makefile Thanks for testing, submitting and staying on top of this. A commit references this bug: Author: riggs Date: Mon Aug 17 18:58:19 UTC 2015 New revision: 394522 URL: https://svnweb.freebsd.org/changeset/ports/394522 Log: MFH: r394414 Fix SIGBUS crashes on several popular ARM SoCs PR: 200609 Submitted by: rwestlun@gmail.com Approved by: ports-secteam (delphij) Changes: _U branches/2015Q3/ branches/2015Q3/multimedia/ffmpeg/Makefile A commit references this bug: Author: jbeich Date: Thu Nov 30 08:42:33 UTC 2017 New revision: 455179 URL: https://svnweb.freebsd.org/changeset/ports/455179 Log: multimedia/ffmpeg: unaligned access on armv6 should work after base r300701 Reported by: mmel PR: 200609 (ping) Changes: head/multimedia/ffmpeg/Makefile |