Summary: | media-video/ffmpeg-1.2.6 with sys-devel/gcc-4.8.2 on hardened - In function ‘dirac_get_arith_bit’: .../work/ffmpeg-1.2.6/libavcodec/dirac_arith.h:141:5: error: ‘asm’ operand has impossible constraints | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Anthoine Bourgeois <anthoine.bourgeois> |
Component: | Current packages | Assignee: | Gentoo Media-video project <media-video> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bertrand, hardened |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=504272 https://bugs.gentoo.org/show_bug.cgi?id=499996 https://bugs.gentoo.org/show_bug.cgi?id=507080 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
emerge.info
build.log emerge -pqv '=media-video/ffmpeg-1.2.6::gentoo' environment ffmpeg-1.2.6-r1.ebuild.patch disable -fstack-check Use HAVE_6REGS to protect the asm code |
Description
Anthoine Bourgeois
2014-03-30 00:30:24 UTC
Created attachment 373864 [details]
emerge.info
Created attachment 373866 [details]
build.log
Created attachment 373868 [details]
emerge -pqv '=media-video/ffmpeg-1.2.6::gentoo'
Created attachment 373870 [details]
environment
The code who produce the error is in ffmpeg-1.2.6/libavcodec/dirac_arith.h:141 : __asm__( "cmpl %5, %4 \n\t" "setae %b0 \n\t" "cmovb %3, %2 \n\t" "cmovb %5, %1 \n\t" : "+q"(bit), "+r"(range), "+r"(low) : "r"(c->low), "r"(c->low>>16), "r"(range_times_prob) ); This code use 6 registers : eax, ecx, edx, esi, edi, ebp (ebx is used by PIC). The gcc-4.8.2 introduce -fstack-check to hardened configuration and this option disable -fomit-frame-pointer then ebp is used as frame pointer and only 5 registers are available. Should an implicit option (stack-check) of the default configuration silently takes over and masks an explicit option on the command line (omit-frame-pointer) ? With -fstack-check=no the code builds. Created attachment 374262 [details, diff]
ffmpeg-1.2.6-r1.ebuild.patch
ebuild proposal to fix this issue.
Created attachment 374296 [details, diff]
disable -fstack-check
On hardened >=gcc 4.8.0 we enable -fstack-check and it need extra register to work and some asm code is allready using all so we disable it.
okay to applay the patch? (In reply to Magnus Granberg from comment #9) > okay to applay the patch? no; ffmpeg has 'HAVE_6REGS' and 'HAVE_7REGS' macro in libavutil/x86/asm.h so, if you cannot improve the asm not to require 6 regs, make the usage and compilation of that code conditional to one of these macros and of course, send the patch upstream Created attachment 374546 [details, diff]
Use HAVE_6REGS to protect the asm code
I send the patch upstream. Note all versions are affected.
Upstream : https://trac.ffmpeg.org/ticket/3540 A mail is also sent on the ffmpeg-devel mailing list. Fixed upstream in d8ab7f31 . (In reply to Anthoine Bourgeois from comment #13) > Fixed upstream in d8ab7f31 . thanks! applied to 1.2.6 (In reply to Alexis Ballier from comment #14) > thanks! applied to 1.2.6 2.2.1 is also affected. (In reply to Anthoine Bourgeois from comment #15) > (In reply to Alexis Ballier from comment #14) > > thanks! applied to 1.2.6 > > 2.2.1 is also affected. are you sure ? your patch seems to be in there (In reply to Alexis Ballier from comment #16) > (In reply to Anthoine Bourgeois from comment #15) > > (In reply to Alexis Ballier from comment #14) > > > thanks! applied to 1.2.6 > > > > 2.2.1 is also affected. > > are you sure ? > your patch seems to be in there No, your right, sorry. |