Page 1 of 1

ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-04-24T08:22:20-07:00
by Hubbitus
Initially reported by https://bugzilla.redhat.com/show_bug.cgi?id=1214344

Code: Select all

$ gdb convert
GNU gdb (GDB) Fedora 7.9-11.fc23
…
(gdb) run -resize 96x96 Source/Resource/Image/MediaInfo.png /home/fedora/hubbitus/rpmbuild/BUILDROOT/mediainfo-0.7.73-2.fc23.x86_64/usr/share/icons/hicolor/96x96/apps/mediainfo.png
Starting program: /usr/bin/convert -resize 96x96 Source/Resource/Image/MediaInfo.png /home/fedora/hubbitus/rpmbuild/BUILDROOT/mediainfo-0.7.73-2.fc23.x86_64/usr/share/icons/hicolor/96x96/apps/mediainfo.png
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
StartTimer (time_info=0x5555557577a0, reset=<optimized out>) at magick/timer.c:380
380           time_info->elapsed.start=ElapsedTime();
(gdb) bt
#0  StartTimer (time_info=0x5555557577a0, reset=<optimized out>) at magick/timer.c:380
#1  0x00007ffff7a44c25 in LoadLogCache (log_cache=log_cache@entry=0x5555557572f0, xml=<optimized out>, filename=filename@entry=0x555555758bd0 "/etc/ImageMagick-6/log.xml", depth=depth@entry=0, exception=exception@entry=0x5555557570f0)
    at magick/log.c:1527
#2  0x00007ffff7a4523e in AcquireLogCache (filename=0x7ffff7b2f8a2 "log.xml", exception=0x5555557570f0) at magick/log.c:280
#3  IsLogCacheInstantiated (exception=<optimized out>) at magick/log.c:659
#4  GetLogInfo (exception=exception@entry=0x5555557570f0, name=0x7ffff7b30172 "*") at magick/log.c:392
#5  0x00007ffff7a462cb in LogComponentGenesis () at magick/log.c:828
#6  0x00007ffff7a48950 in MagickCoreGenesis (path=0x7fffffffdc07 "/usr/bin/convert", establish_signal_handlers=MagickTrue) at magick/magick.c:1251
#7  0x0000555555554a1e in ConvertMain (argv=0x7fffffffd8c8, argc=5) at utilities/convert.c:78
#8  main (argc=5, argv=0x7fffffffd8c8) at utilities/convert.c:92
(gdb) q
GCC 5.0 used:

Code: Select all

$ LANG=C gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.0.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.0.1 20150417 (Red Hat 5.0.1-0.2) (GCC)

Re: ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-04-24T13:40:49-07:00
by Hubbitus

Code: Select all

(gdb) disassemble
Dump of assembler code for function StartTimer:
   0x00007ffff7accb60 <+0>:     push   %rbp
   0x00007ffff7accb61 <+1>:     push   %rbx
   0x00007ffff7accb62 <+2>:     sub    $0x38,%rsp
   0x00007ffff7accb66 <+6>:     mov    %fs:0x28,%rax
   0x00007ffff7accb6f <+15>:    mov    %rax,0x28(%rsp)
   0x00007ffff7accb74 <+20>:    xor    %eax,%eax
   0x00007ffff7accb76 <+22>:    test   %rdi,%rdi
   0x00007ffff7accb79 <+25>:    je     0x7ffff7accc34 <StartTimer+212>
   0x00007ffff7accb7f <+31>:    mov    $0xabacadab,%eax
   0x00007ffff7accb84 <+36>:    cmp    %rax,0x38(%rdi)
   0x00007ffff7accb88 <+40>:    mov    %rdi,%rbx
   0x00007ffff7accb8b <+43>:    jne    0x7ffff7accc15 <StartTimer+181>
   0x00007ffff7accb91 <+49>:    test   %esi,%esi
   0x00007ffff7accb93 <+51>:    jne    0x7ffff7accc00 <StartTimer+160>
   0x00007ffff7accb95 <+53>:    cmpl   $0x2,0x30(%rbx)
   0x00007ffff7accb99 <+57>:    je     0x7ffff7accbdf <StartTimer+127>
   0x00007ffff7accb9b <+59>:    mov    %rsp,%rdi
   0x00007ffff7accb9e <+62>:    callq  0x7ffff7958b70 <times@plt>
