Bug#924009: closed by Dimitrios Eftaxiopoulos <eftaxi12 at otenet.gr> (Bug not reproduced)

Bernhard Übelacker bernhardu at mailbox.org
Sun Mar 24 20:52:28 GMT 2019


Hello Dimitris, hello di dit,

I think the issue is that freefem++s configure activate
AVX instructions when the build CPU supports it.


I could reproduce the crash in a Buster amd64 qemu VM, that
unintentionally did not support AVX (while the VM host would).
That led to following backtrace:

    Program terminated with signal SIGILL, Illegal instruction.
    ...
    (gdb) bt
    #0  0x00005627165a7801 in C_F0::C_F0 (this=0x562716c49c20 <fespacetype>) at ./../fflib/AFunction.hpp:633
    #1  __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at lg.ypp:105
    #2  _GLOBAL__sub_I_lg.tab.cpp(void) () at lg.ypp:989
    #3  0x0000562716a51dd5 in __libc_csu_init ()
    #4  0x00007f6573ed002a in __libc_start_main (main=0x5627165a74c0 <main(int, char**)>, argc=2, argv=0x7ffc53da1d48, init=0x562716a51d90 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc53da1d38) at ../csu/libc-start.c:264
    #5  0x00005627165abcda in _start () at ../Graphics/rgraph.hpp:145


The instruction at this address is a "vpxor":

    (gdb) disassemble $pc-0x20,$pc+0x20
    Dump of assembler code from 0x5627165a77e1 to 0x5627165a7821:
    ...
       0x00005627165a77fa <_GLOBAL__sub_I_lg.tab.cpp(void)+42>:     lea    0x6a23ef(%rip),%rsi        # 0x562716c49bf0 <AtFFEnd>
    => 0x00005627165a7801 <_GLOBAL__sub_I_lg.tab.cpp(void)+49>:     vpxor  %xmm0,%xmm0,%xmm0
       0x00005627165a7805 <_GLOBAL__sub_I_lg.tab.cpp(void)+53>:     lea    0x6a2414(%rip),%rax        # 0x562716c49c20 <fespacetype>
    ...
    End of assembler dump.


Therefore the local rebuild worked, when the package was built
at the CPU that were using it later.

In the latest available build log [1] are compiler flags
"-mmmx -mavx" shown.

Unfortunately I saw some bugs in the debian bug tracker
that were told a "baseline violation", I never saw it somewhere
explained what exactly the cpu feature baseline is.

Best would be if this detection would take place at runtime
instead of compile time.

In the configure script there are several lines were CPU flags
are checked from /proc/cpuinfo - these might "just" be disabled
to avoid newer CPU instructions.

Therefore this bug might really be valid und might be reopened again.

Kind regards,
Bernhard


[1] https://buildd.debian.org/status/fetch.php?pkg=freefem%2B%2B&arch=amd64&ver=3.61.1%2Bdfsg1-2%2Bb1&stamp=1542831124&raw=0
-------------- next part --------------

# Buster amd64 qemu VM 2019-03-24

apt update
apt dist-upgrade

apt install systemd-coredump xserver-xorg lightdm openbox devscript dpkg-dev mc gdb freefem++ freefem++-doc freefem++-dbgsym
apt build-dep freefem++


systemctl start lightdm

cp /usr/share/doc/freefem++/examples/examples++-tutorial/a_tutorial.edp .

FreeFem++-nw a_tutorial.edp




mkdir /tmp/source/freefem/orig -p
cd    /tmp/source/freefem/orig
apt source freefem++
cd





set width 0
set pagination off
directory /tmp/source/freefem/orig/freefem++-3.61.1+dfsg1/src/fflib
directory /tmp/source/freefem/orig/freefem++-3.61.1+dfsg1/src/lglib



###########


benutzer at debian:~$ FreeFem++-nw a_tutorial.edp
Ungültiger Maschinenbefehl (Speicherabzug geschrieben)

[  418.337266] traps: FreeFem++-nw[12191] trap invalid opcode ip:5627165a7801 sp:7ffc53da1c20 error:0 in FreeFem++[562716592000+4c0000]

root at debian:~# coredumpctl list
TIME                            PID   UID   GID SIG COREFILE  EXE
Sun 2019-03-24 17:53:20 CET   12191  1000  1000   4 present   /usr/bin/FreeFem++


