[GHC] #12657: GHC and GHCi: RWX mmap denied by GrSec, results in a segfault

GHC ghc-devs at haskell.org
Mon Oct 3 17:20:46 UTC 2016


#12657: GHC and GHCi: RWX mmap denied by GrSec, results in a segfault
----------------------------------------+----------------------------------
           Reporter:  PoroCYon          |             Owner:
               Type:  bug               |            Status:  new
           Priority:  normal            |         Milestone:
          Component:  Runtime System    |           Version:  8.0.1
           Keywords:                    |  Operating System:  Linux
       Architecture:  Unknown/Multiple  |   Type of failure:  Runtime crash
          Test Case:                    |        Blocked By:
           Blocking:                    |   Related Tickets:
Differential Rev(s):                    |         Wiki Page:
----------------------------------------+----------------------------------
 When compiling a package (cabal or stack doesn't matter) or launching GHCi
 while running a kernel with GrSec and PaX patches, GHC segfaults because
 GrSec denies an RWX mmap.

 Some packages do compile successfully, but others (such as optparse-
 applicative) don't. Launching GHCi always results in a segfault.

 Here's the output of ghc when compiling the optparse-applicative package:

 {{{
 Building optparse-applicative-0.13.0.0...
 Preprocessing library optparse-applicative-0.13.0.0...
 [ 1 of 15] Compiling Options.Applicative.Help.Pretty (
 Options/Applicative/Help/Pretty.hs,
 dist/build/Options/Applicative/Help/Pretty.o )
 [ 2 of 15] Compiling Options.Applicative.Help.Chunk (
 Options/Applicative/Help/Chunk.hs,
 dist/build/Options/Applicative/Help/Chunk.o )
 [ 3 of 15] Compiling Options.Applicative.Help.Types (
 Options/Applicative/Help/Types.hs,
 dist/build/Options/Applicative/Help/Types.o )
 [ 4 of 15] Compiling Options.Applicative.Types (
 Options/Applicative/Types.hs, dist/build/Options/Applicative/Types.o )
 [ 5 of 15] Compiling Options.Applicative.Internal (
 Options/Applicative/Internal.hs, dist/build/Options/Applicative/Internal.o
 )
 [ 6 of 15] Compiling Options.Applicative.Common (
 Options/Applicative/Common.hs, dist/build/Options/Applicative/Common.o )
 [ 7 of 15] Compiling Options.Applicative.Help.Core (
 Options/Applicative/Help/Core.hs,
 dist/build/Options/Applicative/Help/Core.o )
 ghc: mmap 131072 bytes at (nil): Operation not permitted
 ghc: Try specifying an address with +RTS -xm<addr> -RTS

 Segmentation fault (core dumped)
 }}}

 GrSec log in dmesg:
 {{{
 [15873.000867] grsec: denied RWX mmap of <anonymous mapping> by
 /usr/lib/ghc-8.0.1/bin/ghc[ghc_worker:16494] uid/euid:1000/1000
 gid/egid:1000/1000, parent /usr/bin/cabal[cabal:16486] uid/euid:1000/1000
 gid/egid:1000/1000
 [15873.001018] ghc_worker[16494]: segfault at 0 ip 000003b6c3a7167f sp
 000002b6c23d8e50 error 6 in libHSrts_thr-ghc8.0.1.so[3b6c3a4f000+62000]
 }}}

 And here's the one for ghci:

 {{{
 $ ghci
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 ghc: mmap 131072 bytes at (nil): Operation not permitted
 ghc: Try specifying an address with +RTS -xm<addr> -RTS
 Segmentation fault (core dumped)
 $ echo $?
 139
 }}}

 GrSec complained here with:
 {{{
 [14756.354725] grsec: denied RWX mmap of <anonymous mapping> by
 /usr/lib/ghc-8.0.1/bin/ghc[ghc:15883] uid/euid:1000/1000
 gid/egid:1000/1000, parent /usr/bin/xonsh[xonsh:15879] uid/euid:1000/1000
 gid/egid:1000/1000
 [14756.354875] ghc[15883]: segfault at 0 ip 00000379c0e0b67f sp
 000003f0b7278ce0 error 6 in libHSrts_thr-ghc8.0.1.so[379c0de9000+62000]
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12657>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list