[GHC] #15543: Binary crashes under dtrace

#15543: Binary crashes under dtrace -------------------------------------+------------------------------------- Reporter: last_g | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Research needed Component: Compiler | Version: 8.4.3 Keywords: dtrace, crash | Operating System: MacOS X Architecture: | Type of failure: Runtime crash Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When I'm trying to attach to the simple binary with DTrace command ({{{sudo dtrace -n 'pid$1:::' `ps aux | grep FibbSlow | grep -v grep | awk '{print $2}'` }}}) it crashes with various outcomes. This happens on both GHC 8.4.3 from `stack` and manually built ghc from the master branch. Crashes: {{{ lastg-mbp:t lastg$ ./FibbSlow.master 55 FibbSlow.master: internal error: scavenge: unimplemented/strange closure type 13369548 @ 0x420021abb0^[[B (GHC version 8.7.20180817 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} {{{ lastg-mbp:t lastg$ ./FibbSlow.stack.8.4 55 FibbSlow.stack.8.4: internal error: scavenge_one: strange object 13369548 (GHC version 8.4.3 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Abort trap: 6 }}} {{{ lastg-mbp:t lastg$ ./FibbSlow.stack.8.4 55 FibbSlow.stack.8.4: internal error: scavenge_one: strange object 13369548 (GHC version 8.4.3 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Abort trap: 6 }}} {{{ lastg-mbp:t lastg$ ./FibbSlow.stack.8.4 55 Segmentation fault: 11 }}} Source code for the binary: https://gist.github.com/last-g/cfddab60a8520eb51214ef2a7bc48ec2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15543 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15543: Binary crashes under dtrace ----------------------------------+---------------------------------------- Reporter: last_g | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: | Keywords: dtrace, crash Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Changes (by bgamari): * milestone: Research needed => Comment: Very interesting. Perhaps the generated dtrace tracepoints are incorrect, resulting in our executable image being corrupted? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15543#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15543: Binary crashes under dtrace ----------------------------------+---------------------------------------- Reporter: last_g | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: | Keywords: dtrace, crash Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+---------------------------------------- Comment (by last_g): Similar happens with System Tap but I don't know is it related or not. {{{ [lastg@devvm2623.lla2 ~/scratches/ghc_tests] sudo stap pc.stp -c '~/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3 10' WARNING: function _start return probe is blacklisted: keyword at pc.stp:24:1 source: probe process.function("*").return { trace(-1, $$return) } ^ WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("hs_atomic_add32").return inode-offset 0000000000098b90 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("m32_free_internal@rts/linker/M32Alloc.c:176").return inode-offset 00000000000bd6b0 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("hs_atomic_add32") inode-offset 0000000000098b90 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("atoi@/usr/include/stdlib.h:278") inode-offset 0000000000000808 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("atoi@/usr/include/stdlib.h:278") inode-offset 0000000000000238 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("m32_free_internal@rts/linker/M32Alloc.c:176") inode-offset 00000000000bd6b0 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("get_itbl@includes/rts/storage/ClosureMacros.h:84") inode-offset 0000000000000131 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("Bdescr@includes/rts/storage/Block.h:172") inode-offset 0000000000000018 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("bco_sizeW@includes/rts/storage/ClosureMacros.h:354") inode-offset 0000000000000040 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("XXH32_round@rts/xxhash.c:255") inode-offset 0000000000000250 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("XXH32_round@rts/xxhash.c:255") inode-offset 00000000000000da registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("XXH_readLE64_align@rts/xxhash.c:580") inode-offset 00000000000001cc registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("loadObj_@rts/Linker.c:1446") inode-offset 0000000000000012 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("preloadObjectFile@rts/Linker.c:1319") inode-offset 0000000000000040 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("ghciRemoveSymbolTable@rts/Linker.c:227") inode-offset 0000000000000040 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("stat@/usr/include/x86_64 -linux-gnu/sys/stat.h:453") inode-offset 0000000000000040 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("appendToRunQueue@rts/Schedule.h:130") inode-offset 00000000000000d2 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("unlockClosure@rts/SMPClosureOps.h:108") inode-offset 0000000000000110 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.8-4-3.O3").function("lockClosure@rts/SMPClosureOps.h:99") inode-offset 0000000000000018 registration error (rc -524) WARNING: Child process exited with signal 11 (Segmentation fault) WARNING: /usr/bin/staprun exited with status: 1 Pass 5: run failed. [man error::pass5] }}} and on `master` {{{ [lastg@devvm2623.lla2 ~/scratches/ghc_tests] sudo stap pc.stp -c '~/scratches/ghc_tests/test_cases/FibbSlow.master.O3 10' WARNING: function _start return probe is blacklisted: keyword at pc.stp:24:1 source: probe process.function("*").return { trace(-1, $$return) } ^ WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("hs_atomic_add32").return inode-offset 00000000000805c0 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("m32_free_internal@rts/linker/M32Alloc.c:176").return inode-offset 000000000008f500 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("hs_atomic_add32") inode-offset 00000000000805c0 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("get_itbl@includes/rts/storage/ClosureMacros.h:84") inode-offset 0000000000000131 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("Bdescr@includes/rts/storage/Block.h:170") inode-offset 00000000000001b0 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("Bdescr@includes/rts/storage/Block.h:170") inode-offset 0000000000000191 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("XXH32_round@rts/xxhash.c:255") inode-offset 0000000000000251 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("thunk_sizeW_fromITBL@includes/rts/storage/ClosureMacros.h:313") inode-offset 0000000000000040 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("m32_free_internal@rts/linker/M32Alloc.c:176") inode-offset 000000000008f500 registration error (rc -524) WARNING: probe process("/home/lastg/scratches/ghc_tests/test_cases/FibbSlow.master.O3").function("ghciRemoveSymbolTable@rts/Linker.c:228") inode-offset 0000000000000040 registration error (rc -524) WARNING: Child process exited with signal 11 (Segmentation fault) WARNING: /usr/bin/staprun exited with status: 1 Pass 5: run failed. [man error::pass5] }}} In the same time, it gets the same warnings but works when attached to a running process with {{{ sudo stap pc.stp -x `pgrep Fib` }}}. I suppose there's something with process/RTS initialization. I also tested different compiler versions: it crashes on 8.2, 8.4 and master and works well on 8.0. {{{ pc.stp: }}} {{{ #! /usr/bin/env stap function trace(entry_p, extra) { %( $# > 1 %? if (tid() in trace) %) printf("%s%s%s %s\n", thread_indent (entry_p), (entry_p>0?"->":"<-"), ppfunc (), extra) } probe process.function("*") { trace(1, $$parms) } probe process.function("*").return { trace(-1, $$return) } }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15543#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC