Re: Haskell wxneeded
Hi, On 08/26/16 22:44, Matthias Kilian wrote: On Thu, Aug 11, 2016 at 09:37:57AM +0200, Martijn Rijkeboer wrote: On 2016-08-10 22:04, Matthias Kilian wrote: But I want to move forward with ghc (because ghc-8 works much better on OpenBSD as Karel Gardas wrote some time ago). Not necessarily right now, but at least during this release cycle (i.e. before OpenBSD 6.1). Would it be possible to have multiple versions of GHC like the way it is done with Erlang or would that be too much work? Only if the older version of ghc is standalone (no ghc.port.mk, no support for any hs-packages for it, and it would conflict with ghc-8, i.e. you can't install both ghc-7 and ghc-8 packages). And if the bulk builders don't complain about something like ghc-lts in the ports tree. Understood. Thanks for the explanation. Kind regards, Martijn Rijkeboer
Re: Haskell wxneeded
hi, On Thu, Aug 11, 2016 at 09:37:57AM +0200, Martijn Rijkeboer wrote: > On 2016-08-10 22:04, Matthias Kilian wrote: > > But I want to move forward with ghc (because ghc-8 works much better > > on OpenBSD as Karel Gardas wrote some time ago). Not necessarily > > right now, but at least during this release cycle (i.e. before > > OpenBSD 6.1). > > Would it be possible to have multiple versions of GHC like the way it is > done with Erlang or would that be too much work? Only if the older version of ghc is standalone (no ghc.port.mk, no support for any hs-packages for it, and it would conflict with ghc-8, i.e. you can't install both ghc-7 and ghc-8 packages). And if the bulk builders don't complain about something like ghc-lts in the ports tree. Ciao, Kili
Re: Haskell wxneeded
On Sat, Aug 13, 2016 at 10:47 PM, Matthias Kilianwrote: > Hi Karel, > > On Sat, Aug 13, 2016 at 06:56:39PM +0200, Karel Gardas wrote: >> > $ ./inplace/bin/ghc-stage2 --interactive >> > GHCi, version 8.1.20160812: http://www.haskell.org/ghc/ :? for help >> > Prelude> 1+1 >> > 2 >> > Prelude> :q >> > Leaving GHCi. >> > $ >> > >> > I'll try to propagate those fixes to GHC HEAD... >> >> FYI: The fixes are here: >> >> https://phabricator.haskell.org/D2453 >> https://phabricator.haskell.org/D2454 > > The wxneeded "fix" is really just a workaround. It is indeed and it's clearly mentioned isn't it? But anyway it makes things running much better here so it's improvement. > Right now I'm building > and then testing a ghc-7.10.3 that > > - doas *not* link with -z wxneeded, > > - uses mmap with PROT_READ | PROT_WRITE in rts/Linker.c > > - uses mprotect with PROT_READ | PROT_EXEC right after loading and > resolving an object in Linker.c (i.e., just plain W^X) > > Results should be available tomorrow. Good I've been also looking into this, but now I'm investigating full testsuite results. So far majority of failures are in external interpreter. Anyway, I'm looking forward to see your patch(es), although Linker.c is quite moving target I hope I'll be able to forward-port your changes to HEAD and if working well this will be indeed proper fix for the issue and not just mine stopgap solution. Cheers, Karel
Re: Haskell wxneeded
Hi Karel, On Sat, Aug 13, 2016 at 06:56:39PM +0200, Karel Gardas wrote: > > $ ./inplace/bin/ghc-stage2 --interactive > > GHCi, version 8.1.20160812: http://www.haskell.org/ghc/ :? for help > > Prelude> 1+1 > > 2 > > Prelude> :q > > Leaving GHCi. > > $ > > > > I'll try to propagate those fixes to GHC HEAD... > > FYI: The fixes are here: > > https://phabricator.haskell.org/D2453 > https://phabricator.haskell.org/D2454 The wxneeded "fix" is really just a workaround. Right now I'm building and then testing a ghc-7.10.3 that - doas *not* link with -z wxneeded, - uses mmap with PROT_READ | PROT_WRITE in rts/Linker.c - uses mprotect with PROT_READ | PROT_EXEC right after loading and resolving an object in Linker.c (i.e., just plain W^X) Results should be available tomorrow. > if you do have any objections feel free to comment on phabricator... If the testing goes well, I'll add a comment there. Ciao, Kili
Re: Haskell wxneeded
> With two small fixes GHC HEAD's GHCi runs with enforced wxneeded on > wxallowed fs: > > $ ./inplace/bin/ghc-stage2 --interactive > GHCi, version 8.1.20160812: http://www.haskell.org/ghc/ :? for help > Prelude> 1+1 > 2 > Prelude> :q > Leaving GHCi. > $ > > I'll try to propagate those fixes to GHC HEAD... FYI: The fixes are here: https://phabricator.haskell.org/D2453 https://phabricator.haskell.org/D2454 if you do have any objections feel free to comment on phabricator...
Re: Haskell wxneeded
On Sat, Aug 13, 2016 at 7:47 AM, Karel Gardaswrote: >>> Perhaps this is just intended behavior somehow as kernel complains on >>> console with: >>> >>> /home/karel/src/ghc-head-openbsd-wxneeded/inplace/lib/bin/ghc-stage2(94953): >>> W^X binary outside wxallowed mountpoint >>> >>> and obviously my current is w/o any wxallowed fs... >> >> Your port build directory and /usr/local need wxallowed, failures are >> expected >> otherwise. (At present, there are some failures anyway even with this). > > Thanks for clarification, so I'll need to create some wxallowed space > on my -current setup for hacking on GHC. With two small fixes GHC HEAD's GHCi runs with enforced wxneeded on wxallowed fs: $ ./inplace/bin/ghc-stage2 --interactive GHCi, version 8.1.20160812: http://www.haskell.org/ghc/ :? for help Prelude> 1+1 2 Prelude> :q Leaving GHCi. $ I'll try to propagate those fixes to GHC HEAD...
Re: Haskell wxneeded
>> Perhaps this is just intended behavior somehow as kernel complains on >> console with: >> >> /home/karel/src/ghc-head-openbsd-wxneeded/inplace/lib/bin/ghc-stage2(94953): >> W^X binary outside wxallowed mountpoint >> >> and obviously my current is w/o any wxallowed fs... > > Your port build directory and /usr/local need wxallowed, failures are expected > otherwise. (At present, there are some failures anyway even with this). Thanks for clarification, so I'll need to create some wxallowed space on my -current setup for hacking on GHC.
Re: Haskell wxneeded
On 2016/08/13 01:03, Karel Gardas wrote: > On Sat, Aug 13, 2016 at 12:56 AM, Karel Gardaswrote: > [...] > > $ ./ghc/stage2/build/tmp/ghc-stage2 > > ./ghc/stage2/build/tmp/ghc-stage2[1]: syntax error: `)' unexpected > > $ file ./ghc/stage2/build/tmp/ghc-sa tage2 > > ./ghc/stage2/build/tmp/ghc-stage2: ELF 64-bit LSB shared object, > > x86-64, version 1 > > > > > > Have anybody here seen this already? The system is: > > > > Perhaps this is just intended behavior somehow as kernel complains on > console with: > > /home/karel/src/ghc-head-openbsd-wxneeded/inplace/lib/bin/ghc-stage2(94953): > W^X binary outside wxallowed mountpoint > > and obviously my current is w/o any wxallowed fs... Your port build directory and /usr/local need wxallowed, failures are expected otherwise. (At present, there are some failures anyway even with this).
Re: Haskell wxneeded
On Sat, Aug 13, 2016 at 12:56 AM, Karel Gardaswrote: [...] > $ ./ghc/stage2/build/tmp/ghc-stage2 > ./ghc/stage2/build/tmp/ghc-stage2[1]: syntax error: `)' unexpected > $ file ./ghc/stage2/build/tmp/ghc-sa tage2 > ./ghc/stage2/build/tmp/ghc-stage2: ELF 64-bit LSB shared object, > x86-64, version 1 > > > Have anybody here seen this already? The system is: > Perhaps this is just intended behavior somehow as kernel complains on console with: /home/karel/src/ghc-head-openbsd-wxneeded/inplace/lib/bin/ghc-stage2(94953): W^X binary outside wxallowed mountpoint and obviously my current is w/o any wxallowed fs... Karel
Re: Haskell wxneeded
> @Karel Gardas and anyone else who is playing with the newest upstream > ghc (8.x): If you have some time, could you please try to build > some hs-programs or libraries for which naddy@ reported w^x violations > recently with ghc-8 (and probably cabal-install, because I don't > think this will work with the hs-libraries we currently have in the > ports tree)? I'd owe you unlimited amounts of beer for such a test, > of course ;-) :-) Beer is nothing for me, but anyway test done. First of all what Martijn is seeing here is not ghc failure perse, but ghci failure. I smell TH usage here probably. Anyway, GHC head is still buildable by GHC 7.10.3, the obvious problem is that GHCi fails: $ ./inplace/bin/ghc-stage2 --interactive GHCi, version 8.1.20160812: http://www.haskell.org/ghc/ :? for help Abort trap (core dumped) if I try to build it with -Wl,-zwxneeded, then I get strange binary: $ readelf -l ./ghc/stage2/build/tmp/ghc-stage2 Elf file type is DYN (Shared object file) Entry point 0x440 There are 11 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSizMemSiz Flags Align PHDR 0x0040 0x0040 0x0040 0x0348 0x0348 R E8 INTERP 0x000c325e 0x001c325e 0x001c325e 0x0013 0x0013 R 1 [Requesting program interpreter: /usr/libexec/ld.so] LOAD 0x 0x 0x 0x000c325e 0x000c325e R E10 LOAD 0x000c325e 0x001c325e 0x001c325e 0x0003e0ae 0x0003e0ae R 10 LOAD 0x00102180 0x00302180 0x00302180 0x00036998 0x000369e0 RW 10 DYNAMIC0x00132bf0 0x00332bf0 0x00332bf0 0x0360 0x0360 RW 8 NOTE 0x000c3274 0x001c3274 0x001c3274 0x0018 0x0018 R 4 GNU_EH_FRAME 0x0010114c 0x0020114c 0x0020114c 0x005c 0x005c R 4 GNU_STACK 0x 0x 0x 0x 0x RWE8 OPENBSD_WXNEED 0x 0x 0x 0x 0xE8 GNU_RELRO 0x00102180 0x00302180 0x00302180 0x00032e80 0x00032e80 R 1 Section to Segment mapping: Segment Sections... 00 01 .interp 02 .init .plt .text .fini 03 .interp .note.openbsd.ident .hash .dynsym .dynstr .rela.dyn .rela.plt .rodata .eh_frame_hdr .eh_frame 04 .jcr .data.rel.ro .dynamic .ctors .dtors .got .data .bss 05 .dynamic 06 .note.openbsd.ident 07 .eh_frame_hdr 08 09 10 .jcr .data.rel.ro .dynamic .ctors .dtors .got $ ./ghc/stage2/build/tmp/ghc-stage2 ./ghc/stage2/build/tmp/ghc-stage2[1]: syntax error: `)' unexpected $ file ./ghc/stage2/build/tmp/ghc-sa tage2 ./ghc/stage2/build/tmp/ghc-stage2: ELF 64-bit LSB shared object, x86-64, version 1 Have anybody here seen this already? The system is: OpenBSD 6.0-current (GENERIC.MP) #0: Fri Aug 12 22:41:37 CEST 2016 Cheers, Karel
Re: Haskell wxneeded
Hi, On 2016-08-10 22:04, Matthias Kilian wrote: > But I want to move forward with ghc (because ghc-8 works much better > on OpenBSD as Karel Gardas wrote some time ago). Not necessarily > right now, but at least during this release cycle (i.e. before > OpenBSD 6.1). Would it be possible to have multiple versions of GHC like the way it is done with Erlang or would that be too much work? In case that having multiple versions is not viable, I'll switch to Stackage nightly till GHC 8 becomes LTS. Anyway, thanks for your work on this port. Kind regards, Martijn Rijkeboer
Re: Haskell wxneeded
Hi, On Tue, Aug 09, 2016 at 10:20:47AM +0200, Martijn Rijkeboer wrote: > > A real fix would be either hacking on ghcs dynamic loader or trying > > to update to a newer ghc. > > For now I would like to stick to 7.10.3 because I'm using Stackage LTS > which targets that version. But I want to move forward with ghc (because ghc-8 works much better on OpenBSD as Karel Gardas wrote some time ago). Not necessarily right now, but at least during this release cycle (i.e. before OpenBSD 6.1). Ciao, Kili
Re: Haskell wxneeded
Hi, On 2016-08-08 20:53, Matthias Kilian wrote: > Looks like it's ghc itself failing here while trying to dynamically > load ghc-prim. I'll try to write a patch for ghc which marks it as > wxneeded as a workaround. That would be nice. > A real fix would be either hacking on ghcs dynamic loader or trying > to update to a newer ghc. For now I would like to stick to 7.10.3 because I'm using Stackage LTS which targets that version. Kind regards, Martijn Rijkeboer
Haskell wxneeded
Hi, How do I set the wxneeded flag for Haskell? I tried the following in my cabal file, but to no avail: ghc-options: -optl -Wl,-z,wxneeded ld-options: -optl -Wl,-z,wxneeded I have also tried the ld-options flag without the '-optl'. When I try to compile my yesod app I get the following: ghc: mmap 630784 bytes at 0x4000: Not supported ghc: Try specifying an address with +RTS -xm -RTS ghc: panic! (the 'impossible' happened) (GHC version 7.10.3 for x86_64-unknown-openbsd): loadObj "/usr/local/lib/ghc/ghcpr_8TmvWUcS1U1IKHT0levwg3/HSghc-prim-0.4.0.0-8TmvWUcS1U1IKHT0levwg3.o": failed For the record, my partition is mounted wxallowed. $ sysctl kern.version kern.version=OpenBSD 6.0-current (GENERIC.MP) #2335: Sun Aug 7 20:50:41 MDT 2016 dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP Kind regards, Martijn Rijkeboer