Bug 283670 - comms/wsjtz: Fix jt9 crash due to non-executable stack
Summary: comms/wsjtz: Fix jt9 crash due to non-executable stack
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: hamradio (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-27 22:41 UTC by Stephen Hurd
Modified: 2025-02-09 03:49 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (hamradio)


Attachments
Simple patch to give bin/jt9 an executable stack (2.03 KB, patch)
2024-12-27 22:41 UTC, Stephen Hurd
no flags Details | Diff
Complex patch to not need executable stack (23.66 KB, patch)
2024-12-27 22:41 UTC, Stephen Hurd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Hurd freebsd_committer freebsd_triage 2024-12-27 22:41:18 UTC
Created attachment 256212 [details]
Simple patch to give bin/jt9 an executable stack

gfortran puts trampolines on the stack and marks decoder.f90.o as needing an executable stack, but the linker on FreeBSD ignores this and make the stack NX.

I've done two different patches depending on the maintainers appetite for maintaining them.  The first simply marks jt9 as needing an executable stack, and the second uses mprotect() to dynamically mark the trampolines RX then set back to RW after the call.

Reference: https://github.com/llvm/llvm-project/issues/121234
Comment 1 Stephen Hurd freebsd_committer freebsd_triage 2024-12-27 22:41:50 UTC
Created attachment 256213 [details]
Complex patch to not need executable stack
Comment 2 commit-hook freebsd_committer freebsd_triage 2025-02-09 03:48:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cbc58c695e8029da1779cb4bc05c70986af1c22d

commit cbc58c695e8029da1779cb4bc05c70986af1c22d
Author:     Stephen Hurd <shurd@FreeBSD.org>
AuthorDate: 2024-12-27 22:31:50 +0000
Commit:     Stephen Hurd <shurd@FreeBSD.org>
CommitDate: 2025-02-09 03:47:37 +0000

    comms/wsjtz: Give bin/jt9 an executable stack

    jt9 is supposed to have an executable stack, but a bug in lld (now
    fixed upstream) prevents that.

    This change explicitly sets the required exectuable stack for jt9.
    Much simpler than using mprotect et. al.

    PR:             283670
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D48573

 comms/wsjtz/files/patch-CMakeLists.txt | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)