Bug 820094 - Invalid opcode (SIGILL) in glibc triggered by asterisk
Summary: Invalid opcode (SIGILL) in glibc triggered by asterisk
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: asterisk
Version: 17
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Jeffrey C. Ollie
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-09 07:05 UTC by Mathieu Chouquet-Stringer
Modified: 2013-08-01 01:07 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-01 01:07:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Output of /proc/cpuinfo (1.31 KB, text/plain)
2012-05-18 16:15 UTC, Jānis Rukšāns
no flags Details

Description Mathieu Chouquet-Stringer 2012-05-09 07:05:04 UTC
Asterisk dies (in modules codec_lpc10.so) with the following backtrace (running on an Atom CPU) because glibc tries to use roundsd which is SSE4.1, the latter not being present on Atom...  I initially reported this in bug 801650 as it seemed related.

Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf'.
Program terminated with signal 4, Illegal instruction.
#0  floor (__x=<optimized out>) at /usr/include/bits/mathinline.h:218
218   __asm ("roundsd $1, %1, %0" : "=x" (__res) : "xm" (__x));

Thread 29 (Thread 0x7f0666121700 (LWP 26507)):
#0  strchrnul () at ../sysdeps/x86_64/strchrnul.S:34
No locals.
#1  0x00007f06975b42df in __find_specmb (format=0x7f064d988e00 "Got 423
Interval too brief for service %s@%s, minimum is %d seconds\n") at
printf-parse.h:99
No locals.
#2  _IO_vfprintf_internal (s=s@entry=0x7f066611ec40,
format=format@entry=0x7f064d988e00 "Got 423 Interval too brief for service
%s@%s, minimum is %d seconds\n", ap=ap@entry=0x7f066611ee08) at vfprintf.c:1277
        thousands_sep = 0x0
        grouping = 0xffffffffffffffff <Address 0xffffffffffffffff out of
bounds>
        done = 0
        f = <optimized out>
        lead_str_end = <optimized out>
        end_of_spec = <optimized out>
        work_buffer = '\000' <repeats 999 times>
        workstart = 0x0
        workend = <optimized out>
        ap_save = {{gp_offset = 40, fp_offset = 48, overflow_arg_area =
0x7f066611f110, reg_save_area = 0x7f066611f020}}
        nspecs_done = 0
        save_errno = 0
        readonly_format = 0
        args_malloced = 0x0
        jump_table =
"\001\000\000\004\000\016\000\006\000\000\a\002\000\003\t\000\005\b\b\b\b\b\b\b\b\b\000\000\000\000\000\000\000\032\000\031\000\023\023\023\000\035\000\000\f\000\000\000\000\000\000\025\000\000\000\000\022\000\r\000\000\000\000\000\000\032\000\024\017\023\023\023\n\017\034\000\v\030\027\021\026\f\000\025\033\020\000\000\022\000\r"
#3  0x00007f0697674ff0 in ___vsnprintf_chk (s=0x7f063c017ca8 "",
maxlen=<optimized out>, flags=flags@entry=1,
slen=slen@entry=18446744073709551615, format=format@entry=0x7f064d988e00 "Got
423 Interval too brief for service %s@%s, minimum is %d seconds\n",
args=args@entry=0x7f066611ee08) at vsnprintf_chk.c:65
        sf = {f = {_sbf = {_f = {_flags = -72515583, _IO_read_ptr =
0x7f063c017ca8 "", _IO_read_end = 0x7f063c017ca8 "", _IO_read_base =
0x7f063c017ca8 "", _IO_write_base = 0x7f063c017ca8 "", _IO_write_ptr =
0x7f063c017ca8 "", _IO_write_end = 0x7f063c017da7 "", _IO_buf_base =
0x7f063c017ca8 "", _IO_buf_end = 0x7f063c017da7 "", _IO_save_base = 0x0,
_IO_backup_base = 0x0, _IO_save_end = 0x0, _markers = 0x0, _chain = 0x0,
_fileno = 0, _flags2 = 4, _old_offset = 0, _cur_column = 0, _vtable_offset = 0
'\000', _shortbuf = "", _lock = 0x0, _offset = 0, _codecvt = 0x0, _wide_data =
0x0, _freeres_list = 0x0, _freeres_buf = 0x0, _freeres_size = 0, _mode = -1,
_unused2 = '\000' <repeats 19 times>}, vtable = 0x7f069791d420}, _s =
{_allocate_buffer = 0, _free_buffer = 0}}, overflow_buf = '\000' <repeats 56
times>"\300, \355\021f\006\177\000"}
        ret = <optimized out>

[...]

Dump of assembler code for function i_nint:
   0x00007f0658765c90 <+0>: movss  (%rdi),%xmm0
   0x00007f0658765c94 <+4>: ucomiss 0x14c9(%rip),%xmm0        # 0x7f0658767164
   0x00007f0658765c9b <+11>: unpcklps %xmm0,%xmm0
   0x00007f0658765c9e <+14>: jb     0x7f0658765cc0 <i_nint+48>
   0x00007f0658765ca0 <+16>: cvtps2pd %xmm0,%xmm0
   0x00007f0658765ca3 <+19>: addsd  0x14e5(%rip),%xmm0        # 0x7f0658767190
=> 0x00007f0658765cab <+27>: roundsd $0x1,%xmm0,%xmm0
   0x00007f0658765cb1 <+33>: cvttsd2si %xmm0,%eax
   0x00007f0658765cb5 <+37>: retq



Version-Release number of selected component (if applicable):
glibc-2.15-35.fc17.x86_64

How reproducible:
Always

Steps to Reproduce:
1. install asterisk
2. start it
3. watch it die
  
Actual results:
Dies with SIGILL

Expected results:
glibc shouldn't be using instructions not supported on a given CPU

Comment 1 Jeff Law 2012-05-11 05:05:46 UTC
This is an asterisk problem.

i_nint is a function within asterisk which calls _floor (f2clib.c):

#ifdef KR_headers
double floor();
integer i_nint(x) real *x;
#else
#undef abs
#include "math.h"
integer i_nint(real *x)
#endif
{
return( (integer)((*x)>=0 ?
        floor(*x + .5) : -floor(.5 - *x)) );
}


The inlined definition of floor from glibc which uses roundsd is protected with:

# if defined __SSE4_1__ && (__WORDSIZE == 64 || defined __SSE2_MATH__)
#  if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99


So from this we can conclude that asterisk's f2clib.c was compiled and either __SSE4_1__ or__SSE2_MATH_ was defined.  glibc is doing exactly what it was asked to to -- use the SSE 4.1 ISA.

Reassigning to asterisk.

Comment 2 Jānis Rukšāns 2012-05-18 16:13:15 UTC
I got hit by this, too. Rebuilding the RPMs locally fixed this - apparently Asterisk build process is using optimizations specific to the build CPU.

Comment 3 Jānis Rukšāns 2012-05-18 16:15:19 UTC
Created attachment 585448 [details]
Output of /proc/cpuinfo

Comment 4 Fedora End Of Life 2013-07-03 22:54:39 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2013-08-01 01:07:19 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.