NetBSD Problem Report #51122

From o.vd.linden@quicknet.nl  Sat May  7 18:45:54 2016
Return-Path: <o.vd.linden@quicknet.nl>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5D2407A3D9
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  7 May 2016 18:45:54 +0000 (UTC)
Message-Id: <20160507172809.GA6898@sheep>
Date: Sat, 7 May 2016 19:28:09 +0200
From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@netbsd.org
Subject: with gcc 5.x x86 32-bit ffmpeg2 and ffmpeg3 need extra compile flags

>Number:         51122
>Category:       pkg
>Synopsis:       ffmpeg[23] compiled with gcc 5.x on x86 32-bit can lead to crashes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    joerg
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 07 18:50:00 +0000 2016
>Closed-Date:    
>Last-Modified:  Mon Jun 27 00:00:00 +0000 2016
>Originator:     Onno van der Linden
>Release:        NetBSD 7.99.29
>Organization:
	<organization of PR author (multiple lines)>
>Environment:
System: NetBSD sheep 7.99.29 NetBSD 7.99.29 (SHEEP) #0: Sun May 1 19:11:17 MEST 2016 onno@sheep:/usr/src/sys/arch/i386/compile/SHEEP i386
Architecture: i386
Machine: i386
>Description:
	gcc 5.x on x86 32-bit needs -mstackrealign -mpreferred-stack-boundary=4
        see pkg/48860.
>How-To-Repeat:
	x86 32-bit firefox linked against ffmpeg3 compiled with gcc 5.x crashes
while browsing twitter.com. Stack trace shows an sse2 function from libavcodec
>Fix:
--- ffmpeg2/Makefile.orig	2016-05-07 16:47:52.713391361 +0200
+++ ffmpeg2/Makefile	2016-05-07 16:47:57.249262990 +0200
@@ -49,7 +49,7 @@
    || !empty(CC_VERSION:Mgcc-4.[01].*) \
    || empty(CC_VERSION:Mgcc*)
 CONFIGURE_ARGS+=	--disable-asm
-.  elif !empty(CC_VERSION:Mgcc-4.*)
+.  else
 CFLAGS+=		-mstackrealign -mpreferred-stack-boundary=4
 .  endif
 .endif
--- ffmpeg3/Makefile.orig	2016-05-07 16:47:05.028467467 +0200
+++ ffmpeg3/Makefile	2016-05-07 16:47:11.431340768 +0200
@@ -49,7 +49,7 @@
    || !empty(CC_VERSION:Mgcc-4.[01].*) \
    || empty(CC_VERSION:Mgcc*)
 CONFIGURE_ARGS+=	--disable-asm
-.  elif !empty(CC_VERSION:Mgcc-4.*)
+.  else
 CFLAGS+=		-mstackrealign -mpreferred-stack-boundary=4
 .  endif
 .endif

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Thu, 23 Jun 2016 11:28:33 +0000
State-Changed-Why:
I've committed the changes for gcc5 and gcc6.
Not all compilers, as they may not have these flags.


From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51122 CVS commit: pkgsrc/multimedia/ffmpeg2
Date: Thu, 23 Jun 2016 11:25:19 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Thu Jun 23 11:25:19 UTC 2016

 Modified Files:
 	pkgsrc/multimedia/ffmpeg2: Makefile

 Log Message:
 Use stackrealign on newer GCC as well

 PR/51122: with gcc 5.x x86 32-bit ffmpeg2 and ffmpeg3 need extra compile flags


 To generate a diff of this commit:
 cvs rdiff -u -r1.29 -r1.30 pkgsrc/multimedia/ffmpeg2/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51122 CVS commit: pkgsrc/multimedia/ffmpeg3
