[GHC] #7629: segmentation fault in compiled program, involves gtk, selinux

GHC cvs-ghc at haskell.org
Thu Mar 7 03:07:44 CET 2013


#7629: segmentation fault in compiled program, involves gtk, selinux
-----------------------------------------------------------------+----------
    Reporter:  wgmitchener                                       |       Owner:  simonmar     
        Type:  bug                                               |      Status:  infoneeded   
    Priority:  high                                              |   Milestone:  7.6.2        
   Component:  Runtime System                                    |     Version:  7.4.2        
    Keywords:  segmentation fault, multithreading, selinux, gtk  |          Os:  Linux        
Architecture:  x86                                               |     Failure:  Runtime crash
  Difficulty:  Unknown                                           |    Testcase:               
   Blockedby:                                                    |    Blocking:               
     Related:                                                    |  
-----------------------------------------------------------------+----------

Comment(by wgmitchener):

 I've been working with gtk 2.32.4, ghc 7.4.2, and the development tree
 from gtk2hs.  I added a few print statements and tracked down this much of
 the problem:

 {{{
 makeCallback: funPtr = 0xb7e8900c
 makeCallback: destroyFunPtr = 0x0821fcd6
 g_timeout_add_full: function = 0xb7e8900c
 g_timeout_add_full: data = 0xb7e8900c
 g_timeout_add_full: notify = 0x821fcd6
 g_main_dispatch: dispatch = 0xb7ed11c0
 g_main_dispatch: source = 0x82c0500
 g_main_dispatch: callback = 0xb7e8900c
 g_main_dispatch: user_data = 0xb7e8900c
 g_timeout_dispatch: source = 0x82c0500
 g_timeout_dispatch: callback = 0xb7e8900c
 g_timeout_dispatch: user_data = 0xb7e8900c

 (gdb) disass /r 0xb7e8900c,+5
 Dump of assembler code from 0xb7e8900c to 0xb7e89011:
    0xb7e8900c:  e8 c3 14 3b 50  call   0x823a4d4
 End of assembler dump.

 (gdb) disass /r 0x823a4d4,+20
 Dump of assembler code from 0x823a4d4 to 0x823a4e8:
 => 0x0823a4d4:  00 00   add    %al,(%eax)
    0x0823a4d6:  00 00   add    %al,(%eax)
    0x0823a4d8:  20 00   and    %al,(%eax)
    0x0823a4da:  00 00   add    %al,(%eax)
    0x0823a4dc <stg_sel_ret_5_upd_info+0>:       89 f0   mov    %esi,%eax
    0x0823a4de <stg_sel_ret_5_upd_info+2>:       83 e0 fc        and
 $0xfffffffc,%eax
    0x0823a4e1 <stg_sel_ret_5_upd_info+5>:       8b 70 18        mov
 0x18(%eax),%esi
    0x0823a4e4 <stg_sel_ret_5_upd_info+8>:       83 c5 04        add
 $0x4,%ebp
    0x0823a4e7 <stg_sel_ret_5_upd_info+11>:      f7 c6 03 00 00 00
 test   $0x3,%esi
 End of assembler dump.
 }}}

 In gtk2hs/Glib/System/Glib/MainLoop.chs, makeCallback function, the call
 to mkSourceFunc (which is a foreign import wrapper) seems to return a
 thunk stored at 0xb7e8900c, but the function call right at that address
 seems to be off by 8 bytes?  Those first four instructions make no sense.
 The seg fault happens at that first add %al, (%eax) because %eax is a bad
 pointer.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7629#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list