Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,351
    • Issues 5,351
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 564
    • Merge requests 564
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #20085
Closed
Open
Issue created Jul 05, 2021 by Ben Gamari@bgamari🐢Maintainer

Audit Hackage foreign import calling conventions

Unlike most other calling conventions, the AArch64/Darwin ABI depends crucially on width of arguments, particularly when arguments are passed via the stack. Unfortunately, this is the first platform that GHC supports for which this is the case. Consequently, there are numerous latent bugs hiding in Hackage packages which can manifest as undefined behavior at runtime (e.g. see https://github.com/biegunka/terminal-size/pull/16). We should make an attempt at finding such erroneous code and pushing patches upstream when necessary. The safest option is to port all foreign imports of system functions to use the foreign import capi mechanism as this is robust against this sort of failure mode.

Note that the problem with ioctl is not the argument count but rather the fact that it's a varargs function.

Edited Jul 06, 2021 by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking