snapshot: sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1

Содержимое пина, зафиксированного в go.mod sing-box-lx, одним коммитом
без истории. Полная история SagerNet/gvisor — 1.45 ГБ и клонируется в
каждой CI-джобе; наша дельта — одна вставка в одну функцию, история для
неё не нужна.

Module path github.com/sagernet/gvisor сохранён намеренно: на него
опирается replace-директива суперпроекта.

Патч поверх — отдельным коммитом, чтобы дельта читалась одним git show
и переносилась на новый пин копированием.

SPECS/TASKS/048-GVISOR_HANDSHAKE_NIL_CRASH
This commit is contained in:
Leadaxe 2026-08-04 15:50:08 +03:00
commit 2c4ae3b0a4
712 changed files with 185689 additions and 0 deletions

View file

@ -0,0 +1,45 @@
// Copyright 2024 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build linux
// +build linux
// Package hostsyscall provides functions like unix.RawSyscall, but without the
// overhead of multiple stack frame allocations.
//
// This is mostly relevant for platform/kvm which needs to execute some function
// call chains in a go:nosplit environment. Debug builds specifically make using
// unix.RawSyscall variants infeasible.
package hostsyscall
import (
"golang.org/x/sys/unix"
)
// RawSyscall6 is a copy of runtime.Syscall6.
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1 uintptr, errno unix.Errno)
// RawSyscall is a copy of runtime.Syscall6, but only uses the first three arguments.
func RawSyscall(trap, a1, a2, a3 uintptr) (r1 uintptr, errno unix.Errno)
// Variants of runtime.Syscall6 that use slightly less stack space by only
// returning errno.
// RawSyscallErrno6 is like RawSyscall6, but only returns errno,
// and 0 if successful.
func RawSyscallErrno6(trap, a1, a2, a3, a4, a5, a6 uintptr) unix.Errno
// RawSyscallErrno is like RawSyscall, but only returns errno,
// and 0 if successful.
func RawSyscallErrno(trap, a1, a2, a3 uintptr) unix.Errno

View file

@ -0,0 +1,96 @@
// Copyright 2024 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "textflag.h"
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, errno)
TEXT ·RawSyscall6(SB),NOSPLIT,$0-72
MOVQ a1+8(FP), DI
MOVQ a2+16(FP), SI
MOVQ a3+24(FP), DX
MOVQ a4+32(FP), R10
MOVQ a5+40(FP), R8
MOVQ a6+48(FP), R9
MOVQ trap+0(FP), AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
JLS ok
MOVQ $-1, r1+56(FP)
NEGQ AX
MOVQ AX, errno+64(FP)
RET
ok:
MOVQ AX, r1+56(FP)
MOVQ $0, errno+64(FP)
RET
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, errno)
TEXT ·RawSyscall(SB),NOSPLIT,$0-48
MOVQ a1+8(FP), DI
MOVQ a2+16(FP), SI
MOVQ a3+24(FP), DX
MOVQ $0, R10
MOVQ $0, R8
MOVQ $0, R9
MOVQ trap+0(FP), AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
JLS ok
MOVQ $-1, r1+32(FP)
NEGQ AX
MOVQ AX, errno+40(FP)
RET
ok:
MOVQ AX, r1+32(FP)
MOVQ $0, errno+40(FP)
RET
// func RawSyscallErrno6(trap, a1, a2, a3, a4, a5, a6 uintptr) (ret unix.Errno)
TEXT ·RawSyscallErrno6(SB),NOSPLIT,$0-64
MOVQ a1+8(FP), DI
MOVQ a2+16(FP), SI
MOVQ a3+24(FP), DX
MOVQ a4+32(FP), R10
MOVQ a5+40(FP), R8
MOVQ a6+48(FP), R9
MOVQ trap+0(FP), AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
JLS ok
NEGQ AX
MOVQ AX, ret+56(FP)
RET
ok:
MOVQ $0, ret+56(FP)
RET
// func RawSyscallErrno(trap, a1, a2, a3 uintptr) (ret unix.Errno)
TEXT ·RawSyscallErrno(SB),NOSPLIT,$0-40
MOVQ a1+8(FP), DI
MOVQ a2+16(FP), SI
MOVQ a3+24(FP), DX
MOVQ $0, R10
MOVQ $0, R8
MOVQ $0, R9
MOVQ trap+0(FP), AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
JLS ok
NEGQ AX
MOVQ AX, ret+32(FP)
RET
ok:
MOVQ $0, ret+32(FP)
RET

View file

@ -0,0 +1,97 @@
// Copyright 2024 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "textflag.h"
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, errno)
TEXT ·RawSyscall6(SB),NOSPLIT,$0-72
MOVD trap+0(FP), R8 // syscall entry
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
MOVD a4+32(FP), R3
MOVD a5+40(FP), R4
MOVD a6+48(FP), R5
SVC
CMN $4095, R0
BCC ok
MOVD $-1, R4
MOVD R4, r1+56(FP)
NEG R0, R0
MOVD R0, errno+64(FP)
RET
ok:
MOVD R0, r1+56(FP)
MOVD ZR, errno+64(FP)
RET
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, errno)
TEXT ·RawSyscall(SB),NOSPLIT,$0-48
MOVD trap+0(FP), R8 // syscall entry
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
MOVD ZR, R3
MOVD ZR, R4
MOVD ZR, R5
SVC
CMN $4095, R0
BCC ok
MOVD $-1, R4
MOVD R4, r1+32(FP)
NEG R0, R0
MOVD R0, errno+40(FP)
RET
ok:
MOVD R0, r1+32(FP)
MOVD ZR, errno+40(FP)
RET
// func RawSyscallErrno6(trap, a1, a2, a3, a4, a5, a6 uintptr) (errno unix.Errno)
TEXT ·RawSyscallErrno6(SB),NOSPLIT,$0-64
MOVD trap+0(FP), R8 // syscall entry
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
MOVD a4+32(FP), R3
MOVD a5+40(FP), R4
MOVD a6+48(FP), R5
SVC
CMN $4095, R0
BCC ok
NEG R0, R0
MOVD R0, ret+56(FP) // errno
RET
ok:
MOVD ZR, ret+56(FP) // errno
RET
// func RawSyscallErrno(trap, a1, a2, a3 uintptr) (errno unix.Errno)
TEXT ·RawSyscallErrno(SB),NOSPLIT,$0-40
MOVD trap+0(FP), R8 // syscall entry
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
MOVD ZR, R3
MOVD ZR, R4
MOVD ZR, R5
SVC
CMN $4095, R0
BCC ok
NEG R0, R0
MOVD R0, ret+32(FP) // errno
RET
ok:
MOVD ZR, ret+32(FP) // errno
RET

View file

@ -0,0 +1,6 @@
// automatically generated by stateify.
//go:build linux
// +build linux
package hostsyscall