[GHC] #13832: No parameter-validation in Control.Concurrent.setNumCapabilities
#13832: No parameter-validation in Control.Concurrent.setNumCapabilities -------------------------------------+------------------------------------- Reporter: AlistairWard | Owner: (none) Type: bug | Status: new Priority: low | Milestone: Component: Core | Version: 8.0.1 Libraries | Keywords: | Operating System: Linux setNumCapabilities | Architecture: x86 | Type of failure: Runtime crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+-------------------------------------
ghci GHCi, version 7.6.3: 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> Control.Concurrent.setNumCapabilities $ negate 1 malloc: failed on request for 18446744073709551104 bytes; message: moreCapabilities
The parameter is forwarded to the underlying C-function without validation, the runtime then crashes; no exception is thrown. This behaviour also exists in ghc 8.0.2 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13832> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13832: No parameter-validation in Control.Concurrent.setNumCapabilities -------------------------------------+------------------------------------- Reporter: AlistairWard | Owner: (none) Type: bug | Status: new Priority: low | Milestone: Component: Core Libraries | Version: 8.0.1 Resolution: | Keywords: | setNumCapabilities Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"9849403147b584ff160daeb4f13bf36adb2bab2e/ghc" 9849403/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="9849403147b584ff160daeb4f13bf36adb2bab2e" base: Validate input in setNumCapabilities Test Plan: validate Reviewers: austin, hvr, erikd, simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #13832 Differential Revision: https://phabricator.haskell.org/D3652 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13832#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13832: No parameter-validation in Control.Concurrent.setNumCapabilities -------------------------------------+------------------------------------- Reporter: AlistairWard | Owner: (none) Type: bug | Status: merge Priority: low | Milestone: 8.2.1 Component: Core Libraries | Version: 8.0.1 Resolution: | Keywords: | setNumCapabilities Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => merge * milestone: => 8.2.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13832#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13832: No parameter-validation in Control.Concurrent.setNumCapabilities -------------------------------------+------------------------------------- Reporter: AlistairWard | Owner: (none) Type: bug | Status: merge Priority: low | Milestone: 8.2.1 Component: Core Libraries | Version: 8.0.1 Resolution: | Keywords: | setNumCapabilities Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by bgamari: @@ -0,0 +1,1 @@ + {{{ @@ -9,0 +10,1 @@ + }}} New description: {{{
ghci GHCi, version 7.6.3: 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> Control.Concurrent.setNumCapabilities $ negate 1 malloc: failed on request for 18446744073709551104 bytes; message: moreCapabilities }}}
The parameter is forwarded to the underlying C-function without validation, the runtime then crashes; no exception is thrown. This behaviour also exists in ghc 8.0.2 -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13832#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13832: No parameter-validation in Control.Concurrent.setNumCapabilities -------------------------------------+------------------------------------- Reporter: AlistairWard | Owner: (none) Type: bug | Status: closed Priority: low | Milestone: 8.2.1 Component: Core Libraries | Version: 8.0.1 Resolution: fixed | Keywords: | setNumCapabilities Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.2` as a4e782087ae0df211f8d48c11ded0b1dd81f40a4. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13832#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13832: No parameter-validation in Control.Concurrent.setNumCapabilities -------------------------------------+------------------------------------- Reporter: AlistairWard | Owner: (none) Type: bug | Status: closed Priority: low | Milestone: 8.2.1 Component: Core Libraries | Version: 8.0.1 Resolution: fixed | Keywords: | setNumCapabilities Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"b9f9670c8cf4eac8798a8cb3e683d0411f9e94ec/ghc" b9f9670/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="b9f9670c8cf4eac8798a8cb3e683d0411f9e94ec" rts: Ensure that new capability count is > 0 The Haskell wrapper already checks this but we should also check it in the RTS to catch non-Haskell callers. See #13832. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13832#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC