Skip to content

Commit f4de14a

Browse files
bradfitzJorropo
andcommitted
runtime: use uname version check for 64-bit time on 32-bit arch codepaths
The previous fallback-on-ENOSYS logic causes issues on forks of Linux. Android: golang#77621 (CL 750040 added a workaround with a TODO, this fixes that TODO) Causes the OS to terminate the program when running on Android versions <=10 since the seccomp jail does not know about the 64-bit time syscall and is configured to terminate the program on any unknown syscall. Synology's Linux: golang#77930 On old versions of Synology's Linux they added custom vendor syscalls without adding a gap in the syscall numbers, that means when we call the newer Linux syscall which was added later, Synology's Linux interprets it as a completely different vendor syscall. Originally by Jorropo in CL 751340. Fixes golang#77930 Updates #162 Originally https://go-review.googlesource.com/c/go/+/758902/2 Co-authored-by: Jorropo <jorropo.pgm@gmail.com> Change-Id: I90e15495d9249fd7f6e112f9e3ae8ad1322f56e0
1 parent 2445237 commit f4de14a

14 files changed

Lines changed: 97 additions & 19 deletions

src/internal/runtime/syscall/linux/defs_linux_386.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
SYS_OPENAT = 295
1818
SYS_PREAD64 = 180
1919
SYS_READ = 3
20+
SYS_UNAME = 122
2021

2122
EFD_NONBLOCK = 0x800
2223

src/internal/runtime/syscall/linux/defs_linux_amd64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
SYS_OPENAT = 257
1818
SYS_PREAD64 = 17
1919
SYS_READ = 0
20+
SYS_UNAME = 63
2021

2122
EFD_NONBLOCK = 0x800
2223

src/internal/runtime/syscall/linux/defs_linux_arm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
SYS_OPENAT = 322
1818
SYS_PREAD64 = 180
1919
SYS_READ = 3
20+
SYS_UNAME = 122
2021

2122
EFD_NONBLOCK = 0x800
2223

src/internal/runtime/syscall/linux/defs_linux_arm64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
SYS_OPENAT = 56
1818
SYS_PREAD64 = 67
1919
SYS_READ = 63
20+
SYS_UNAME = 160
2021

2122
EFD_NONBLOCK = 0x800
2223

src/internal/runtime/syscall/linux/defs_linux_loong64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
SYS_OPENAT = 56
1818
SYS_PREAD64 = 67
1919
SYS_READ = 63
20+
SYS_UNAME = 160
2021

2122
EFD_NONBLOCK = 0x800
2223

src/internal/runtime/syscall/linux/defs_linux_mips64x.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
SYS_OPENAT = 5247
2020
SYS_PREAD64 = 5016
2121
SYS_READ = 5000
22+
SYS_UNAME = 5061
2223

2324
EFD_NONBLOCK = 0x80
2425

src/internal/runtime/syscall/linux/defs_linux_mipsx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
SYS_OPENAT = 4288
2020
SYS_PREAD64 = 4200
2121
SYS_READ = 4003
22+
SYS_UNAME = 4122
2223

2324
EFD_NONBLOCK = 0x80
2425

src/internal/runtime/syscall/linux/defs_linux_ppc64x.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
SYS_OPENAT = 286
2020
SYS_PREAD64 = 179
2121
SYS_READ = 3
22+
SYS_UNAME = 122
2223

2324
EFD_NONBLOCK = 0x800
2425

src/internal/runtime/syscall/linux/defs_linux_riscv64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
SYS_OPENAT = 56
1818
SYS_PREAD64 = 67
1919
SYS_READ = 63
20+
SYS_UNAME = 160
2021

2122
EFD_NONBLOCK = 0x800
2223

src/internal/runtime/syscall/linux/defs_linux_s390x.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
SYS_OPENAT = 288
1818
SYS_PREAD64 = 180
1919
SYS_READ = 3
20+
SYS_UNAME = 122
2021

2122
EFD_NONBLOCK = 0x800
2223

0 commit comments

Comments
 (0)