pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/59620: lang/go14 fails to build on FreeBSD with ASLR
>Number: 59620
>Category: pkg
>Synopsis: lang/go14 fails to build on FreeBSD with ASLR
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Aug 31 07:25:00 +0000 2025
>Originator: Sean Hickey
>Release: pkgsrc-2025Q2 2025-08-30
>Organization:
>Environment:
FreeBSD xxx 14.3-RELEASE FreeBSD 14.3-RELEASE-p2 GENERIC amd64
>Description:
The package lang/go14 used for bootstrapping Go fails to build on FreeBSD with ASLR enabled. I've been successfully using a patch for this that I found on the FreeBSD bugzilla, so it would be nice to include this fix in pkgsrc too.
Here is a link to the buzilla comment with the patch:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235735#c11
For reference, the actual error it throws is the following:
runtime: address space conflict: map(0xc208000000) = 0xc208102000
fatal error: runtime: address space conflict
runtime stack:
runtime.throw(0x7e5006)
pkg/go14/src/runtime/panic.go:491 +0xad fp=0x820e51a18 sp=0x820e519e8
runtime.SysMap(0xc208000000, 0x100000, 0x0, 0x802818)
pkg/go14/src/runtime/mem_freebsd.c:90 +0xd3 fp=0x820e51a50 sp=0x820e51a18
>How-To-Repeat:
Install FreeBSD with ASLR enabled (one of the additional security options in the installer). Then bootstrap pkgsrc and attempt to build lang/go14 from pkgsrc.
>Fix:
Add a new patch file for lang/go14 to fix src/runtime/mem_freebsd.c.
I'll include the full patch file I've been using below:
patch-src_runtime_mem__freebsd.c
$NetBSD$
Fix FreeBSD address space conflict when ASLR is enabled.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235735
--- src/runtime/mem_freebsd.c.orig 2015-09-23 04:37:37.000000000 +0000
+++ src/runtime/mem_freebsd.c
@@ -73,6 +73,11 @@ runtime·SysReserve(void *v, uintptr n,
return p;
}
+enum
+{
+ MAP_EXCL = 0x4000
+};
+
void
runtime·SysMap(void *v, uintptr n, bool reserved, uint64 *stat)
{
@@ -82,7 +87,7 @@ runtime·SysMap(void *v, uintptr n, bool
// On 64-bit, we don't actually have v reserved, so tread carefully.
if(!reserved) {
- p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
+ p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_FIXED|MAP_EXCL|MAP_PRIVATE, -1, 0);
if(p == (void*)ENOMEM)
runtime·throw("runtime: out of memory");
if(p != v) {
Home |
Main Index |
Thread Index |
Old Index