[GHC] #12110: Windows exception handler change causes segfault with API Monitor
#12110: Windows exception handler change causes segfault with API Monitor ----------------------------------------+---------------------------------- Reporter: enolan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.1 Keywords: | Operating System: Windows Architecture: Unknown/Multiple | Type of failure: Runtime crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: ----------------------------------------+---------------------------------- [http://www.rohitab.com/apimonitor API Monitor] is a debugging tool that intercepts and logs calls to DLLs. It was extremely helpful with debugging #12010 and is broken in recent GHCs. Attaching it to a GHC compiled executable causes the message `Segmentation fault/access violation in generated code` to be printed. Launching one from inside API Monitor doesn't work either, though I can't read the console output before the window closes. Bisect shows the offending commit is 5200bdeb26 - "Replaced SEH handles with VEH handlers which should work uniformly across x86 and x64". I know this is somewhat outside of "standard usage", but there are very few useful debugging tools for stuff like this and I'd really like to not lose this one. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12110> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12110: Windows exception handler change causes segfault with API Monitor -------------------------------------+------------------------------------- Reporter: enolan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): The Exception handlers shouldn't be the issue. The don't cause the segfault. It only handles them when they happen. It likely has to do with how API monitoring does API hooking. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12110#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12110: Windows exception handler change causes segfault with API Monitor -------------------------------------+------------------------------------- Reporter: enolan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by enolan): It works before the commit and doesn't after. It may be fair to blame API Monitor's developer, but the exception handlers are definitely involved. Maybe API Monitor method of hooking triggers the exception handler and it's incorrectly interpreted as a segfault? You definitely know more about this than me. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12110#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12110: Windows exception handler change causes segfault with API Monitor -------------------------------------+------------------------------------- Reporter: enolan | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D3911 * milestone: => 8.4.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12110#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12110: Windows exception handler change causes segfault with API Monitor -------------------------------------+------------------------------------- Reporter: enolan | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"1825cbdbdf08ed4bd6fd6794852596078953298a/ghc" 1825cbdb/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1825cbdbdf08ed4bd6fd6794852596078953298a" Switch VEH to VCH and allow disabling of SEH completely. Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12110#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12110: Windows exception handler change causes segfault with API Monitor -------------------------------------+------------------------------------- Reporter: enolan | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"1421d87c8aabd7b1934f60bef688939882c8251c/ghc" 1421d87/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1421d87c8aabd7b1934f60bef688939882c8251c" Switch VEH to VCH and allow disabling of SEH completely. Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. (Reverted and recommitted to fix authorship information) Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12110#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12110: Windows exception handler change causes segfault with API Monitor -------------------------------------+------------------------------------- Reporter: enolan | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: The double-commit was to fix erroneous authorship information. Sorry for the noise. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12110#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC