Skip to content
  • Deucе's avatar
    Allow RWX pages on NetBSD and OpenBSD. · d3a1c675
    Deucе authored
    By default, both NetBSD and OpenBSD will not allow pages to be mapped
    both writable and executable.
    
    On OpenBSD, if the filesystem is mounted with the wxallowed option,
    this would work, and before v6.0, passing -z wxallowed to the linker
    would allow it on a per-binary basis.  However, since this is not
    the default, and since the JS engine can use mprotect() to switch
    between RW and RX, I've decided to enable this instead.  This will
    slow things down, but it will work "out of the box".
    
    For NetBSD, the situation is different, you can't switch between
    RW and RX using mprotect()... instead, you need to use mremap() to
    get a separate mapping for each set of perms.  This does *not*
    appear to be present in the 1.8.5 source, so we can't do the same
    fix as OpenBSD.  Instead, NetBSD allows paxctl to add an elf note
    indicating that RWX is needed, and it "just works" (by default).
    d3a1c675