Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#11234 closed bug (fixed)

GHCi on Windows segfaults

Reported by: Phyx- Owned by: Phyx-
Priority: highest Milestone: 8.0.1
Component: Runtime System Version: 7.11
Keywords: Cc: simonmar
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: GHCi crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1683
Wiki Page:

Description

GHCi on Windows has had a segfault for while now on x86_64. During the upgrade of GCC in Phab:D1123 I noticed that test prog003 was failing with a segfault.

Currently the segfault exist in both versions but on x86 it's particularly easy to trigger.

In my case I can't even start ghci.

$ inplace/bin/GHC-stage2.exe --interactive
GHCi, version 7.11.20151213: http://www.haskell.org/ghc/  :? for help
Segmentation fault/access violation in generated code

The segfault does not seem to happen when linked to the debug rts, and running with +RTS -Ds -RTS doesn't report anything special.

Compiling with devel2 so the rts gets compiled with -g the stack trace is not very useful.

(gdb) run --interactive
Starting program: /home/Tamar/ghc/inplace/bin/ghc-stage2 --interactive
[New Thread 108480.0x1960c]
[New Thread 108480.0x19b2c]
[New Thread 108480.0x19c30]
[New Thread 108480.0x1a0a8]
[New Thread 108480.0x1a93c]
[New Thread 108480.0x13954]
[New Thread 108480.0x14440]
GHCi, version 7.11.20151213: http://www.haskell.org/ghc/  :? for help

Program received signal SIGSEGV, Segmentation fault.
0x06843aa5 in ?? ()
(gdb) bt
#0  0x06843aa5 in ?? ()
#1  0x04b82cfc in ?? ()
#2  0x8d078902 in ?? ()
#3  0xc689fd47 in ?? ()
#4  0xff04c583 in ?? ()
#5  0x83c70065 in ?? ()
#6  0x0000033c in ?? ()
#7  0x00000008 in ?? ()
#8  0x04e9c689 in ?? ()
Backtrace stopped: Cannot access memory at address 0x47c70cc8

And the output of p4

(gdb) p4 0x06843aa5
0x6843ab0:      0x330073
0x6843aac:      0x790073 <c1CgU_info+131>
0x6843aa8:      0x6d005c <c1rsa_info+715>
0x6843aa4:      0x3a0045

Change History (6)

comment:1 Changed 3 years ago by simonmar

Priority: highhighest

I guess we should consider this a release blocker.

comment:2 Changed 3 years ago by Phyx-

Differential Rev(s): Phab:D1683
Status: newpatch

comment:3 Changed 3 years ago by Tamar Christina <tamar@…>

In aa7fb9a/ghc:

Fix GHCi segfault in Windows 32bit

Summary:
Add missing calling convention to function pointer,
incorrect `cdecl` calling convention which should be `stdcall`
on x86 was causing the stack to be corrupted. When it tried to
return from the function the return pointer would be invalid.

Test Plan: ./validate

Reviewers: austin, erikd, bgamari, thomie

Reviewed By: bgamari, thomie

Differential Revision: https://phabricator.haskell.org/D1683

GHC Trac Issues: #11234

comment:4 Changed 3 years ago by Phyx-

Resolution: fixed
Status: patchclosed

That should be it for the startup segfault. prog003 seems to run on HEAD already. So that must have been fix by some other commit.

comment:5 Changed 3 years ago by simonpj

Tamar, THANK YOU for sorting this out. Really helpful.

Simon

comment:6 Changed 3 years ago by Phyx-

Cheers :)

Note: See TracTickets for help on using tickets.