Download raw body.
lang/polyml: fix (stupid because needless) W^X violation
On Wed, 16 Jul 2025 11:44:59 +0200,
Stuart Henderson <stu@spacehopper.org> wrote:
>
> On 2025/07/15 22:35, Daniel Dickman wrote:
> >
> >
> > On Wed, 16 Jul 2025, Stuart Henderson wrote:
> >
> > > fwiw, we '#if 0'-out the similar test in libffi. Maybe others too.
> >
> > Then this would be my proposed diff.
> >
> > Now actually tested and seemed to work here.
>
> I think that makes it more clear what's going on.
>
Shall it be sent to upstream?
>
> >
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/lang/polyml/Makefile,v
> > diff -u -p -u -r1.1.1.1 Makefile
> > --- Makefile 12 Jun 2025 11:09:28 -0000 1.1.1.1
> > +++ Makefile 16 Jul 2025 02:32:37 -0000
> > @@ -6,6 +6,7 @@ COMMENT = Poly/ML implementation of stan
> > GH_ACCOUNT = polyml
> > GH_PROJECT = polyml
> > GH_TAGNAME = v5.9.1
> > +REVISION = 0
> >
> > USE_NOEXECONLY = Yes
> > USE_NOBTCFI = Yes
> > Index: patches/patch-libpolyml_osmemunix_cpp
> > ===================================================================
> > RCS file: patches/patch-libpolyml_osmemunix_cpp
> > diff -N patches/patch-libpolyml_osmemunix_cpp
> > --- /dev/null 1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-libpolyml_osmemunix_cpp 16 Jul 2025 02:32:37 -0000
> > @@ -0,0 +1,33 @@
> > +Hard code the W^X code path on OpenBSD since actually
> > +selecting this at run-time isn't so straightforward.
> > +
> > +Index: libpolyml/osmemunix.cpp
> > +--- libpolyml/osmemunix.cpp.orig
> > ++++ libpolyml/osmemunix.cpp
> > +@@ -159,6 +159,9 @@ bool OSMem::Initialise(enum _MemUsage usage)
> > + {
> > + memUsage = usage;
> > + pageSize = getpagesize();
> > ++#ifdef __OpenBSD__
> > ++ wxFix = WXFixDualArea;
> > ++#else
> > + if (usage != UsageExecutableCode)
> > + wxFix = WXFixNone;
> > + else
> > +@@ -177,7 +180,7 @@ bool OSMem::Initialise(enum _MemUsage usage)
> > + #endif
> > + if (test == MAP_FAILED)
> > + {
> > +- if (errno != ENOTSUP && errno != EACCES) // Fails with ENOTSUPP on OpenBSD and EACCES in SELinux.
> > ++ if (errno != ENOTSUP && errno != EACCES) // Fails with ENOTSUP on OpenBSD and EACCES in SELinux.
> > + return false;
> > + // Check that read-write works.
> > + test = mmap(0, pageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
> > +@@ -188,6 +191,7 @@ bool OSMem::Initialise(enum _MemUsage usage)
> > + if (test != MAP_FAILED)
> > + munmap(FIXTYPE test, pageSize);
> > + }
> > ++#endif
> > +
> > + if (wxFix == WXFixDualArea)
> > + {
> >
>
--
wbr, Kirill
lang/polyml: fix (stupid because needless) W^X violation