[GHC] #14758: Retainer profiler can overflow the C stack

GHC ghc-devs at haskell.org
Sun Feb 4 23:04:35 UTC 2018


#14758: Retainer profiler can overflow the C stack
-------------------------------------+-------------------------------------
           Reporter:  bgamari        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:
          Component:  Profiling      |           Version:  8.4.1-alpha1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I'm not entirely sure what conditions trigger this, but I am observing a
 reliable segmentation fault with a program with large heap compiled with
 8.4.1-alpha3 and run with retainer profiling enabled. Judging by the fact
 that the crashing instruction is a `mov _, ($rsp)`, I'm reasonable certain
 that the issue is a C stack overflow. The top of the stack looks like,
 {{{
 #0  0x000000000249212c in retainClosure (c0=0x42af3459b8,
 cp0=cp0 at entry=0x42af347000, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1488
 #1  0x00000000024932b0 in retain_small_bitmap (c_child_r=0x42bc4fd1a0,
 c=0x42af347000, bitmap=<optimized out>, size=<optimized out>,
 p=0x42af347260) at rts/RetainerProfile.c:1209
 #2  retainStack (c=c at entry=0x42af347000,
 c_child_r=c_child_r at entry=0x42bc4fd1a0, stackStart=<optimized out>,
 stackEnd=0x42af347370) at rts/RetainerProfile.c:1350
 #3  0x0000000002492870 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af345b28, r0=r0 at entry=0x2a5ac20 <CCS_SYSTEM>) at
 rts/RetainerProfile.c:1686
 #4  0x0000000002492887 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af3473e0, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1695
 #5  0x00000000024932b0 in retain_small_bitmap (c_child_r=0x42bc4fd1a0,
 c=0x42af3473e0, bitmap=<optimized out>, size=<optimized out>,
 p=0x42af347690) at rts/RetainerProfile.c:1209
 #6  retainStack (c=c at entry=0x42af3473e0,
 c_child_r=c_child_r at entry=0x42bc4fd1a0, stackStart=<optimized out>,
 stackEnd=0x42af347750) at rts/RetainerProfile.c:1350
 #7  0x0000000002492870 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af345d88, r0=r0 at entry=0x2a5ac20 <CCS_SYSTEM>) at
 rts/RetainerProfile.c:1686
 #8  0x0000000002492887 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af3477c0, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1695
 #9  0x00000000024932b0 in retain_small_bitmap (c_child_r=0x42bc4fd1a0,
 c=0x42af3477c0, bitmap=<optimized out>, size=<optimized out>,
 p=0x42af347a70) at rts/RetainerProfile.c:1209
 #10 retainStack (c=c at entry=0x42af3477c0,
 c_child_r=c_child_r at entry=0x42bc4fd1a0, stackStart=<optimized out>,
 stackEnd=0x42af347b30) at rts/RetainerProfile.c:1350
 #11 0x0000000002492870 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af3481a8, r0=r0 at entry=0x2a5ac20 <CCS_SYSTEM>) at
 rts/RetainerProfile.c:1686
 #12 0x0000000002492887 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af347ba0, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1695
 #13 0x00000000024932b0 in retain_small_bitmap (c_child_r=0x42bc4fd1a0,
 c=0x42af347ba0, bitmap=<optimized out>, size=<optimized out>,
 p=0x42af347e50) at rts/RetainerProfile.c:1209
 #14 retainStack (c=c at entry=0x42af347ba0,
 c_child_r=c_child_r at entry=0x42bc4fd1a0, stackStart=<optimized out>,
 stackEnd=0x42af347f10) at rts/RetainerProfile.c:1350
 #15 0x0000000002492870 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af348408, r0=r0 at entry=0x2a5ac20 <CCS_SYSTEM>) at
 rts/RetainerProfile.c:1686
 #16 0x0000000002492887 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af349000, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1695
 #17 0x00000000024932b0 in retain_small_bitmap (c_child_r=0x42bc4fd1a0,
 c=0x42af349000, bitmap=<optimized out>, size=<optimized out>,
 p=0x42af3492b0) at rts/RetainerProfile.c:1209
 #18 retainStack (c=c at entry=0x42af349000,
 c_child_r=c_child_r at entry=0x42bc4fd1a0, stackStart=<optimized out>,
 stackEnd=0x42af349370) at rts/RetainerProfile.c:1350
 #19 0x0000000002492870 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af348668, r0=r0 at entry=0x2a5ac20 <CCS_SYSTEM>) at
 rts/RetainerProfile.c:1686
 #20 0x0000000002492887 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af3493e0, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1695
 #21 0x00000000024932b0 in retain_small_bitmap (c_child_r=0x42bc4fd1a0,
 c=0x42af3493e0, bitmap=<optimized out>, size=<optimized out>,
 p=0x42af349690) at rts/RetainerProfile.c:1209
 #22 retainStack (c=c at entry=0x42af3493e0,
 c_child_r=c_child_r at entry=0x42bc4fd1a0, stackStart=<optimized out>,
 stackEnd=0x42af349750) at rts/RetainerProfile.c:1350
 #23 0x0000000002492870 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af3488c8, r0=r0 at entry=0x2a5ac20 <CCS_SYSTEM>) at
 rts/RetainerProfile.c:1686
 #24 0x0000000002492887 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af3497c0, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1695
 #25 0x00000000024932b0 in retain_small_bitmap (c_child_r=0x42bc4fd1a0,
 c=0x42af3497c0, bitmap=<optimized out>, size=<optimized out>,
 p=0x42af349a70) at rts/RetainerProfile.c:1209
 #26 retainStack (c=c at entry=0x42af3497c0,
 c_child_r=c_child_r at entry=0x42bc4fd1a0, stackStart=<optimized out>,
 stackEnd=0x42af349b30) at rts/RetainerProfile.c:1350
 #27 0x0000000002492870 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af348b28, r0=r0 at entry=0x2a5ac20 <CCS_SYSTEM>) at
 rts/RetainerProfile.c:1686
 #28 0x0000000002492887 in retainClosure (c0=<optimized out>,
 cp0=cp0 at entry=0x42af349ba0, r0=r0 at entry=0x42bc4fd1a0) at
 rts/RetainerProfile.c:1695
 ...
 }}}
 and this goes on for at least 30000 frames. It looks very much like this
 is a bug in the retainer profiler.

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


More information about the ghc-tickets mailing list