NetBSD Problem Report #47132

From asau@inbox.ru  Sat Oct 27 10:36:30 2012
Return-Path: <asau@inbox.ru>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 66D2C63E3B8
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 27 Oct 2012 10:36:29 +0000 (UTC)
Message-Id: <87sj908diz.fsf@inbox.ru>
Date: Sat, 27 Oct 2012 13:33:56 +0400
From: Aleksej Saushev <asau@inbox.ru>
Reply-To: asau@inbox.ru
To: gnats-bugs@gnats.NetBSD.org
Subject: MPlayer crashes (VLC is affected potentially too)


>Number:         47132
>Category:       pkg
>Synopsis:       MPlayer crashes (VLC is affected potentially too)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 27 10:40:01 +0000 2012
>Last-Modified:  Sun Apr 07 11:05:02 +0000 2013
>Originator:     asau@inbox.ru
>Release:        NetBSD 6.0_STABLE
>Organization:
>Environment:
System: NetBSD localhost 6.0_STABLE NetBSD 6.0_STABLE (GENERIC) #0: Thu Oct 18 11:07:03 MSK 2012 asau@localhost:/usr/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
MPlayer stops with its usual diagnostics:


MPlayer interrupted by signal 11 in module: demux_open
- MPlayer crashed by bad usage of CPU/FPU/RAM.
  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and
  disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.
- MPlayer crashed. This shouldn't happen.


VLC dumps core too, it may be related problem or may be not.
>How-To-Repeat:
Run MPlayer, see it crashed.


Rebuild multimedia/mplayer package with "debug" option on and INSTALL_UNSTRIPPED=yes,
replace package, run "gdb --args mplayer <same-file>".
See it crashing with message:


libavformat version 54.6.101 (internal)
libavformat file format detected.


Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1]
ff_deblock_v_luma_intra_8_sse2 () at libavcodec/x86/h264_deblock.asm:783
783     DEBLOCK_LUMA_INTRA sse2, v




(gdb) disass
Dump of assembler code for function ff_deblock_v_luma_intra_8_sse2:
   0x086abb40 <+0>:     push   %ebx
   0x086abb41 <+1>:     push   %esi
   0x086abb42 <+2>:     push   %edi
   0x086abb43 <+3>:     mov    0x10(%esp),%eax
   0x086abb47 <+7>:     mov    0x14(%esp),%ecx
   0x086abb4b <+11>:    mov    0x18(%esp),%edx
   0x086abb4f <+15>:    mov    0x1c(%esp),%ebx
   0x086abb53 <+19>:    sub    $0x60,%esp
   0x086abb56 <+22>:    lea    0x0(,%ecx,4),%esi
   0x086abb5d <+29>:    lea    (%ecx,%ecx,2),%edi
   0x086abb60 <+32>:    dec    %edx
   0x086abb61 <+33>:    jl     0x86abf23 <ff_deblock_v_luma_intra_8_sse2.end>
   0x086abb67 <+39>:    neg    %esi
   0x086abb69 <+41>:    dec    %ebx
   0x086abb6a <+42>:    jl     0x86abf23 <ff_deblock_v_luma_intra_8_sse2.end>
   0x086abb70 <+48>:    add    %eax,%esi
=> 0x086abb72 <+50>:    movdqa (%esi,%ecx,2),%xmm0
   0x086abb77 <+55>:    movdqa (%esi,%edi,1),%xmm1
   0x086abb7c <+60>:    movdqa (%eax),%xmm2


(gdb) info reg
eax            0xbfbfc888       -1077950328
ecx            0x10     16
edx            0x4      4
ebx            0x1      1
esp            0xbfbfc7c8       0xbfbfc7c8
ebp            0xbfbfc9b8       0xbfbfc9b8
esi            0xbfbfc848       -1077950392
edi            0x30     48
eip            0x86abb72        0x86abb72 <ff_deblock_v_luma_intra_8_sse2+50>
eflags         0x10287  [ CF PF SF IF RF ]
cs             0x1b     27
ss             0x1f     31
ds             0x1f     31
es             0x1f     31
fs             *value not available*
gs             *value not available*


Something allocates unaligned buffer somewhere.


Since this comes from bundled ffmpeg, other software utilising ffmpeg may be affected.
>Fix:
	Please!


