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

GHC cvs-ghc at haskell.org
Sat Mar 23 23:45:48 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 just added a minimal example that doesn't need GTK -- see attachment
 ghc-bug-002.zip.

 It's a simple case of Haskell calling into C calling back into Haskell.
 I'm using Fedora 17.  The program works fine when compiled under GHC
 7.0.4:

 {{{
 Setting callback
 set_callback: at top
 set_callback: p_callback = (nil)
 set_callback: callback_data = 0
 set_callback: p_finalizer = (nil)
 set_callback: new pointer values:
 set_callback: p_callback = 0xb77ee02c
 set_callback: callback_data = 10
 set_callback: p_finalizer = 0xb77ee00c
 set_callback: done
 Invoking callback
 invoke_callback: at top
 invoke_callback: p_callback = 0xb77ee02c
 invoke_callback: callback_data = 10
 invoke_callback: p_finalizer = 0xb77ee00c
 invoke_callback: calling callback
 invoke_callback: return value is 11
 invoke_callback: done
 Clearing callback
 clear_callback: at top
 clear_callback: p_callback = 0xb77ee02c
 clear_callback: callback_data = 10
 clear_callback: p_finalizer = 0xb77ee00c
 clear_callback: finalizing callback
 clear_callback: p_callback = (nil)
 clear_callback: callback_data = 0
 clear_callback: p_finalizer = (nil)
 clear_callback: done
 }}}


 But it seg faults under GHC 7.4.2.

 {{{
 Setting callback
 set_callback: at top
 set_callback: p_callback = (nil)
 set_callback: callback_data = 0
 set_callback: p_finalizer = (nil)
 set_callback: new pointer values:
 set_callback: p_callback = 0xb77d702c
 set_callback: callback_data = 10
 set_callback: p_finalizer = 0xb77d700c
 set_callback: done
 Invoking callback
 invoke_callback: at top
 invoke_callback: p_callback = 0xb77d702c
 invoke_callback: callback_data = 10
 invoke_callback: p_finalizer = 0xb77d700c
 invoke_callback: calling callback
 Segmentation fault
 }}}

 On the Ubuntu 12.10 live image, after installing GHC 7.4.2, it runs with
 no seg fault.  However, Ubuntu doesn't use SELinux.  Maybe the thunk that
 goes back into Haskell is jumping to the wrong address, a few bytes before
 the actual function, and the instructions there are basically harmless,
 but SELinux catches them?

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



More information about the ghc-tickets mailing list