diff mbox

[FFmpeg-devel,v2] configure: Work around a start-up crash when building with clang.

Message ID 20191120125113.89779-1-kernrj@gmail.com
State New
Headers show

Commit Message

Richard Kern Nov. 20, 2019, 12:51 p.m. UTC
The current version of clang enables stack checking by default, causing
a crash when binaries are run.

Fixes #8073 using the -fno-stack-check work-around mentioned in the ticket.
---
 configure | 1 +
 1 file changed, 1 insertion(+)

Comments

Timo Rothenpieler Nov. 20, 2019, 4 p.m. UTC | #1
On 20.11.2019 13:51, Rick Kern wrote:
> The current version of clang enables stack checking by default, causing
> a crash when binaries are run.

Why does it trigger a crash? Doesn't it indicate something is wrong that 
should be fixed instead?
Hendrik Leppkes Nov. 20, 2019, 4:02 p.m. UTC | #2
On Wed, Nov 20, 2019 at 5:00 PM Timo Rothenpieler <timo@rothenpieler.org> wrote:
>
> On 20.11.2019 13:51, Rick Kern wrote:
> > The current version of clang enables stack checking by default, causing
> > a crash when binaries are run.
>
> Why does it trigger a crash? Doesn't it indicate something is wrong that
> should be fixed instead?

Its a bug in the Apple compiler (not in Clang in general afaik) that
causes stack alignment to be thrown off.

The commit should probably indicate that this is a Apple compiler bug.

-  Hendrik
Richard Kern Nov. 21, 2019, 2:44 p.m. UTC | #3
On Wed, Nov 20, 2019 at 11:29 AM Hendrik Leppkes <h.leppkes@gmail.com>
wrote:

> On Wed, Nov 20, 2019 at 5:00 PM Timo Rothenpieler <timo@rothenpieler.org>
> wrote:
> >
> > On 20.11.2019 13:51, Rick Kern wrote:
> > > The current version of clang enables stack checking by default, causing
> > > a crash when binaries are run.
> >
> > Why does it trigger a crash? Doesn't it indicate something is wrong that
> > should be fixed instead?
>

Here's the discussion about the compiler bug -
https://forums.developer.apple.com/thread/121887

Maybe this is too heavy-handed. Disabling avx, avx2, and avx512 fixes the
issue too, so maybe this is the better than disabling a security feature.
Detecting the compiler bug in configure and disabling only when present
would have less impact on performance.

I'm torn between automatically disabling it when the bug is detected, or
bailing from configure with an error message to disable it.  What's the
best option?


>
> Its a bug in the Apple compiler (not in Clang in general afaik) that
> causes stack alignment to be thrown off.
>
> The commit should probably indicate that this is a Apple compiler bug.
>
> -  Hendrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Nov. 22, 2019, 6:42 a.m. UTC | #4
On Thu, Nov 21, 2019 at 09:44:56AM -0500, Rick Kern wrote:
> On Wed, Nov 20, 2019 at 11:29 AM Hendrik Leppkes <h.leppkes@gmail.com>
> wrote:
> 
> > On Wed, Nov 20, 2019 at 5:00 PM Timo Rothenpieler <timo@rothenpieler.org>
> > wrote:
> > >
> > > On 20.11.2019 13:51, Rick Kern wrote:
> > > > The current version of clang enables stack checking by default, causing
> > > > a crash when binaries are run.
> > >
> > > Why does it trigger a crash? Doesn't it indicate something is wrong that
> > > should be fixed instead?
> >
> 
> Here's the discussion about the compiler bug -
> https://forums.developer.apple.com/thread/121887
> 
> Maybe this is too heavy-handed. Disabling avx, avx2, and avx512 fixes the
> issue too, so maybe this is the better than disabling a security feature.
> Detecting the compiler bug in configure and disabling only when present
> would have less impact on performance.
> 
> I'm torn between automatically disabling it when the bug is detected, or
> bailing from configure with an error message to disable it.  What's the
> best option?

can it be worked around automatically ?
IIUC one workaround reduces speed, the other reduces security.
its maybe better to "ask" the user what she cares more about if theres no
"universal" workaround and either means loosing something or at least
give a clear warning at the end of configure that describes the issue
and what the user can do to get the other workaround.

Thanks

[...]
diff mbox

Patch

diff --git a/configure b/configure
index 8f4f2884cf..97e614f18a 100755
--- a/configure
+++ b/configure
@@ -6880,6 +6880,7 @@  elif enabled clang; then
     check_cflags -Werror=implicit-function-declaration
     check_cflags -Werror=missing-prototypes
     check_cflags -Werror=return-type
+    check_cflags -fno-stack-check
 elif enabled cparser; then
     add_cflags -Wno-missing-variable-declarations
     add_cflags -Wno-empty-statement