>Audit-Trail:
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Wed, 28 Nov 2012 13:17:34 -0600 (CST)


 Date: Wed, 28 Nov 2012 13:14:14 -0600 (CST)
 From: John D. Baker <jdbaker@david.technoskunk.fur>
 To: pkgsrc-users@NetBSD.org
 Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)

 
 This PR seems to coincide with the timeframe at which I've observed this
 as well, although slightly different.

 
 So far, non-mp4 file formats seem to work ok (MPEG1/2, quicktime, avi).
 Only a couple of "mp4" files in my collection don't cause mplayer to
 crash as shown below.

 
 So far, mplayer built on 6.0_STABLE/amd64 and 6.99.15/amd64 work fine.
 I've not had a chance yet to try it on 6.99.15/i386, 5.2_RC1/i386 or
 other architectures.  The one 6.0_STABLE/i386 system where it works
 properly was one just upgraded from 5.1_STABLE with a clean build of
 the release (with the correct libssl version/links).

 
 ----------
 MPlayer 1.1-4.5.3 (C) 2000-2012 MPlayer Team
 192 audio & 400 video codecs

 
 libavformat version 54.6.101 (internal)
 libavformat file format detected.
 [lavf] stream 0: video (h264), -vid 0
 [lavf] stream 1: audio (aac), -aid 0, -alang und
 VIDEO:  [H264]  640x360  24bpp  29.970 fps  588.0 kbps (71.8 kbyte/s)
 Clip info:
 major_brand: mp42
 minor_version: 0
 compatible_brands: isommp42
 creation_time: 2011-05-25 21:25:55
 Load subtitles in Movies/
 [VO_XV] It seems there is no Xvideo support for your video card available.
 [VO_XV] Run 'xvinfo' to verify its Xv support and read
 [VO_XV] DOCS/HTML/en/video.html#xv!
 [VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.
 [VO_XV] Try -vo x11.
 ==========================================================================
 Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
 libavcodec version 54.23.100 (internal)
 Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
 ==========================================================================
 ==========================================================================
 Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
 AUDIO: 44100 Hz, 2 ch, s16le, 95.9 kbit/6.80% (ratio: 11993->176400)
 Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
 ==========================================================================
 AO: [oss] 44100Hz 2ch s16le (2 bytes per sample)
 Starting playback...
 Unsupported PixelFormat 61
 Unsupported PixelFormat 53
 Unsupported PixelFormat 81

 

 
 MPlayer interrupted by signal 11 in module: decode video
 - MPlayer crashed by bad usage of CPU/FPU/RAM.
 Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and
 disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.
 - MPlayer crashed. This shouldn't happen.
 It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
 gcc version. If you think it's MPlayer's fault, please read
 DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and
 won't help unless you provide this information when reporting a possible 
 bug.
 ----------

 
 I've gone so far as to completely wipe out all of my additional packages
 on two of the build systems and rebuild/update the OS from scratch as
 well as rebuild all packages leading up to "multimedia/mplayer" and the
 result has always been the same.

 
 I added "PKG_OPTIONS.mplayer+=debug" to my "/etc/mk.conf" file, but
 with that option enabled the build phase eventually fails, claiming:

 
 [...]
 gcc -MD -MP -Wundef -W -Wall -Wstrict-prototypes -Wmissing-prototypes 
 -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement 
 -std=gnu99  -O2 -march=i486 -mtune=generic -pipe -g  -fno-tree-vectorize 
 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Iffmpeg 
 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/faad2 
 -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 -D_THREAD_SAFE 
 -I/usr/X11R7/include  -I/usr/pkg/include   -D_REENTRANT -I/usr/pkg/include 
 -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -I/usr/pkg/include 
 -I/usr/pkg/include/libdvdread -c -o stream/stream_cdda.o stream/stream_cdda.c
 stream/stream_cdda.c:21:28: fatal error: cdda_interface.h: No such file or 
 directory
 compilation terminated.
 gmake: *** [stream/stream_cdda.o] Error 1
 *** Error code 2

 
 Stop.
 make: stopped in /d0/nbsd/pkgsrc/multimedia/mplayer
 *** Error code 1

 
 Stop.

 
 The build failure appears on both i386 and amd64 platforms (others?)
 when using the "debug" option.

 
 -- 
 |/"\ 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: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Thu, 29 Nov 2012 11:13:23 -0600 (CST)


 I built "multimedia/vlc" (1.1.13) and it was able to play all the
 media files that caused mplayer to crash.  vlc segfaults on exit though
 it's qt4-related, rather than av-codec-related.  (I should note that when
 mplayer crashes, it doesn't leave a core file behind).

 
 Then I built "multimedia/vlc2" (2.0.3 in pkgsrc-2012Q3) and it dies with
 a segfault as follows:

 
 Core was generated by `vlc'.
 Program terminated with signal 11, Segmentation fault.
 #0  0xb7759f72 in ff_deblock_v_luma_8_sse2 ()
     from /usr/pkg/lib/libavcodec.so.52
 (gdb) bt
 #0  0xb7759f72 in ff_deblock_v_luma_8_sse2 ()
     from /usr/pkg/lib/libavcodec.so.52
 #1  0xbab29328 in operator new(unsigned int) () from /usr/lib/libstdc++.so.7
 #2  0xb75c865e in filter_mb_dir.clone.0.clone.1 ()
     from /usr/pkg/lib/libavcodec.so.52
 #3  0xb75c901c in ff_h264_filter_mb () from /usr/pkg/lib/libavcodec.so.52
 #4  0xb75c9890 in ff_h264_filter_mb_fast () from /usr/pkg/lib/libavcodec.so.52
 #5  0xb75ad1a8 in loop_filter () from /usr/pkg/lib/libavcodec.so.52
 #6  0xb75b6597 in decode_slice () from /usr/pkg/lib/libavcodec.so.52
 #7  0xb75b6aec in execute_decode_slices () from /usr/pkg/lib/libavcodec.so.52
 #8  0xb75b9d2f in decode_nal_units () from /usr/pkg/lib/libavcodec.so.52
 #9  0xb75ba3e8 in decode_frame () from /usr/pkg/lib/libavcodec.so.52
 #10 0xb76eaaa9 in avcodec_decode_video2 () from /usr/pkg/lib/libavcodec.so.52
 #11 0xba39b5e0 in ?? ()
     from /usr/pkg/lib/vlc/plugins/codec/libavcodec_plugin.so
 #12 0x0000001c in ?? ()
 #13 0xbbbbf57a in ?? () from /usr/pkg/lib/libvlccore.so.5
 Backtrace stopped: previous frame inner to this frame (corrupt stack?)

 
 I will try building with PKG_OPTIONS.vlc2+=debug to see if there's more
 information to be had.

 
 -- 
 |/"\ 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: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Thu, 29 Nov 2012 12:05:28 -0600 (CST)


 A similar problem from "wip/electricsheep-svn".  Again, no problem on
 amd64, but crashing on i386 (6.0_STABLE).

 
 Core was generated by `electricsheep'.
 Program terminated with signal 11, Segmentation fault.
 #0  0xbb466f72 in ff_deblock_v_luma_8_sse2 ()
     from /usr/pkg/lib/libavcodec.so.52
 (gdb) bt
 #0  0xbb466f72 in ff_deblock_v_luma_8_sse2 ()
     from /usr/pkg/lib/libavcodec.so.52
 #1  0xbfbfcd94 in ?? ()
 #2  0xbb2d565e in filter_mb_dir.clone.0.clone.1 ()
     from /usr/pkg/lib/libavcodec.so.52
 #3  0xbb2d601c in ff_h264_filter_mb () from /usr/pkg/lib/libavcodec.so.52
 #4  0xbb2d6890 in ff_h264_filter_mb_fast () from /usr/pkg/lib/libavcodec.so.52
 #5  0xbb2ba1a8 in loop_filter () from /usr/pkg/lib/libavcodec.so.52
 #6  0xbb2c36a3 in decode_slice () from /usr/pkg/lib/libavcodec.so.52
 #7  0xbb2c3aec in execute_decode_slices () from /usr/pkg/lib/libavcodec.so.52
 #8  0xbb2c6d2f in decode_nal_units () from /usr/pkg/lib/libavcodec.so.52
 #9  0xbb2c73e8 in decode_frame () from /usr/pkg/lib/libavcodec.so.52
 #10 0xbb3f7aa9 in avcodec_decode_video2 () from /usr/pkg/lib/libavcodec.so.52
 #11 0xbbbb922d in avformat_find_stream_info ()
     from /usr/pkg/lib/libavformat.so.52
 #12 0xbbbb9f4c in av_find_stream_info () from /usr/pkg/lib/libavformat.so.52
 #13 0x0804bfe1 in ?? ()
 #14 0x0804d095 in ?? ()
 #15 0x0804ef7f in ?? ()
 #16 0x0805021a in ?? ()
 #17 0x0804a0f5 in ?? ()
 #18 0x08049fc8 in ?? ()
 Backtrace stopped: Not enough registers or memory available to unwind further

 

 
 -- 
 |/"\ 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: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Thu, 29 Nov 2012 19:14:19 +0100


 On Thu, Nov 29, 2012 at 06:10:05PM +0000, John D. Baker wrote:
 >  A similar problem from "wip/electricsheep-svn".  Again, no problem on
 >  amd64, but crashing on i386 (6.0_STABLE).

 
 The SSE2 code is making invalid assumptions about the stack alignment.
 It is written in some fancy form of pseudo-assembler or so, so I didn't
 find an obvious way to fix it.

 
 Joerg

 
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Thu, 29 Nov 2012 14:02:00 -0600 (CST)


 I rebuilt "multimedia/vlc2" with the "debug" option.  (Actually, I turned
 on ALL the options (so PKG_OPTIONS matched PKG_SUPPORTED_OPTIONS).  Upon
 trying to play a file, the following was displayed on the terminal:

 
 VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
 [0xbb80d0d4] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
 [0xbb829c04] qt4 interface error: Unable to load extensions module
 [0xbb8d5714] xcb_xv vout display error: no available XVideo adaptor
 failed to create drawable
 [0xb8f96c24] pulse audio output error: PulseAudio server connection failure: Connection refused

 
 The player window eventually opened, but then closed almost immediately
 and 'vlc' exited.  It DID NOT leave a core file behind.

 
 Attempting to run vlc under gdb directly never seemed to progress any and
 could only be killed with -9.

 
 -- 
 |/"\ 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: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Sat, 1 Dec 2012 01:17:48 +0100


 Can you please try force the code to compile with -mstackrealign
 -mpreferrred-stack-boundary=4? I'm not sure if adding it to CFLAGS is
 good enough. _WRAP_EXTRA_ARGS.CC might be a good try as well.

 
 Joerg

 
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Mon, 3 Dec 2012 17:17:26 -0600 (CST)


 As suggested, adding the following to "/etc/mk.conf":

 
 .if "${PKGPATH}" == "multimedia/mplayer"
    CFLAGS+= -mstackrealign -mpreferred-stack-boundary=4
 .endif

 
 and rebuilding produces a working 'mplayer' executable on i386.

 
 I'm also building "multimedia/vlc2" with this, but I expect to also have
 to rebuild "multimedia/ffmpeg" with these additional flags as well.

 
 -- 
 |/"\ 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: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Tue, 4 Dec 2012 00:42:26 +0100


 On Mon, Dec 03, 2012 at 11:20:04PM +0000, John D. Baker wrote:
 >  I'm also building "multimedia/vlc2" with this, but I expect to also have
 >  to rebuild "multimedia/ffmpeg" with these additional flags as well.

 
 ffmpeg should be good enough, vlc2 itself doesn't have nasty assembler
 AFAICR.

 
 Joerg

 
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Mon, 3 Dec 2012 18:29:31 -0600 (CST)


 I've now rebuilt "multimedia/ffmpeg" with the following in "/etc/mk.conf":

 
 .if "${PKGPATH}" == "multimedia/mplayer" || \
      "${PKGPATH}" == "multimedia/ffmpeg"
    CFLAGS+= -mstackrealign -mpreferred-stack-boundary=4
 .endif

 
 allowing "wip/electricsheep-svn" to work on i386 again.

 
 Rebuilding "multimedia/vlc2" (w/o the above additional flags) is in
 progress.

 
 -- 
 |/"\ 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: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47132: MPlayer crashes (VLC is affected potentially too)
Date: Tue, 4 Dec 2012 10:14:26 -0600 (CST)


 With "multimedia/ffmpeg" built with the stack-realignment options and
 building "multimedia/vlc2" with default options plus "debug", the
 resulting 'vlc' executable doesn't crash, but neither does it display
 any video from the media files I used to test (which play properly with
 'mplayer').  Audio plays OK, though.

 
 -- 
 |/"\ 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: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/47132
Date: Sun, 7 Apr 2013 13:01:45 +0200


 Did some building and testing on i386

 
 Starting with gcc 4.6 the options
 -mstackrealign -mpreferred-stack-boundary=4
 aren't necessary anymore for ffmpeg and mplayer
 to work on i386.

 
 The stackrealign options are only available from
 gcc 4.2  onward. It looks to me like
 GCC_REQD >= 4.2 in combination with setting
 the two -m options if gcc 4.[2345] is being used
 on i386 in the ffmpeg and mplayer
 makefiles is a possible fix.

 
 Onno

 



NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.36 2007/11/24 03:27:39 kano Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.