-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/sys/unix: OpenBSD mmap syscall number (unix.SYS_MMAP) obsolete #59661
Comments
CC @golang/openbsd |
Fwiw, influxdb 1.8.10 on openbsd 7.3 had this issue (crashing with SIGSYS at startup, with a goroutine trace pointing at so maybe it's already fixed 'somewhere' in the go ecosystem and projects need to update their dependencies ? |
There are two related problems. One is that older versions of x/sys use syscall() itself, this has been replaced with calls to libc wrappers. The other is that the syscall tables are many (openbsd) releases out of date and in particular the old ones with "pad" arguments have recently been retired - golang/sys@3086868 synced some tables but not syscalls. Fixing that will partly involve syncing the table but will also involve fixing the call parameters. There is an additional twist in that openbsd is considering blocking syscall() completely. It has not yet been done though the linker now prints a warning when it's used. If that's done then syscall access will become impossible except through libc. |
FWIW, just calling |
As a side effect bootstrapping go by building Go 1.4 from source is no longer possible on OpenBSD 7.3. During the build of cmd/go go_bootstrap is crashing with SIGSYS, due to a mmap call. |
The minimum bootstrap for Go 1.20 is Go 1.17.3: https://go.dev/doc/go1.20#bootstrap As such, there is no effort being made to keep Go 1.4 working on OpenBSD. |
The short version is - I do not believe there is any way to fix this safely. It is not just the syscall number that changed, but also the arguments that are being passed to the syscall. This means that updating https://github.com/golang/sys/blob/master/unix/zsysnum_openbsd_386.go#L9 Any code that wants to make system calls on OpenBSD should use the libc stubs directly, which the likes of One issue worth noting is that If this is needed then calling |
It would indeed be better for downstream packages to just call |
On 2021-12-23, a new syscall for
mmap
was introduced:At the same time, the existing
mmap
syscall was renamed fromsys_mmap
tosys_pad_mmap
(since it contains a now-obsolete argument for padding).See
sys/kern/syscalls.master
:openbsd/src@1d60349#diff-e8c6a075c6e1240e27216779540b66f3db43b14a3b3615c2ecb7a111faa54504
On 2023-02-11, the original
mmap
syscall was retired entirely:openbsd/src@8c7f5cc
With the release of OpenBSD 7.3 on 2023-04-10, any go program that uses
mmap
on OpenBSD will crash withSIGSYS
.For example, here's a snippet from
kdump
of a failing run ofgotosocial
:This is a bug both in this project and in
modernc.org/libc
. Here, the constantunix.SYS_MMAP
needs to be changed from197
to49
. I'll also file a bug in that project for them to switch both the number and how they're invokingsyscall
.The text was updated successfully, but these errors were encountered: