Bug 283670

Summary: comms/wsjtz: Fix jt9 crash due to non-executable stack
Product: Ports & Packages Reporter: Stephen Hurd <shurd>
Component: Individual Port(s)Assignee: hamradio (Nobody) <hamradio>
Status: Closed FIXED    
Severity: Affects Only Me CC: emaste
Priority: --- Flags: bugzilla: maintainer-feedback? (hamradio)
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278939
Attachments:
Description Flags
Simple patch to give bin/jt9 an executable stack
none
Complex patch to not need executable stack none

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(-)