Date: Thu, 23 Jun 2016 11:25:48 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Thu Jun 23 11:25:48 UTC 2016

 Modified Files:
 	pkgsrc/multimedia/ffmpeg3: Makefile

 Log Message:
 Use stackrealign on newer GCC as well

 Addresses PR/51122: with gcc 5.x x86 32-bit ffmpeg2 and ffmpeg3 need extra compile flags


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 pkgsrc/multimedia/ffmpeg3/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: coypu@SDF.ORG
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes)
Date: Thu, 23 Jun 2016 11:30:26 +0000

 Filed upstream bug here: https://trac.ffmpeg.org/ticket/5660

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51122: ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes
Date: Thu, 23 Jun 2016 08:40:28 -0500 (CDT)

 ffmpeg010 and ffmpeg1 will need this as well since there are still some
 packages which depend on these older versions.  See their respective
 Makefiles.  Consider adding them to the upstream bug report.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51122 CVS commit: pkgsrc/multimedia/ffmpeg1
Date: Thu, 23 Jun 2016 17:22:24 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Thu Jun 23 17:22:24 UTC 2016

 Modified Files:
 	pkgsrc/multimedia/ffmpeg1: Makefile

 Log Message:
 Use stackrealign on newer GCC as well
 Bump PKGREVISION

 PR pkg/51122


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 pkgsrc/multimedia/ffmpeg1/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51122 CVS commit: pkgsrc/multimedia/ffmpeg010
Date: Thu, 23 Jun 2016 17:24:52 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Thu Jun 23 17:24:52 UTC 2016

 Modified Files:
 	pkgsrc/multimedia/ffmpeg010: Makefile

 Log Message:
 Use stackrealign on newer GCC as well
 Bump PKGREVISION

 PR pkg/51122


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 pkgsrc/multimedia/ffmpeg010/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->open
State-Changed-By: maya@NetBSD.org
State-Changed-When: Thu, 23 Jun 2016 18:14:05 +0000
State-Changed-Why:
joerg would like to fix an upstream bug.
also, mstackrealign is very expensive and not ideal.


Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Sat, 25 Jun 2016 17:08:35 +0000
Responsible-Changed-Why:
joerg wants to fix ffmpeg's assembler, everyone else is fine with
working around the problem...


From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes)
Date: Sun, 26 Jun 2016 11:14:27 +0200

 Tried 
 https://www.facebook.com/spotlightuse.jp/videos/938866406181882/?theater
 as mentioned in https://trac.ffmpeg.org/ticket/5231

 with ffmpeg3-3.0.2nb2 compiled and installed with the following
 set of extra cflags

 -mstackrealign -mpreferred-stack-boundary=4  : no crash
 -mpreferred-stack-boundary=4                 : no crash
 none of the flags above                      : crash

 this is with gcc version 5.4.0 (nb1 20160606) on
 NetBSD/i386 7.99.31

 Maybe -mstackrealign isn't needed for NetBSD/i386
 but what about gcc 4.x for x >= 2 ?

 And this is only *1* testcase .......

From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes)
Date: Sun, 26 Jun 2016 17:57:10 +0200

 > Maybe -mstackrealign isn't needed for NetBSD/i386
 > but what about gcc 4.x for x >= 2 ?

 Compiled and installed lang/gcc44
 Compiled and installed ffmpeg3 with /usr/pkg/gcc44/bin/gcc
 and CFLAGS+=-mpreferred-stack-boundary=4
 in /usr/pkgsrc/multimedia/ffmpeg3/Makefile

 Visited
 https://www.facebook.com/spotlightuse.jp/videos/938866406181882/?theater
 with firefox 47.0 on NetBSD/i386 7.99.31
 and no crash ......

 I think it's safe to assume gcc 4.x with x >= 4 (maybe even x>=2)
 only needs -mpreferred-stack-boundary=4 to compile ffmpeg3
 (and likely ffmpeg2 too) on 32-bit x86 to prevent crashes
 caused by sse2 alignment requirements.

 And now for some more test cases .......

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: joerg@NetBSD.org, pkg-manager@netbsd.org, pkgsrc-bugs@netbsd.org,
	gnats-admin@netbsd.org, dholland@NetBSD.org,
	Onno van der Linden <o.vd.linden@quicknet.nl>
Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes)
Date: Sun, 26 Jun 2016 20:31:31 +0200

 On Sat, Jun 25, 2016 at 05:08:35PM +0000, dholland@NetBSD.org wrote:
 > Synopsis: ffmpeg[23] compiled with gcc 5.x on x86 32-bit can lead to crashes
 > 
 > Responsible-Changed-From-To: pkg-manager->joerg
 > Responsible-Changed-By: dholland@NetBSD.org
 > Responsible-Changed-When: Sat, 25 Jun 2016 17:08:35 +0000
 > Responsible-Changed-Why:
 > joerg wants to fix ffmpeg's assembler, everyone else is fine with
 > working around the problem...

 I've told you I don't touch this macro mess. If it was anywhere
 tractable I would have fixed it already. I said to fix the callers, but
 it seems you can't read. Since I got assigned the bug, I will just
 disable the assembler code again and remove the stackrealign hacks...

 Joerg

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes)
Date: Sun, 26 Jun 2016 18:56:08 +0000

 On Sun, Jun 26, 2016 at 06:35:00PM +0000, Joerg Sonnenberger wrote:
  >  > joerg wants to fix ffmpeg's assembler, everyone else is fine with
  >  > working around the problem...
  >  
  >  I've told you I don't touch this macro mess. If it was anywhere
  >  tractable I would have fixed it already. I said to fix the callers, but
  >  it seems you can't read. Since I got assigned the bug, I will just
  >  disable the assembler code again and remove the stackrealign hacks...

 If you don't want to fix it, set it back to pkg-manager.

 But then stop carping about what other people do to deal with it, ok?

 -- 
 David A. Holland
 dholland@netbsd.org

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes)
Date: Sun, 26 Jun 2016 23:36:50 +0200

 On Sun, Jun 26, 2016 at 07:00:01PM +0000, David Holland wrote:
 > The following reply was made to PR pkg/51122; it has been noted by GNATS.
 > 
 > From: David Holland <dholland-pbugs@netbsd.org>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 >  lead to crashes)
 > Date: Sun, 26 Jun 2016 18:56:08 +0000
 > 
 >  On Sun, Jun 26, 2016 at 06:35:00PM +0000, Joerg Sonnenberger wrote:
 >   >  > joerg wants to fix ffmpeg's assembler, everyone else is fine with
 >   >  > working around the problem...
 >   >  
 >   >  I've told you I don't touch this macro mess. If it was anywhere
 >   >  tractable I would have fixed it already. I said to fix the callers, but
 >   >  it seems you can't read. Since I got assigned the bug, I will just
 >   >  disable the assembler code again and remove the stackrealign hacks...
 >  
 >  If you don't want to fix it, set it back to pkg-manager.
 >  
 >  But then stop carping about what other people do to deal with it, ok?

 The only one carping about something here is you. The "fix" is
 introducing a performance penalty for every single codec. It doesn't fix
 the assembler. It doesn't apply the existing attributes to the caller of
 the broken assembler. In short, it is carpet bombing. But hey, I'm wrong
 to call it out as a crude hack and *I* should be fixing this?

 Joerg

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51122 (ffmpeg[23] compiled with gcc 5.x on x86 32-bit can
 lead to crashes)
Date: Sun, 26 Jun 2016 23:59:42 +0000

 On Sun, Jun 26, 2016 at 09:40:01PM +0000, Joerg Sonnenberger wrote:
  >>  If you don't want to fix it, set it back to pkg-manager.
  >>  
  >>  But then stop carping about what other people do to deal with it, ok?
  >  
  >  The only one carping about something here is you. The "fix" is
  >  introducing a performance penalty for every single codec. It doesn't fix
  >  the assembler. It doesn't apply the existing attributes to the caller of
  >  the broken assembler. In short, it is carpet bombing. But hey, I'm wrong
  >  to call it out as a crude hack and *I* should be fixing this?

 For multiple years now you've been standing in the way of people
 having an ffmpeg that runs by alternately denying the existence of a
 problem and objecting to proposed solutions and workarounds.

 I at least am tired of it. Either contribute something productive, or
 shut up.

 -- 
 David A. Holland
 dholland@netbsd.org

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.