root at debian:~# coredumpctl gdb 12191
           PID: 12191 (FreeFem++-nw)
           UID: 1000 (benutzer)
           GID: 1000 (benutzer)
        Signal: 4 (ILL)
     Timestamp: Sun 2019-03-24 17:53:20 CET (1min 54s ago)
  Command Line: FreeFem++-nw a_tutorial.edp
    Executable: /usr/bin/FreeFem++
 Control Group: /user.slice/user-1000.slice/session-5.scope
          Unit: session-5.scope
         Slice: user-1000.slice
       Session: 5
     Owner UID: 1000 (benutzer)
       Boot ID: 01f85948a1e64e6794d6e1702ad3beea
    Machine ID: 32f43b50ac8c4b21941bc0b02f8e7811
      Hostname: debian
       Storage: /var/lib/systemd/coredump/core.FreeFem++-nw.1000.01f85948a1e64e6794d6e1702ad3beea.12191.1553446400000000.lz4
       Message: Process 12191 (FreeFem++-nw) of user 1000 dumped core.
                
                Stack trace of thread 12191:
                #0  0x00005627165a7801 n/a (FreeFem++)
                #1  0x0000562716a51dd5 __libc_csu_init (FreeFem++)
                #2  0x00007f6573ed002a __libc_start_main (libc.so.6)
                #3  0x00005627165abcda _start (FreeFem++)

