ghc: mmap 131072 bytes at 0x0: Operation not permitted in HardenedBSD-11-STABLE-v1100055 reddit / BSD ---------------------------------------------------------------------- mcandre · 2018-04-04 00:44 Hiya! I'm trying to install HLint via cabal (`cabal install HLint`) in HardenedBSD, so that I can lint my Haskell programs. I can do this in FreeBSD. However, when I run that in HardenedBSD, I get `ghc: mmap 131072 bytes at 0x0: Operation not permitted`. I can install other Haskell packages with cabal in HardenedBSD, like QuickCheck and shake. Just not HLint, which is a huge dependency tree. I tried adding more swap space, yet `top` seemed to indicate that the mmap error occurred while the swap space wasn't even touched! Does this represent an error in ghc maybe? I'm not sure how HardenedBSD's mmap operates differently compared to FreeBSD's. Also dropping a report in the ghc trac to be sure. https://ghc.haskell.org/trac/ghc/ticket/14988 ---------------------------------------------------------------------- BumpitySnook · 2018-04-04 01:19 Can't tell definitively without the mmap flags, but this looks like an intentional "hardening" tactic — prevent mapping memory at NULL, which might prevents some classes of userspace bug — by crashing the program with SIGSEGV instead. I'd suggest determining why the heck HLint wants to map memory at NULL. Or maybe it's just an anonymous memory request? Check if MAP_FIXED is being specified with `truss`, if that works on HBSD (I don't use it myself). ---------------------------------------------------------------------- Nanosleep · 2018-04-04 02:02 ghc/cabal is a total shitshow on openbsd as well with W^X enabled anywhere; I would imagine the mmap on your hardenedbsd system could be being denied for a similar reason. Maybe there's a w^x violation logged in your dmesg? ---------------------------------------------------------------------- mcandre · 2018-04-04 02:26 Thanks for the tip! I will take a look for those logs. Does FreeBSD not have W^X enabled by default? Maybe that’s why HLint installs fine in FreeBSD. ---------------------------------------------------------------------- Nanosleep · 2018-04-04 02:43 > Does FreeBSD not have W^X enabled by default? I don't even think they have a W^X implementation *to* enable. ---------------------------------------------------------------------- BumpitySnook · 2018-04-04 04:02 I believe you are correct. ---------------------------------------------------------------------- phessler · 2018-04-04 07:15 FreeBSD not having W^X is *why* HardenedBSD exists in the first place.