Bug 258241 - lang/go produces binaries with an RWX stack
Summary: lang/go produces binaries with an RWX 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: Dmitri Goutnik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-03 08:07 UTC by Mina Galić
Modified: 2021-11-09 02:09 UTC (History)
2 users (show)

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


Attachments
patch to the go linker to add an ELF header to the binaries it produces to mark them as non-exutable (769 bytes, application/mbox)
2021-09-03 08:07 UTC, Mina Galić
no flags Details
patch to ports system that imports upstream patch (1.31 KB, patch)
2021-09-03 08:13 UTC, Mina Galić
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mina Galić freebsd_triage 2021-09-03 08:07:56 UTC
Created attachment 227636 [details]
patch to the go linker to add an ELF header to the binaries it produces to mark them as non-exutable

these binaries fail to run on systems that have W^X enabled.
A patch upstream has already been merged, but won't be released until 1.18

patch upstream: https://go-review.googlesource.com/c/go/+/346872/
discussion upstream: https://github.com/golang/go/issues/48112
Comment 1 Mina Galić freebsd_triage 2021-09-03 08:13:49 UTC
Created attachment 227637 [details]
patch to ports system that imports upstream patch
Comment 2 Mina Galić freebsd_triage 2021-09-03 08:14:43 UTC
do we need to carry the same patch for go/lang-devel, or does that somehow work automatically?
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-09-03 13:25:41 UTC
A commit in branch main references this bug:

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

commit 4e2f244da530f5d8e50b727e2ad433330a57b072
Author:     Mina Galić <me@igalic.co>
AuthorDate: 2021-09-03 13:20:14 +0000
Commit:     Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2021-09-03 13:25:08 +0000

    lang/go: mark stacks as non-executable on freebsd (CL346872 backport)

    PR:             258241

 lang/go/Makefile | 6 +++++-
 lang/go/distinfo | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-09-03 13:25:42 UTC
A commit in branch main references this bug:

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

commit 04e401ec556d61dbad61bd63b6f530b550c787a0
Author:     Mina Galić <me@igalic.co>
AuthorDate: 2021-09-03 13:23:43 +0000
Commit:     Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2021-09-03 13:25:09 +0000

    lang/go-devel: mark stacks as non-executable on freebsd

    PR:             258241

 lang/go-devel/Makefile | 9 ++++++---
 lang/go-devel/distinfo | 8 +++++---
 2 files changed, 11 insertions(+), 6 deletions(-)
Comment 5 Dmitri Goutnik freebsd_committer freebsd_triage 2021-09-03 13:26:18 UTC
Committed, thanks!