GNU gdb (Debian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/FreeFem++...(no debugging symbols found)...done.

warning: core file may not match specified executable file.
[New LWP 12191]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `FreeFem++-nw a_tutorial.edp'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0x00005627165a7801 in ?? ()
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0  0x00005627165a7801 in ?? ()
#1  0x0000562716a51dd5 in __libc_csu_init ()
#2  0x00007f6573ed002a in __libc_start_main (main=0x5627165a74c0 <main>, argc=2, argv=0x7ffc53da1d48, init=0x562716a51d90 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc53da1d38) at ../csu/libc-start.c:264
#3  0x00005627165abcda in _start ()


Core was generated by `FreeFem++-nw a_tutorial.edp'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0x00005627165a7801 in C_F0::C_F0 (this=0x562716c49c20 <fespacetype>) at ./../fflib/AFunction.hpp:633
633     ./../fflib/AFunction.hpp: Datei oder Verzeichnis nicht gefunden.
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /tmp/source/freefem/orig/freefem++-3.61.1+dfsg1/src/fflib
Source directories searched: /tmp/source/freefem/orig/freefem++-3.61.1+dfsg1/src/fflib:$cdir:$cwd
(gdb) directory /tmp/source/freefem/orig/freefem++-3.61.1+dfsg1/src/lglib
Source directories searched: /tmp/source/freefem/orig/freefem++-3.61.1+dfsg1/src/lglib:/tmp/source/freefem/orig/freefem++-3.61.1+dfsg1/src/fflib:$cdir:$cwd
(gdb) bt
#0  0x00005627165a7801 in C_F0::C_F0 (this=0x562716c49c20 <fespacetype>) at ./../fflib/AFunction.hpp:633
#1  __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at lg.ypp:105
#2  _GLOBAL__sub_I_lg.tab.cpp(void) () at lg.ypp:989
#3  0x0000562716a51dd5 in __libc_csu_init ()
#4  0x00007f6573ed002a in __libc_start_main (main=0x5627165a74c0 <main(int, char**)>, argc=2, argv=0x7ffc53da1d48, init=0x562716a51d90 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc53da1d38) at ../csu/libc-start.c:264
#5  0x00005627165abcda in _start () at ../Graphics/rgraph.hpp:145


(gdb) disassemble $pc-0x20,$pc+0x20
Dump of assembler code from 0x5627165a77e1 to 0x5627165a7821:
   0x00005627165a77e1 <_GLOBAL__sub_I_lg.tab.cpp(void)+17>:     mov    0x69ed91(%rip),%edi        # 0x562716c46578
   0x00005627165a77e7 <_GLOBAL__sub_I_lg.tab.cpp(void)+23>:     lea    0x69ff7a(%rip),%rdx        # 0x562716c47768
   0x00005627165a77ee <_GLOBAL__sub_I_lg.tab.cpp(void)+30>:     lea    0x6a2843(%rip),%rsi        # 0x562716c4a038 <_ZStL8__ioinit>
   0x00005627165a77f5 <_GLOBAL__sub_I_lg.tab.cpp(void)+37>:     callq  0x562716592ae0 <__cxa_atexit at plt>
   0x00005627165a77fa <_GLOBAL__sub_I_lg.tab.cpp(void)+42>:     lea    0x6a23ef(%rip),%rsi        # 0x562716c49bf0 <AtFFEnd>
=> 0x00005627165a7801 <_GLOBAL__sub_I_lg.tab.cpp(void)+49>:     vpxor  %xmm0,%xmm0,%xmm0
   0x00005627165a7805 <_GLOBAL__sub_I_lg.tab.cpp(void)+53>:     lea    0x6a2414(%rip),%rax        # 0x562716c49c20 <fespacetype>
   0x00005627165a780c <_GLOBAL__sub_I_lg.tab.cpp(void)+60>:     lea    0xdddd(%rip),%rdi        # 0x5627165b55f0 <std::vector<void (*)(), std::allocator<void (*)()> >::~vector()>
   0x00005627165a7813 <_GLOBAL__sub_I_lg.tab.cpp(void)+67>:     lea    0x69ff4e(%rip),%rdx        # 0x562716c47768
   0x00005627165a781a <_GLOBAL__sub_I_lg.tab.cpp(void)+74>:     movq   $0x0,0x10(%rsi)
End of assembler dump.


(gdb) list AFunction.hpp:633
628       Expression  f;        // the expression code, cf [[Expression]]
629       aType r;              // the expression type, cf  [[file:../fflib/AnyType.hpp::aType]]
630       
631     public: 
632       //  the constructeur 
633       C_F0() :f(0),r(0) {}
634       C_F0(const C_F0 & c):f(c.f),r(c.r)   {}
635       C_F0(const C_F0 & a,const C_F0 & b); // concatenation 
636
637       /// cf [[Type_Expr]]




(gdb) up
#1  __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at lg.ypp:105
105     C_F0  fespacetype;


(gdb) list lg.ypp:100,110
100     const int sizeStackOfLoop=100; 
101     Block * StackOfLoop[sizeStackOfLoop];
102     // end ADD
103     double CPUcompileInit =0;
104     //class pfes;
105     C_F0  fespacetype;
106     bool fespacecomplex;
107     int fespacedim;
108     extern int UnShowAlloc;
109     int ShowAlloc(const char *s,size_t &);
110     // <<yylex>> Connection from grammar to lexer object zzzfff [[file:../fflib/lex.hpp::zzzfff]] of class mylex



aType r:
    freefem++-3.61.1+dfsg1/src/fflib/AnyType.hpp:40
            typedef const  basicForEachType * aType;

    freefem++-3.61.1+dfsg1/src/fflib/AFunction.hpp:247
            class basicForEachType : public CodeAlloc {

    freefem++-3.61.1+dfsg1/src/fflib/CodeAlloc.hpp:29
            class CodeAlloc { public:



Expression  f:
    freefem++-3.61.1+dfsg1/src/fflib/AFunction.hpp:104
            typedef  E_F0  *  Expression; // [[E_F0]]

    freefem++-3.61.1+dfsg1/src/fflib/AFunction.hpp:369
            class E_F0 :public CodeAlloc 



##############


https://buildd.debian.org/status/fetch.php?pkg=freefem%2B%2B&arch=amd64&ver=3.61.1%2Bdfsg1-2%2Bb1&stamp=1542831124&raw=0

g++-7 -Wl,-z,relro -Wl,--as-needed -DHAVE_CONFIG_H -I. -I../..  -I./../fflib -I./../bamglib -I./../Graphics -I./../femlib -Wdate-time -D_FORTIFY_SOURCE=2  -g  -fdebug-prefix-map=/build/freefem++-cQznyb/freefem++-3.61.1+dfsg1=. -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -O3 -mmmx -mavx -DBAMG_LONG_LONG  -DNCHECKPTR -fPIC -c -o lg.tab.o lg.tab.cpp



More information about the debian-science-maintainers mailing list