Bug 269070

Summary: lang/go119 may use the wrong timer on arm64
Product: Ports & Packages Reporter: Andrew Turner <Andrew>
Component: Individual Port(s)Assignee: Golang Team (Nobody) <go>
Status: Closed FIXED    
Severity: Affects Some People CC: dan.kotowski, dmgk
Priority: --- Flags: bugzilla: maintainer-feedback? (go)
Version: Latest   
Hardware: arm64   
OS: Any   

Description Andrew Turner freebsd_committer freebsd_triage 2023-01-20 13:27:08 UTC
I found go 1.19 will crash with SIGILL when using the physical timer on arm64. This is because we only enable either the physical or virtual timers. This has been fixed upstream in [1].

It looks like it is needed for 1.18 and 1.19, but will be fixed in 1.20.

[1] https://github.com/golang/go/commit/535fe2b226096a3547321a51b36f464ab443b5cb
Comment 1 Dmitri Goutnik freebsd_committer freebsd_triage 2023-01-20 14:05:26 UTC
go1.20 is expected to be released in about 2 weeks and we'll switch the default Go version shortly after that.

https://go-review.googlesource.com/c/go/+/422977 probably could be backported to go1.19 too, although I don't know if that's really needed given that go1.20 has this fixed.
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-03-14 11:10:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=93d574ea957decec1c95dea9bfa8bc72457cc60d

commit 93d574ea957decec1c95dea9bfa8bc72457cc60d
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-03-10 12:43:59 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-03-14 10:37:36 +0000

    Always enable the virtual timer for userspace

    We always have it, some languages assume it's present, e.g. go
    before 1.20. Enable it by default on arm and arm64.

    PR:             269070
    Reviewed by:    kevans
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D39059

 sys/arm/arm/generic_timer.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-05-15 15:46:45 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=21ef40aea1d312910163a25a890c679814936c11

commit 21ef40aea1d312910163a25a890c679814936c11
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-03-10 12:43:59 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-05-15 07:59:43 +0000

    Always enable the virtual timer for userspace

    We always have it, some languages assume it's present, e.g. go
    before 1.20. Enable it by default on arm and arm64.

    PR:             269070
    Reviewed by:    kevans
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D39059

    (cherry picked from commit 93d574ea957decec1c95dea9bfa8bc72457cc60d)

 sys/arm/arm/generic_timer.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2023-12-25 23:55:36 UTC
^Triage: close as committed to 14 and MFCed to 13.