From 7b2111480486824acae7a035802d5177d19add64 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 29 Apr 2025 22:41:32 +0200 Subject: [PATCH 1/3] =?UTF-8?q?haskellPackages.cryptohash-sha256:=20disabl?= =?UTF-8?q?e=20tests=20on=2032bit=20=F0=9F=91=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From experience, cryptography-related packages are frequently affected by either incorrectness in GHC or bugs relating to word size on different architecture, so it's usually bad to disable their test suites. In the case of cryptohash-sha256, SHA is used as a point of reference which doesn't pass its test suite on 32bit, so we can only pray that cryptohash-sha256 doesn't suffer from a similar problem. --- .../development/haskell-modules/configuration-common.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index f17fd3cd1cfb..15aefb6b77c2 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -2302,6 +2302,15 @@ self: super: # Overwrite the build cores raaz = disableParallelBuilding super.raaz; + # Test suite uses SHA as a point of comparison which doesn't + # succeeds its own test suite on 32bit: + # https://github.com/GaloisInc/SHA/issues/16 + cryptohash-sha256 = + if pkgs.stdenv.hostPlatform.is32bit then + dontCheck super.cryptohash-sha256 + else + super.cryptohash-sha256; + # https://github.com/andreymulik/sdp/issues/3 sdp = disableLibraryProfiling super.sdp; sdp-binary = disableLibraryProfiling super.sdp-binary; From 420eaa998ed8e3069f8137fb4bf16a75475291a7 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Wed, 30 Apr 2025 00:52:46 +0200 Subject: [PATCH 2/3] haskell.compiler.*: fix stack overrun on 32bit platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Could be observed by executing GHCi or running isocline's “test suite”. --- pkgs/development/compilers/ghc/common-hadrian.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index e180d684c359..a78b8a1a90da 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -279,6 +279,17 @@ includes = [ "configure.ac" ]; hash = "sha256-L3FQvcm9QB59BOiR2g5/HACAufIG08HiT53EIOjj64g="; }) + ] + # Fixes stack overrun in rts which crashes an process whenever + # freeHaskellFunPtr is called with nixpkgs' hardening flags. + # https://gitlab.haskell.org/ghc/ghc/-/issues/25485 + # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13599 + ++ lib.optionals (lib.versionOlder version "9.13") [ + (fetchpatch { + name = "ghc-rts-adjustor-fix-i386-stack-overrun.patch"; + url = "https://gitlab.haskell.org/ghc/ghc/-/commit/39bb6e583d64738db51441a556d499aa93a4fc4a.patch"; + sha256 = "0w5fx413z924bi2irsy1l4xapxxhrq158b5gn6jzrbsmhvmpirs0"; + }) ]; stdenv = stdenvNoCC; From 69b8720db0fa3619269b904554066f9dea346976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 30 Apr 2025 09:01:31 +0200 Subject: [PATCH 3/3] haskell.compiler.*: avoid rebuild on 64-bit for now --- pkgs/development/compilers/ghc/common-hadrian.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index a78b8a1a90da..2ab984fa6e2e 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -284,7 +284,7 @@ # freeHaskellFunPtr is called with nixpkgs' hardening flags. # https://gitlab.haskell.org/ghc/ghc/-/issues/25485 # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13599 - ++ lib.optionals (lib.versionOlder version "9.13") [ + ++ lib.optionals (lib.versionOlder version "9.13" && stdenv.hostPlatform.is32bit) [ (fetchpatch { name = "ghc-rts-adjustor-fix-i386-stack-overrun.patch"; url = "https://gitlab.haskell.org/ghc/ghc/-/commit/39bb6e583d64738db51441a556d499aa93a4fc4a.patch";