Ticket #7655 (new bug)

Opened 4 months ago

Last modified 6 weeks ago

7.6.2 Segmentation Fault/Bus Error in large exponentation

Reported by: Doug310 Owned by: igloo
Priority: normal Milestone: 7.8.1
Component: GHCi Version: 7.6.2
Keywords: Cc:
Operating System: MacOS X Architecture: x86_64 (amd64)
Type of failure: GHCi crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Mac OS X 10.8.2. Haskell Platform 2012.4, 64-bit. GHCI 7.4.2.

Large exponentations cause bus errors or segmentation faults.

Examples:

~/src/haskell$ ghci
GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 12345678901234567890 ^ 12345
Bus error: 10

~/src/haskell$ ghci
GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 2384729837498237^23455
Segmentation fault: 11

Change History

Changed 4 months ago by monoidal

  • status changed from new to closed
  • resolution set to fixed

This is fixed in GHC 7.6.1, according to  http://www.reddit.com/r/haskell/comments/17jyw9/announce_ghc_version_762/c86g3ne

If you can reproduce the bug in 7.6, please reopen.

Changed 4 months ago by Doug310

  • status changed from closed to new
  • version changed from 7.4.2 to 7.6.2
  • resolution fixed deleted
  • summary changed from 7.4.2 Segmentation Fault/Bus Error in large exponentation to 7.6.2 Segmentation Fault/Bus Error in large exponentation

Unfortunately, I am able to reproduce this partially in 7.6.2 for x86_64 using the available binary distribution: ghc-7.6.2-x86_64-apple-darwin.tar.bz2.

~/src/haskell/ghc/ghc-7.6.2$ ghci
GHCi, version 7.6.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 12345678901234567890 ^ 12345
Bus error: 10

However, my second example works:

~/src/haskell/ghc/ghc-7.6.2$ ghci
GHCi, version 7.6.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 2384729837498237 ^ 23455
6856427983194016568523 .... (goes on for hundreds of lines)

The full Bus Error crash report is:

Process:         ghc [27889]
Path:            /opt/ghc-7.6.2-x86_64/*/ghc
Identifier:      ghc
Version:         ???
Code Type:       X86-64 (Native)
Parent Process:  bash [24202]
User ID:         501

Date/Time:       2013-02-04 00:01:12.441 -0500
OS Version:      Mac OS X 10.8.2 (12C60)
Report Version:  10

Interval Since Last Report:          3611040 sec
Crashes Since Last Report:           696
Per-App Crashes Since Last Report:   7
Anonymous UUID:                      145798BC-982C-D5DB-8C3A-18EA16FAB47B

Crashed Thread:  1

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000011203c998

VM Regions Near 0x11203c998:
    MALLOC metadata        000000011203b000-000000011203c000 [    4K] r--/rwx SM=PRV  
--> Stack                  000000011203c000-000000011203d000 [    4K] ---/rwx SM=NUL  
    Stack                  000000011203d000-00000001120bf000 [  520K] rw-/rwx SM=COW  

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff8bbae0fa __psynch_cvwait + 10
1   libsystem_c.dylib             	0x00007fff93534f89 _pthread_cond_wait + 869
2   ghc                           	0x00000001100e16c9 waitCondition + 9
3   ghc                           	0x00000001100be8ab yieldCapability + 395
4   ghc                           	0x00000001100cd382 schedule + 386
5   ghc                           	0x00000001100cddf4 scheduleWaitThread + 164
6   ghc                           	0x00000001100c878e real_main + 68
7   ghc                           	0x00000001100c8896 hs_main + 93
8   ghc                           	0x000000010e0d44f9 main + 73
9   ghc                           	0x000000010e00dbb4 start + 52

Thread 1 Crashed:
0   ???                           	0x00000001129c3d3c 0 + 4607196476
1   ???                           	0x00000001129f44b3 0 + 4607394995
2   ???                           	0x00000001129dbbe4 0 + 4607294436
3   ???                           	0x00000001129f119c 0 + 4607381916
4   ???                           	0x00000001129cc8f2 0 + 4607232242
5   ???                           	0x00000001129c74fa 0 + 4607210746
6   ???                           	0x00000001129ab454 0 + 4607095892
7   ghc                           	0x00000001100f38c8 stg_marked_upd_frame_info_dsp + 16
8   ???                           	0x058d482177000000 0 + 400055250473451520

Thread 2:
0   libsystem_kernel.dylib        	0x00007fff8bbaed2a kevent64 + 10
1   ghc                           	0x000000011006c8f2 s52S_info + 170
2   ghc                           	0x000000011006ca48 s6qO_info_dsp + 24

Thread 3:
0   libsystem_kernel.dylib        	0x00007fff8bbae0fa __psynch_cvwait + 10
1   libsystem_c.dylib             	0x00007fff93534f89 _pthread_cond_wait + 869
2   ghc                           	0x00000001100e16c9 waitCondition + 9
3   ghc                           	0x00000001100be8ab yieldCapability + 395
4   ghc                           	0x00000001100cd382 schedule + 386
5   ghc                           	0x00000001100cdccb scheduleWorker + 27
6   libsystem_c.dylib             	0x00007fff93530742 _pthread_start + 327
7   libsystem_c.dylib             	0x00007fff9351d181 thread_start + 13

Thread 1 crashed with X86 Thread State (64-bit):
  rax: 0x00000000000a5771  rbx: 0x0000000000000560  rcx: 0x00000000ffffffeb  rdx: 0x00000000000000ac
  rdi: 0x000000011203c440  rsi: 0x0000000113b24680  rbp: 0x00000001120312c0  rsp: 0x0000000112031248
   r8: 0x000000000018192d   r9: 0x00000000000000a9  r10: 0xe7d24d796c78192d  r11: 0x41430d29ed17e85b
  r12: 0x0000000000000007  r13: 0x00000000000000a9  r14: 0x0000000000000003  r15: 0x00000000000000ac
  rip: 0x00000001129c3d3c  rfl: 0x0000000000010286  cr2: 0x000000011203c998
Logical CPU: 4

Binary Images:
       0x10e00d000 -        0x1101c0fe7 +ghc (???) <1010B9EB-C2AF-32E2-AD15-CEB7B26CA475> /opt/ghc-7.6.2-x86_64/*/ghc
    0x7fff6dc0d000 -     0x7fff6dc4193f  dyld (210.2.3) <A40597AA-5529-3337-8C09-D8A014EB1578> /usr/lib/dyld
    0x7fff8787a000 -     0x7fff87880fff  libmacho.dylib (829) <BF332AD9-E89F-387E-92A4-6E1AB74BD4D9> /usr/lib/system/libmacho.dylib
    0x7fff8797b000 -     0x7fff879c7ff7  libauto.dylib (185.1) <73CDC482-16E3-3FC7-9BB4-FBA2DA44DBC2> /usr/lib/libauto.dylib
    0x7fff87b21000 -     0x7fff87b29fff  liblaunch.dylib (442.26.2) <2F71CAF8-6524-329E-AC56-C506658B4C0C> /usr/lib/system/liblaunch.dylib
    0x7fff88aef000 -     0x7fff88af0ff7  libremovefile.dylib (23.1) <DBBFAF35-AC78-3856-92F6-6E4FD9DF14A2> /usr/lib/system/libremovefile.dylib
    0x7fff88db3000 -     0x7fff88dbbff7  libsystem_dnssd.dylib (379.32.1) <62AA0B84-188A-348B-8F9E-3E2DB08DB93C> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff89272000 -     0x7fff8927dfff  libsystem_notify.dylib (98.5) <C49275CC-835A-3207-AFBA-8C01374927B6> /usr/lib/system/libsystem_notify.dylib
    0x7fff8b590000 -     0x7fff8b5dfff7  libcorecrypto.dylib (106.2) <CE0C29A3-C420-339B-ADAA-52F4683233CC> /usr/lib/system/libcorecrypto.dylib
    0x7fff8b9fb000 -     0x7fff8ba29ff7  libsystem_m.dylib (3022.6) <B434BE5C-25AB-3EBD-BAA7-5304B34E3441> /usr/lib/system/libsystem_m.dylib
    0x7fff8bb9a000 -     0x7fff8bb9bfff  libsystem_blocks.dylib (59) <D92DCBC3-541C-37BD-AADE-ACC75A0C59C8> /usr/lib/system/libsystem_blocks.dylib
    0x7fff8bb9c000 -     0x7fff8bbb7ff7  libsystem_kernel.dylib (2050.18.24) <C0535565-35D1-31A7-A744-63D9F10F12A4> /usr/lib/system/libsystem_kernel.dylib
    0x7fff8c182000 -     0x7fff8c185ff7  libdyld.dylib (210.2.3) <F59367C9-C110-382B-A695-9035A6DD387E> /usr/lib/system/libdyld.dylib
    0x7fff8d57f000 -     0x7fff8d580ff7  libSystem.B.dylib (169.3) <365477AB-D641-389D-B8F4-A1FAE9657EEE> /usr/lib/libSystem.B.dylib
    0x7fff8e231000 -     0x7fff8e236fff  libcache.dylib (57) <65187C6E-3FBF-3EB8-A1AA-389445E2984D> /usr/lib/system/libcache.dylib
    0x7fff8e237000 -     0x7fff8e26dfff  libsystem_info.dylib (406.17) <4FFCA242-7F04-365F-87A6-D4EFB89503C1> /usr/lib/system/libsystem_info.dylib
    0x7fff8e35d000 -     0x7fff8e452fff  libiconv.2.dylib (34) <FEE8B996-EB44-37FA-B96E-D379664DEFE1> /usr/lib/libiconv.2.dylib
    0x7fff8f2de000 -     0x7fff8f2e4ff7  libunwind.dylib (35.1) <21703D36-2DAB-3D8B-8442-EAAB23C060D3> /usr/lib/system/libunwind.dylib
    0x7fff8f8de000 -     0x7fff8f9f692f  libobjc.A.dylib (532.2) <90D31928-F48D-3E37-874F-220A51FD9E37> /usr/lib/libobjc.A.dylib
    0x7fff910e4000 -     0x7fff9114cff7  libc++.1.dylib (65.1) <20E31B90-19B9-3C2A-A9EB-474E08F9FE05> /usr/lib/libc++.1.dylib
    0x7fff9114d000 -     0x7fff9114fff7  libunc.dylib (25) <92805328-CD36-34FF-9436-571AB0485072> /usr/lib/system/libunc.dylib
    0x7fff91818000 -     0x7fff91819ff7  libdnsinfo.dylib (453.18) <E7595861-ECF9-336E-9901-BED2620FAA80> /usr/lib/system/libdnsinfo.dylib
    0x7fff91a6c000 -     0x7fff91a81ff7  libdispatch.dylib (228.23) <D26996BF-FC57-39EB-8829-F63585561E09> /usr/lib/system/libdispatch.dylib
    0x7fff91a84000 -     0x7fff91a8bfff  libcopyfile.dylib (89) <876573D0-E907-3566-A108-577EAD1B6182> /usr/lib/system/libcopyfile.dylib
    0x7fff92190000 -     0x7fff921b5ff7  libc++abi.dylib (24.4) <E7BD9363-1D25-3551-A68A-2E2FF6ABECD7> /usr/lib/libc++abi.dylib
    0x7fff92b1b000 -     0x7fff92b3dff7  libxpc.dylib (140.41) <FAC04D8B-680E-325F-8F0C-DD69859D0E01> /usr/lib/system/libxpc.dylib
    0x7fff92ce4000 -     0x7fff92ce4fff  libkeymgr.dylib (25) <CC9E3394-BE16-397F-926B-E579B60EE429> /usr/lib/system/libkeymgr.dylib
    0x7fff92ce6000 -     0x7fff92ce7ff7  libsystem_sandbox.dylib (220) <3C3B03CF-C525-3CB3-8557-62E91B93AC95> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff92ce8000 -     0x7fff92cedfff  libcompiler_rt.dylib (30) <08F8731D-5961-39F1-AD00-4590321D24A9> /usr/lib/system/libcompiler_rt.dylib
    0x7fff933e2000 -     0x7fff933f0ff7  libsystem_network.dylib (77.10) <0D99F24E-56FE-380F-B81B-4A4C630EE587> /usr/lib/system/libsystem_network.dylib
    0x7fff934e3000 -     0x7fff9351bfff  libncurses.5.4.dylib (37.3) <68D5B5F5-8252-3F1E-AFF1-C6AFE145DBC1> /usr/lib/libncurses.5.4.dylib
    0x7fff9351c000 -     0x7fff935e8fe7  libsystem_c.dylib (825.25) <8CBCF9B9-EBB7-365E-A3FF-2F3850763C6B> /usr/lib/system/libsystem_c.dylib
    0x7fff93c5c000 -     0x7fff93c5efff  libquarantine.dylib (52) <4BE2E642-A14F-340A-B482-5BD2AEFD9C24> /usr/lib/system/libquarantine.dylib
    0x7fff93c61000 -     0x7fff93c6ffff  libcommonCrypto.dylib (60026) <2D6537F5-1B5E-305C-A1CF-D1FA80CA3939> /usr/lib/system/libcommonCrypto.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 10900
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=120.4M resident=226.4M(188%) swapped_out_or_unallocated=16777216.0T(14611640221696%)
Writable regions: Total=70.3M written=22.0M(31%) resident=25.2M(36%) swapped_out=0K(0%) unallocated=45.2M(64%)
 
REGION TYPE                      VIRTUAL
===========                      =======
MALLOC                             36.4M
MALLOC guard page                    16K
STACK GUARD                        56.0M
Stack                              9756K
VM_ALLOCATE                        21.7M
__DATA                             3244K
__LINKEDIT                         81.0M
__TEXT                             39.4M
mapped file                        11.6M
shared memory                        12K
===========                      =======
TOTAL                             258.8M

Model: MacBookPro8,2, BootROM MBP81.0047.B27, 4 processors, Intel Core i7, 2.3 GHz, 16 GB, SMC 1.69f3
Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 512 MB
Graphics: AMD Radeon HD 6750M, AMD Radeon HD 6750M, PCIe, 1024 MB
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1333 MHz, 0x0000, 0x000000000000000000000000000000000000
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1333 MHz, 0x0000, 0x000000000000000000000000000000000000
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xD6), Broadcom BCM43xx 1.0 (5.106.98.81.22)
Bluetooth: Version 4.0.9f33 10885, 2 service, 18 devices, 1 incoming serial ports
Network Service: AirPort, AirPort, en1
Network Service: Logitech Harmony USB (en2), Ethernet, en2
Serial ATA Device: OCZ-VERTEX3, 480.1 GB
Serial ATA Device: Hitachi HTS725050A9A362, 500.11 GB
USB Device: hub_device, 0x0424  (SMSC), 0x2513, 0xfa100000 / 3
USB Device: iPad, apple_vendor_id, 0x12ab, 0xfa130000 / 6
USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x0245, 0xfa120000 / 5
USB Device: BRCM2070 Hub, 0x0a5c  (Broadcom Corp.), 0x4500, 0xfa110000 / 4
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x821a, 0xfa113000 / 8
USB Device: FaceTime HD Camera (Built-in), apple_vendor_id, 0x8509, 0xfa200000 / 2
USB Device: hub_device, 0x0424  (SMSC), 0x2513, 0xfd100000 / 2
USB Device: IR Receiver, apple_vendor_id, 0x8242, 0xfd110000 / 3

Changed 4 months ago by Doug310

I downloaded the i386 Mac OS X binary of 7.6.2 and tested both these exponentiations, and one more (with another digit in the exponent just for good measure). They all worked fine.

Changed 6 weeks ago by igloo

  • owner set to igloo
  • difficulty set to Unknown
  • milestone set to 7.8.1

Thanks for the report. I'll see if I can reproduce the problem.

Note: See TracTickets for help on using tickets.