=> 0x00007ffff7accba3 <+67>:    vxorpd %xmm0,%xmm0,%xmm0
   0x00007ffff7accba7 <+71>:    mov    %rsp,%rdi
   0x00007ffff7accbaa <+74>:    vcvtsi2sd %rax,%xmm0,%xmm0
   0x00007ffff7accbaf <+79>:    vdivsd 0x5b5d9(%rip),%xmm0,%xmm0        # 0x7ffff7b28190
   0x00007ffff7accbb7 <+87>:    vmovsd %xmm0,0x18(%rbx)
   0x00007ffff7accbbc <+92>:    callq  0x7ffff7958b70 <times@plt>
   0x00007ffff7accbc1 <+97>:    mov    0x8(%rsp),%rax
   0x00007ffff7accbc6 <+102>:   add    (%rsp),%rax
   0x00007ffff7accbca <+106>:   vxorpd %xmm0,%xmm0,%xmm0
   0x00007ffff7accbce <+110>:   vcvtsi2sd %rax,%xmm0,%xmm0
   0x00007ffff7accbd3 <+115>:   vdivsd 0x5b5b5(%rip),%xmm0,%xmm0        # 0x7ffff7b28190
   0x00007ffff7accbdb <+123>:   vmovsd %xmm0,(%rbx)
   0x00007ffff7accbdf <+127>:   mov    0x28(%rsp),%rax
   0x00007ffff7accbe4 <+132>:   xor    %fs:0x28,%rax
   0x00007ffff7accbed <+141>:   movl   $0x2,0x30(%rbx)
   0x00007ffff7accbf4 <+148>:   jne    0x7ffff7accc53 <StartTimer+243>
   0x00007ffff7accbf6 <+150>:   add    $0x38,%rsp
   0x00007ffff7accbfa <+154>:   pop    %rbx
   0x00007ffff7accbfb <+155>:   pop    %rbp
   0x00007ffff7accbfc <+156>:   retq   
   0x00007ffff7accbfd <+157>:   nopl   (%rax)
   0x00007ffff7accc00 <+160>:   movq   $0x0,0x10(%rdi)
   0x00007ffff7accc08 <+168>:   movq   $0x0,0x28(%rdi)
   0x00007ffff7accc10 <+176>:   jmpq   0x7ffff7accb95 <StartTimer+53>
   0x00007ffff7accc15 <+181>:   lea    0x70ad4(%rip),%rcx        # 0x7ffff7b3d6f0 <__PRETTY_FUNCTION__.9259>
   0x00007ffff7accc1c <+188>:   lea    0x70a13(%rip),%rsi        # 0x7ffff7b3d636
   0x00007ffff7accc23 <+195>:   lea    0x70a46(%rip),%rdi        # 0x7ffff7b3d670
   0x00007ffff7accc2a <+202>:   mov    $0x171,%edx
   0x00007ffff7accc2f <+207>:   callq  0x7ffff7957d60 <__assert_fail@plt>
   0x00007ffff7accc34 <+212>:   lea    0x70ab5(%rip),%rcx        # 0x7ffff7b3d6f0 <__PRETTY_FUNCTION__.9259>
   0x00007ffff7accc3b <+219>:   lea    0x709f4(%rip),%rsi        # 0x7ffff7b3d636
   0x00007ffff7accc42 <+226>:   lea    0x709ff(%rip),%rdi        # 0x7ffff7b3d648
   0x00007ffff7accc49 <+233>:   mov    $0x170,%edx
   0x00007ffff7accc4e <+238>:   callq  0x7ffff7957d60 <__assert_fail@plt>
   0x00007ffff7accc53 <+243>:   callq  0x7ffff795a660 <__stack_chk_fail@plt>
End of assembler dump.

Re: ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-04-24T18:33:04-07:00
by magick
This problem has been reported once before. Its problematic because the failure appears to be in a system call to the times() method (assuming MAGICKCORE_HAVE_TIME is defined in magick/magick-baseconfig.h). With debugging, can you confirm the fault is triggered by these lines @ magick/timer.c/192:
  • struct tms
    timer;

    return((double) times(&timer)/CLOCKS_PER_SEC);
Once confirmed that its failing on the return, what about the source line is wrong? It should be nothing because ImageMagick has utilized this line of code for 15 years now across multiples OS's-- including Fedora 21, the OS we use to develop ImageMagick. But before we speculate further, can you add some prints to confirm its failing on this line.

Keep in mind, you are using gcc 5 which may very well have a bug.

Thanks,

Re: ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-05-17T13:09:57-07:00
by Hubbitus
Excuse me.

Does some recently changed with AX_GCC_ARCHFLAG macros and semantics (defaults) in arch optimisation (--with/without-gcc-arch flags)?

I ask because https://bugzilla.redhat.com/show_bug.cgi?id=1213828#c16

Re: ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-05-17T15:19:44-07:00
by magick
We'll default to AX_GCC_ARCHFLAG() portable true. Look for the patch in ImageMagick 6.9.1-3 Beta by sometime tomorrow. Thanks.

Re: ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-05-19T11:08:51-07:00
by Hubbitus
Could you please be so kind and point to commit if that happened?

Re: ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-05-19T15:09:47-07:00
by magick
We're getting ready to release ImageMagick-6.9.1-3 so it would be grand if you can test the patch. Just download http://www.imagemagick.org/download/bet ... -3.tar.bz2. You can check Subversion to see the exact patch or diff configure.ac between ImageMagick-6.9.1-2 and ImageMagick-6.9.1-3.

Re: ImageMagick-6.9.1-2 SIGILL, Illegal instruction StartTimer at magick/timer.c:380

Posted: 2015-05-26T16:31:07-07:00
by Hubbitus
Thank you.