mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Cleanup straggling syscall dependencies.
PiperOrigin-RevId: 257293198
This commit is contained in:
committed by
gVisor bot
parent
6db3f8d54c
commit
cceef9d2cf
@@ -13,8 +13,10 @@ go_library(
|
||||
"audit.go",
|
||||
"bpf.go",
|
||||
"capability.go",
|
||||
"clone.go",
|
||||
"dev.go",
|
||||
"elf.go",
|
||||
"epoll.go",
|
||||
"errors.go",
|
||||
"eventfd.go",
|
||||
"exec.go",
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
package linux
|
||||
|
||||
// Clone constants per clone(2).
|
||||
const (
|
||||
CLONE_VM = 0x100
|
||||
CLONE_FS = 0x200
|
||||
CLONE_FILES = 0x400
|
||||
CLONE_SIGHAND = 0x800
|
||||
CLONE_PARENT = 0x8000
|
||||
CLONE_PTRACE = 0x2000
|
||||
CLONE_VFORK = 0x4000
|
||||
CLONE_THREAD = 0x10000
|
||||
CLONE_NEWNS = 0x20000
|
||||
CLONE_SYSVSEM = 0x40000
|
||||
CLONE_SETTLS = 0x80000
|
||||
CLONE_PARENT_SETTID = 0x100000
|
||||
CLONE_CHILD_CLEARTID = 0x200000
|
||||
CLONE_DETACHED = 0x400000
|
||||
CLONE_UNTRACED = 0x800000
|
||||
CLONE_CHILD_SETTID = 0x1000000
|
||||
CLONE_NEWUTS = 0x4000000
|
||||
CLONE_NEWIPC = 0x8000000
|
||||
CLONE_NEWUSER = 0x10000000
|
||||
CLONE_NEWPID = 0x20000000
|
||||
CLONE_NEWNET = 0x40000000
|
||||
CLONE_IO = 0x80000000
|
||||
)
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright 2019 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.
|
||||
|
||||
package linux
|
||||
|
||||
// EpollEvent is equivalent to struct epoll_event from epoll(2).
|
||||
type EpollEvent struct {
|
||||
Events uint32
|
||||
Fd int32
|
||||
Data int32
|
||||
}
|
||||
|
||||
// Event masks.
|
||||
const (
|
||||
EPOLLIN = 0x1
|
||||
EPOLLPRI = 0x2
|
||||
EPOLLOUT = 0x4
|
||||
EPOLLERR = 0x8
|
||||
EPOLLHUP = 0x10
|
||||
EPOLLRDNORM = 0x40
|
||||
EPOLLRDBAND = 0x80
|
||||
EPOLLWRNORM = 0x100
|
||||
EPOLLWRBAND = 0x200
|
||||
EPOLLMSG = 0x400
|
||||
EPOLLRDHUP = 0x2000
|
||||
)
|
||||
|
||||
// Per-file descriptor flags.
|
||||
const (
|
||||
EPOLLET = 0x80000000
|
||||
EPOLLONESHOT = 0x40000000
|
||||
)
|
||||
|
||||
// Operation flags.
|
||||
const (
|
||||
EPOLL_CLOEXEC = 0x80000
|
||||
EPOLL_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
// Control operations.
|
||||
const (
|
||||
EPOLL_CTL_ADD = 0x1
|
||||
EPOLL_CTL_DEL = 0x2
|
||||
EPOLL_CTL_MOD = 0x3
|
||||
)
|
||||
+27
-9
@@ -16,21 +16,39 @@ package linux
|
||||
|
||||
// Commands from linux/fcntl.h.
|
||||
const (
|
||||
F_DUPFD = 0
|
||||
F_GETFD = 1
|
||||
F_GETFL = 3
|
||||
F_GETOWN = 9
|
||||
F_SETFD = 2
|
||||
F_SETFL = 4
|
||||
F_SETLK = 6
|
||||
F_SETLKW = 7
|
||||
F_SETOWN = 8
|
||||
F_DUPFD = 0x0
|
||||
F_GETFD = 0x1
|
||||
F_SETFD = 0x2
|
||||
F_GETFL = 0x3
|
||||
F_SETFL = 0x4
|
||||
F_SETLK = 0x6
|
||||
F_SETLKW = 0x7
|
||||
F_SETOWN = 0x8
|
||||
F_GETOWN = 0x9
|
||||
F_DUPFD_CLOEXEC = 1024 + 6
|
||||
F_SETPIPE_SZ = 1024 + 7
|
||||
F_GETPIPE_SZ = 1024 + 8
|
||||
)
|
||||
|
||||
// Commands for F_SETLK.
|
||||
const (
|
||||
F_RDLCK = 0x0
|
||||
F_WRLCK = 0x1
|
||||
F_UNLCK = 0x2
|
||||
)
|
||||
|
||||
// Flags for fcntl.
|
||||
const (
|
||||
FD_CLOEXEC = 00000001
|
||||
)
|
||||
|
||||
// Lock structure for F_SETLK.
|
||||
type Flock struct {
|
||||
Type int16
|
||||
Whence int16
|
||||
_ [4]byte
|
||||
Start int64
|
||||
Len int64
|
||||
Pid int32
|
||||
_ [4]byte
|
||||
}
|
||||
|
||||
+28
-15
@@ -161,23 +161,36 @@ const (
|
||||
|
||||
// Stat represents struct stat.
|
||||
type Stat struct {
|
||||
Dev uint64
|
||||
Ino uint64
|
||||
Nlink uint64
|
||||
Mode uint32
|
||||
UID uint32
|
||||
GID uint32
|
||||
X_pad0 int32
|
||||
Rdev uint64
|
||||
Size int64
|
||||
Blksize int64
|
||||
Blocks int64
|
||||
ATime Timespec
|
||||
MTime Timespec
|
||||
CTime Timespec
|
||||
X_unused [3]int64
|
||||
Dev uint64
|
||||
Ino uint64
|
||||
Nlink uint64
|
||||
Mode uint32
|
||||
UID uint32
|
||||
GID uint32
|
||||
_ int32
|
||||
Rdev uint64
|
||||
Size int64
|
||||
Blksize int64
|
||||
Blocks int64
|
||||
ATime Timespec
|
||||
MTime Timespec
|
||||
CTime Timespec
|
||||
_ [3]int64
|
||||
}
|
||||
|
||||
// File types.
|
||||
const (
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
DT_FIFO = 0x1
|
||||
DT_LNK = 0xa
|
||||
DT_REG = 0x8
|
||||
DT_SOCK = 0xc
|
||||
DT_UNKNOWN = 0x0
|
||||
DT_WHT = 0xe
|
||||
)
|
||||
|
||||
// SizeOfStat is the size of a Stat struct.
|
||||
var SizeOfStat = binary.Size(Stat{})
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ type IPCPerm struct {
|
||||
CUID uint32
|
||||
CGID uint32
|
||||
Mode uint16
|
||||
pad1 uint16
|
||||
_ uint16
|
||||
Seq uint16
|
||||
pad2 uint16
|
||||
pad3 uint32
|
||||
_ uint16
|
||||
_ uint32
|
||||
unused1 uint64
|
||||
unused2 uint64
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ const (
|
||||
|
||||
// SockAddrNetlink is struct sockaddr_nl, from uapi/linux/netlink.h.
|
||||
type SockAddrNetlink struct {
|
||||
Family uint16
|
||||
Padding uint16
|
||||
PortID uint32
|
||||
Groups uint32
|
||||
Family uint16
|
||||
_ uint16
|
||||
PortID uint32
|
||||
Groups uint32
|
||||
}
|
||||
|
||||
// SockAddrNetlinkSize is the size of SockAddrNetlink.
|
||||
|
||||
@@ -86,12 +86,12 @@ const (
|
||||
|
||||
// InterfaceInfoMessage is struct ifinfomsg, from uapi/linux/rtnetlink.h.
|
||||
type InterfaceInfoMessage struct {
|
||||
Family uint8
|
||||
Padding uint8
|
||||
Type uint16
|
||||
Index int32
|
||||
Flags uint32
|
||||
Change uint32
|
||||
Family uint8
|
||||
_ uint8
|
||||
Type uint16
|
||||
Index int32
|
||||
Flags uint32
|
||||
Change uint32
|
||||
}
|
||||
|
||||
// Interface flags, from uapi/linux/if.h.
|
||||
|
||||
@@ -28,3 +28,9 @@ const (
|
||||
// reverted back to SCHED_NORMAL on fork.
|
||||
SCHED_RESET_ON_FORK = 0x40000000
|
||||
)
|
||||
|
||||
const (
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
)
|
||||
|
||||
@@ -241,3 +241,9 @@ func NsecToStatxTimestamp(nsec int64) (ts StatxTimestamp) {
|
||||
Nsec: uint32(nsec % 1e9),
|
||||
}
|
||||
}
|
||||
|
||||
// Utime represents struct utimbuf used by utimes(2).
|
||||
type Utime struct {
|
||||
Actime int64
|
||||
Modtime int64
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
package syscalls
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel/epoll"
|
||||
ktime "gvisor.dev/gvisor/pkg/sentry/kernel/time"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
||||
@@ -44,21 +44,21 @@ func AddEpoll(t *kernel.Task, epfd int32, fd int32, flags epoll.EntryFlags, mask
|
||||
// Get epoll from the file descriptor.
|
||||
epollfile := t.GetFile(epfd)
|
||||
if epollfile == nil {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
defer epollfile.DecRef()
|
||||
|
||||
// Get the target file id.
|
||||
file := t.GetFile(fd)
|
||||
if file == nil {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
defer file.DecRef()
|
||||
|
||||
// Extract the epollPoll operations.
|
||||
e, ok := epollfile.FileOperations.(*epoll.EventPoll)
|
||||
if !ok {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
|
||||
// Try to add the entry.
|
||||
@@ -70,21 +70,21 @@ func UpdateEpoll(t *kernel.Task, epfd int32, fd int32, flags epoll.EntryFlags, m
|
||||
// Get epoll from the file descriptor.
|
||||
epollfile := t.GetFile(epfd)
|
||||
if epollfile == nil {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
defer epollfile.DecRef()
|
||||
|
||||
// Get the target file id.
|
||||
file := t.GetFile(fd)
|
||||
if file == nil {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
defer file.DecRef()
|
||||
|
||||
// Extract the epollPoll operations.
|
||||
e, ok := epollfile.FileOperations.(*epoll.EventPoll)
|
||||
if !ok {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
|
||||
// Try to update the entry.
|
||||
@@ -96,21 +96,21 @@ func RemoveEpoll(t *kernel.Task, epfd int32, fd int32) error {
|
||||
// Get epoll from the file descriptor.
|
||||
epollfile := t.GetFile(epfd)
|
||||
if epollfile == nil {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
defer epollfile.DecRef()
|
||||
|
||||
// Get the target file id.
|
||||
file := t.GetFile(fd)
|
||||
if file == nil {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
defer file.DecRef()
|
||||
|
||||
// Extract the epollPoll operations.
|
||||
e, ok := epollfile.FileOperations.(*epoll.EventPoll)
|
||||
if !ok {
|
||||
return syscall.EBADF
|
||||
return syserror.EBADF
|
||||
}
|
||||
|
||||
// Try to remove the entry.
|
||||
@@ -122,14 +122,14 @@ func WaitEpoll(t *kernel.Task, fd int32, max int, timeout int) ([]epoll.Event, e
|
||||
// Get epoll from the file descriptor.
|
||||
epollfile := t.GetFile(fd)
|
||||
if epollfile == nil {
|
||||
return nil, syscall.EBADF
|
||||
return nil, syserror.EBADF
|
||||
}
|
||||
defer epollfile.DecRef()
|
||||
|
||||
// Extract the epollPoll operations.
|
||||
e, ok := epollfile.FileOperations.(*epoll.EventPoll)
|
||||
if !ok {
|
||||
return nil, syscall.EBADF
|
||||
return nil, syserror.EBADF
|
||||
}
|
||||
|
||||
// Try to read events and return right away if we got them or if the
|
||||
@@ -162,7 +162,7 @@ func WaitEpoll(t *kernel.Task, fd int32, max int, timeout int) ([]epoll.Event, e
|
||||
}
|
||||
|
||||
if err := t.BlockWithDeadline(ch, haveDeadline, deadline); err != nil {
|
||||
if err == syscall.ETIMEDOUT {
|
||||
if err == syserror.ETIMEDOUT {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ package linux
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
@@ -54,7 +53,7 @@ func handleIOError(t *kernel.Task, partialResult bool, err, intr error, op strin
|
||||
// Do not consume the error and return it as EFBIG.
|
||||
// Simultaneously send a SIGXFSZ per setrlimit(2).
|
||||
t.SendSignal(kernel.SignalInfoNoInfo(linux.SIGXFSZ, t, t))
|
||||
return syscall.EFBIG
|
||||
return syserror.EFBIG
|
||||
case syserror.ErrInterrupted:
|
||||
// The syscall was interrupted. Return nil if it completed
|
||||
// partially, otherwise return the error code that the syscall
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
package linux
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi"
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
@@ -116,10 +114,10 @@ var AMD64 = &kernel.SyscallTable{
|
||||
65: syscalls.PartiallySupported("semop", Semop, "Option SEM_UNDO not supported.", nil),
|
||||
66: syscalls.PartiallySupported("semctl", Semctl, "Options IPC_INFO, SEM_INFO, IPC_STAT, SEM_STAT, SEM_STAT_ANY, GETNCNT, GETZCNT not supported.", nil),
|
||||
67: syscalls.Supported("shmdt", Shmdt),
|
||||
68: syscalls.ErrorWithEvent("msgget", syscall.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
69: syscalls.ErrorWithEvent("msgsnd", syscall.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
70: syscalls.ErrorWithEvent("msgrcv", syscall.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
71: syscalls.ErrorWithEvent("msgctl", syscall.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
68: syscalls.ErrorWithEvent("msgget", syserror.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
69: syscalls.ErrorWithEvent("msgsnd", syserror.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
70: syscalls.ErrorWithEvent("msgrcv", syserror.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
71: syscalls.ErrorWithEvent("msgctl", syserror.ENOSYS, "", []string{"gvisor.dev/issue/135"}), // TODO(b/29354921)
|
||||
72: syscalls.PartiallySupported("fcntl", Fcntl, "Not all options are supported.", nil),
|
||||
73: syscalls.PartiallySupported("flock", Flock, "Locks are held within the sandbox only.", nil),
|
||||
74: syscalls.PartiallySupported("fsync", Fsync, "Full data flush is not guaranteed at this time.", nil),
|
||||
@@ -170,8 +168,8 @@ var AMD64 = &kernel.SyscallTable{
|
||||
119: syscalls.Supported("setresgid", Setresgid),
|
||||
120: syscalls.Supported("getresgid", Getresgid),
|
||||
121: syscalls.Supported("getpgid", Getpgid),
|
||||
122: syscalls.ErrorWithEvent("setfsuid", syscall.ENOSYS, "", []string{"gvisor.dev/issue/260"}), // TODO(b/112851702)
|
||||
123: syscalls.ErrorWithEvent("setfsgid", syscall.ENOSYS, "", []string{"gvisor.dev/issue/260"}), // TODO(b/112851702)
|
||||
122: syscalls.ErrorWithEvent("setfsuid", syserror.ENOSYS, "", []string{"gvisor.dev/issue/260"}), // TODO(b/112851702)
|
||||
123: syscalls.ErrorWithEvent("setfsgid", syserror.ENOSYS, "", []string{"gvisor.dev/issue/260"}), // TODO(b/112851702)
|
||||
124: syscalls.Supported("getsid", Getsid),
|
||||
125: syscalls.Supported("capget", Capget),
|
||||
126: syscalls.Supported("capset", Capset),
|
||||
@@ -182,12 +180,12 @@ var AMD64 = &kernel.SyscallTable{
|
||||
131: syscalls.Supported("sigaltstack", Sigaltstack),
|
||||
132: syscalls.Supported("utime", Utime),
|
||||
133: syscalls.PartiallySupported("mknod", Mknod, "Device creation is not generally supported. Only regular file and FIFO creation are supported.", nil),
|
||||
134: syscalls.Error("uselib", syscall.ENOSYS, "Obsolete", nil),
|
||||
135: syscalls.ErrorWithEvent("personality", syscall.EINVAL, "Unable to change personality.", nil),
|
||||
136: syscalls.ErrorWithEvent("ustat", syscall.ENOSYS, "Needs filesystem support.", nil),
|
||||
134: syscalls.Error("uselib", syserror.ENOSYS, "Obsolete", nil),
|
||||
135: syscalls.ErrorWithEvent("personality", syserror.EINVAL, "Unable to change personality.", nil),
|
||||
136: syscalls.ErrorWithEvent("ustat", syserror.ENOSYS, "Needs filesystem support.", nil),
|
||||
137: syscalls.PartiallySupported("statfs", Statfs, "Depends on the backing file system implementation.", nil),
|
||||
138: syscalls.PartiallySupported("fstatfs", Fstatfs, "Depends on the backing file system implementation.", nil),
|
||||
139: syscalls.ErrorWithEvent("sysfs", syscall.ENOSYS, "", []string{"gvisor.dev/issue/165"}),
|
||||
139: syscalls.ErrorWithEvent("sysfs", syserror.ENOSYS, "", []string{"gvisor.dev/issue/165"}),
|
||||
140: syscalls.PartiallySupported("getpriority", Getpriority, "Stub implementation.", nil),
|
||||
141: syscalls.PartiallySupported("setpriority", Setpriority, "Stub implementation.", nil),
|
||||
142: syscalls.CapError("sched_setparam", linux.CAP_SYS_NICE, "", nil),
|
||||
@@ -196,15 +194,15 @@ var AMD64 = &kernel.SyscallTable{
|
||||
145: syscalls.PartiallySupported("sched_getscheduler", SchedGetscheduler, "Stub implementation.", nil),
|
||||
146: syscalls.PartiallySupported("sched_get_priority_max", SchedGetPriorityMax, "Stub implementation.", nil),
|
||||
147: syscalls.PartiallySupported("sched_get_priority_min", SchedGetPriorityMin, "Stub implementation.", nil),
|
||||
148: syscalls.ErrorWithEvent("sched_rr_get_interval", syscall.EPERM, "", nil),
|
||||
148: syscalls.ErrorWithEvent("sched_rr_get_interval", syserror.EPERM, "", nil),
|
||||
149: syscalls.PartiallySupported("mlock", Mlock, "Stub implementation. The sandbox lacks appropriate permissions.", nil),
|
||||
150: syscalls.PartiallySupported("munlock", Munlock, "Stub implementation. The sandbox lacks appropriate permissions.", nil),
|
||||
151: syscalls.PartiallySupported("mlockall", Mlockall, "Stub implementation. The sandbox lacks appropriate permissions.", nil),
|
||||
152: syscalls.PartiallySupported("munlockall", Munlockall, "Stub implementation. The sandbox lacks appropriate permissions.", nil),
|
||||
153: syscalls.CapError("vhangup", linux.CAP_SYS_TTY_CONFIG, "", nil),
|
||||
154: syscalls.Error("modify_ldt", syscall.EPERM, "", nil),
|
||||
155: syscalls.Error("pivot_root", syscall.EPERM, "", nil),
|
||||
156: syscalls.Error("sysctl", syscall.EPERM, "Deprecated. Use /proc/sys instead.", nil),
|
||||
154: syscalls.Error("modify_ldt", syserror.EPERM, "", nil),
|
||||
155: syscalls.Error("pivot_root", syserror.EPERM, "", nil),
|
||||
156: syscalls.Error("sysctl", syserror.EPERM, "Deprecated. Use /proc/sys instead.", nil),
|
||||
157: syscalls.PartiallySupported("prctl", Prctl, "Not all options are supported.", nil),
|
||||
158: syscalls.PartiallySupported("arch_prctl", ArchPrctl, "Options ARCH_GET_GS, ARCH_SET_GS not supported.", nil),
|
||||
159: syscalls.CapError("adjtimex", linux.CAP_SYS_TIME, "", nil),
|
||||
@@ -225,50 +223,50 @@ var AMD64 = &kernel.SyscallTable{
|
||||
174: syscalls.CapError("create_module", linux.CAP_SYS_MODULE, "", nil),
|
||||
175: syscalls.CapError("init_module", linux.CAP_SYS_MODULE, "", nil),
|
||||
176: syscalls.CapError("delete_module", linux.CAP_SYS_MODULE, "", nil),
|
||||
177: syscalls.Error("get_kernel_syms", syscall.ENOSYS, "Not supported in Linux > 2.6.", nil),
|
||||
178: syscalls.Error("query_module", syscall.ENOSYS, "Not supported in Linux > 2.6.", nil),
|
||||
177: syscalls.Error("get_kernel_syms", syserror.ENOSYS, "Not supported in Linux > 2.6.", nil),
|
||||
178: syscalls.Error("query_module", syserror.ENOSYS, "Not supported in Linux > 2.6.", nil),
|
||||
179: syscalls.CapError("quotactl", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_admin for most operations
|
||||
180: syscalls.Error("nfsservctl", syscall.ENOSYS, "Removed after Linux 3.1.", nil),
|
||||
181: syscalls.Error("getpmsg", syscall.ENOSYS, "Not implemented in Linux.", nil),
|
||||
182: syscalls.Error("putpmsg", syscall.ENOSYS, "Not implemented in Linux.", nil),
|
||||
183: syscalls.Error("afs_syscall", syscall.ENOSYS, "Not implemented in Linux.", nil),
|
||||
184: syscalls.Error("tuxcall", syscall.ENOSYS, "Not implemented in Linux.", nil),
|
||||
185: syscalls.Error("security", syscall.ENOSYS, "Not implemented in Linux.", nil),
|
||||
180: syscalls.Error("nfsservctl", syserror.ENOSYS, "Removed after Linux 3.1.", nil),
|
||||
181: syscalls.Error("getpmsg", syserror.ENOSYS, "Not implemented in Linux.", nil),
|
||||
182: syscalls.Error("putpmsg", syserror.ENOSYS, "Not implemented in Linux.", nil),
|
||||
183: syscalls.Error("afs_syscall", syserror.ENOSYS, "Not implemented in Linux.", nil),
|
||||
184: syscalls.Error("tuxcall", syserror.ENOSYS, "Not implemented in Linux.", nil),
|
||||
185: syscalls.Error("security", syserror.ENOSYS, "Not implemented in Linux.", nil),
|
||||
186: syscalls.Supported("gettid", Gettid),
|
||||
187: syscalls.ErrorWithEvent("readahead", syscall.ENOSYS, "", []string{"gvisor.dev/issue/261"}), // TODO(b/29351341)
|
||||
188: syscalls.ErrorWithEvent("setxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
189: syscalls.ErrorWithEvent("lsetxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
190: syscalls.ErrorWithEvent("fsetxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
191: syscalls.ErrorWithEvent("getxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
192: syscalls.ErrorWithEvent("lgetxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
193: syscalls.ErrorWithEvent("fgetxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
194: syscalls.ErrorWithEvent("listxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
195: syscalls.ErrorWithEvent("llistxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
196: syscalls.ErrorWithEvent("flistxattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
197: syscalls.ErrorWithEvent("removexattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
198: syscalls.ErrorWithEvent("lremovexattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
199: syscalls.ErrorWithEvent("fremovexattr", syscall.ENOTSUP, "Requires filesystem support.", nil),
|
||||
187: syscalls.ErrorWithEvent("readahead", syserror.ENOSYS, "", []string{"gvisor.dev/issue/261"}), // TODO(b/29351341)
|
||||
188: syscalls.ErrorWithEvent("setxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
189: syscalls.ErrorWithEvent("lsetxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
190: syscalls.ErrorWithEvent("fsetxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
191: syscalls.ErrorWithEvent("getxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
192: syscalls.ErrorWithEvent("lgetxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
193: syscalls.ErrorWithEvent("fgetxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
194: syscalls.ErrorWithEvent("listxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
195: syscalls.ErrorWithEvent("llistxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
196: syscalls.ErrorWithEvent("flistxattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
197: syscalls.ErrorWithEvent("removexattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
198: syscalls.ErrorWithEvent("lremovexattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
199: syscalls.ErrorWithEvent("fremovexattr", syserror.ENOTSUP, "Requires filesystem support.", nil),
|
||||
200: syscalls.Supported("tkill", Tkill),
|
||||
201: syscalls.Supported("time", Time),
|
||||
202: syscalls.PartiallySupported("futex", Futex, "Robust futexes not supported.", nil),
|
||||
203: syscalls.PartiallySupported("sched_setaffinity", SchedSetaffinity, "Stub implementation.", nil),
|
||||
204: syscalls.PartiallySupported("sched_getaffinity", SchedGetaffinity, "Stub implementation.", nil),
|
||||
205: syscalls.Error("set_thread_area", syscall.ENOSYS, "Expected to return ENOSYS on 64-bit", nil),
|
||||
205: syscalls.Error("set_thread_area", syserror.ENOSYS, "Expected to return ENOSYS on 64-bit", nil),
|
||||
206: syscalls.PartiallySupported("io_setup", IoSetup, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"gvisor.dev/issue/204"}),
|
||||
207: syscalls.PartiallySupported("io_destroy", IoDestroy, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"gvisor.dev/issue/204"}),
|
||||
208: syscalls.PartiallySupported("io_getevents", IoGetevents, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"gvisor.dev/issue/204"}),
|
||||
209: syscalls.PartiallySupported("io_submit", IoSubmit, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"gvisor.dev/issue/204"}),
|
||||
210: syscalls.PartiallySupported("io_cancel", IoCancel, "Generally supported with exceptions. User ring optimizations are not implemented.", []string{"gvisor.dev/issue/204"}),
|
||||
211: syscalls.Error("get_thread_area", syscall.ENOSYS, "Expected to return ENOSYS on 64-bit", nil),
|
||||
211: syscalls.Error("get_thread_area", syserror.ENOSYS, "Expected to return ENOSYS on 64-bit", nil),
|
||||
212: syscalls.CapError("lookup_dcookie", linux.CAP_SYS_ADMIN, "", nil),
|
||||
213: syscalls.Supported("epoll_create", EpollCreate),
|
||||
214: syscalls.ErrorWithEvent("epoll_ctl_old", syscall.ENOSYS, "Deprecated.", nil),
|
||||
215: syscalls.ErrorWithEvent("epoll_wait_old", syscall.ENOSYS, "Deprecated.", nil),
|
||||
216: syscalls.ErrorWithEvent("remap_file_pages", syscall.ENOSYS, "Deprecated since Linux 3.16.", nil),
|
||||
214: syscalls.ErrorWithEvent("epoll_ctl_old", syserror.ENOSYS, "Deprecated.", nil),
|
||||
215: syscalls.ErrorWithEvent("epoll_wait_old", syserror.ENOSYS, "Deprecated.", nil),
|
||||
216: syscalls.ErrorWithEvent("remap_file_pages", syserror.ENOSYS, "Deprecated since Linux 3.16.", nil),
|
||||
217: syscalls.Supported("getdents64", Getdents64),
|
||||
218: syscalls.Supported("set_tid_address", SetTidAddress),
|
||||
219: syscalls.Supported("restart_syscall", RestartSyscall),
|
||||
220: syscalls.ErrorWithEvent("semtimedop", syscall.ENOSYS, "", []string{"gvisor.dev/issue/137"}), // TODO(b/29354920)
|
||||
220: syscalls.ErrorWithEvent("semtimedop", syserror.ENOSYS, "", []string{"gvisor.dev/issue/137"}), // TODO(b/29354920)
|
||||
221: syscalls.PartiallySupported("fadvise64", Fadvise64, "Not all options are supported.", nil),
|
||||
222: syscalls.Supported("timer_create", TimerCreate),
|
||||
223: syscalls.Supported("timer_settime", TimerSettime),
|
||||
@@ -284,21 +282,21 @@ var AMD64 = &kernel.SyscallTable{
|
||||
233: syscalls.Supported("epoll_ctl", EpollCtl),
|
||||
234: syscalls.Supported("tgkill", Tgkill),
|
||||
235: syscalls.Supported("utimes", Utimes),
|
||||
236: syscalls.Error("vserver", syscall.ENOSYS, "Not implemented by Linux", nil),
|
||||
236: syscalls.Error("vserver", syserror.ENOSYS, "Not implemented by Linux", nil),
|
||||
237: syscalls.PartiallySupported("mbind", Mbind, "Stub implementation. Only a single NUMA node is advertised, and mempolicy is ignored accordingly, but mbind() will succeed and has effects reflected by get_mempolicy.", []string{"gvisor.dev/issue/262"}),
|
||||
238: syscalls.PartiallySupported("set_mempolicy", SetMempolicy, "Stub implementation.", nil),
|
||||
239: syscalls.PartiallySupported("get_mempolicy", GetMempolicy, "Stub implementation.", nil),
|
||||
240: syscalls.ErrorWithEvent("mq_open", syscall.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
241: syscalls.ErrorWithEvent("mq_unlink", syscall.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
242: syscalls.ErrorWithEvent("mq_timedsend", syscall.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
243: syscalls.ErrorWithEvent("mq_timedreceive", syscall.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
244: syscalls.ErrorWithEvent("mq_notify", syscall.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
245: syscalls.ErrorWithEvent("mq_getsetattr", syscall.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
240: syscalls.ErrorWithEvent("mq_open", syserror.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
241: syscalls.ErrorWithEvent("mq_unlink", syserror.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
242: syscalls.ErrorWithEvent("mq_timedsend", syserror.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
243: syscalls.ErrorWithEvent("mq_timedreceive", syserror.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
244: syscalls.ErrorWithEvent("mq_notify", syserror.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
245: syscalls.ErrorWithEvent("mq_getsetattr", syserror.ENOSYS, "", []string{"gvisor.dev/issue/136"}), // TODO(b/29354921)
|
||||
246: syscalls.CapError("kexec_load", linux.CAP_SYS_BOOT, "", nil),
|
||||
247: syscalls.Supported("waitid", Waitid),
|
||||
248: syscalls.Error("add_key", syscall.EACCES, "Not available to user.", nil),
|
||||
249: syscalls.Error("request_key", syscall.EACCES, "Not available to user.", nil),
|
||||
250: syscalls.Error("keyctl", syscall.EACCES, "Not available to user.", nil),
|
||||
248: syscalls.Error("add_key", syserror.EACCES, "Not available to user.", nil),
|
||||
249: syscalls.Error("request_key", syserror.EACCES, "Not available to user.", nil),
|
||||
250: syscalls.Error("keyctl", syserror.EACCES, "Not available to user.", nil),
|
||||
251: syscalls.CapError("ioprio_set", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_nice or cap_sys_admin (depending)
|
||||
252: syscalls.CapError("ioprio_get", linux.CAP_SYS_ADMIN, "", nil), // requires cap_sys_nice or cap_sys_admin (depending)
|
||||
253: syscalls.PartiallySupported("inotify_init", InotifyInit, "inotify events are only available inside the sandbox.", nil),
|
||||
@@ -321,23 +319,23 @@ var AMD64 = &kernel.SyscallTable{
|
||||
270: syscalls.Supported("pselect", Pselect),
|
||||
271: syscalls.Supported("ppoll", Ppoll),
|
||||
272: syscalls.PartiallySupported("unshare", Unshare, "Mount, cgroup namespaces not supported. Network namespaces supported but must be empty.", nil),
|
||||
273: syscalls.Error("set_robust_list", syscall.ENOSYS, "Obsolete.", nil),
|
||||
274: syscalls.Error("get_robust_list", syscall.ENOSYS, "Obsolete.", nil),
|
||||
273: syscalls.Error("set_robust_list", syserror.ENOSYS, "Obsolete.", nil),
|
||||
274: syscalls.Error("get_robust_list", syserror.ENOSYS, "Obsolete.", nil),
|
||||
275: syscalls.PartiallySupported("splice", Splice, "Stub implementation.", []string{"gvisor.dev/issue/138"}), // TODO(b/29354098)
|
||||
276: syscalls.ErrorWithEvent("tee", syscall.ENOSYS, "", []string{"gvisor.dev/issue/138"}), // TODO(b/29354098)
|
||||
276: syscalls.ErrorWithEvent("tee", syserror.ENOSYS, "", []string{"gvisor.dev/issue/138"}), // TODO(b/29354098)
|
||||
277: syscalls.PartiallySupported("sync_file_range", SyncFileRange, "Full data flush is not guaranteed at this time.", nil),
|
||||
278: syscalls.ErrorWithEvent("vmsplice", syscall.ENOSYS, "", []string{"gvisor.dev/issue/138"}), // TODO(b/29354098)
|
||||
279: syscalls.CapError("move_pages", linux.CAP_SYS_NICE, "", nil), // requires cap_sys_nice (mostly)
|
||||
278: syscalls.ErrorWithEvent("vmsplice", syserror.ENOSYS, "", []string{"gvisor.dev/issue/138"}), // TODO(b/29354098)
|
||||
279: syscalls.CapError("move_pages", linux.CAP_SYS_NICE, "", nil), // requires cap_sys_nice (mostly)
|
||||
280: syscalls.Supported("utimensat", Utimensat),
|
||||
281: syscalls.Supported("epoll_pwait", EpollPwait),
|
||||
282: syscalls.ErrorWithEvent("signalfd", syscall.ENOSYS, "", []string{"gvisor.dev/issue/139"}), // TODO(b/19846426)
|
||||
282: syscalls.ErrorWithEvent("signalfd", syserror.ENOSYS, "", []string{"gvisor.dev/issue/139"}), // TODO(b/19846426)
|
||||
283: syscalls.Supported("timerfd_create", TimerfdCreate),
|
||||
284: syscalls.Supported("eventfd", Eventfd),
|
||||
285: syscalls.PartiallySupported("fallocate", Fallocate, "Not all options are supported.", nil),
|
||||
286: syscalls.Supported("timerfd_settime", TimerfdSettime),
|
||||
287: syscalls.Supported("timerfd_gettime", TimerfdGettime),
|
||||
288: syscalls.Supported("accept4", Accept4),
|
||||
289: syscalls.ErrorWithEvent("signalfd4", syscall.ENOSYS, "", []string{"gvisor.dev/issue/139"}), // TODO(b/19846426)
|
||||
289: syscalls.ErrorWithEvent("signalfd4", syserror.ENOSYS, "", []string{"gvisor.dev/issue/139"}), // TODO(b/19846426)
|
||||
290: syscalls.Supported("eventfd2", Eventfd2),
|
||||
291: syscalls.Supported("epoll_create1", EpollCreate1),
|
||||
292: syscalls.Supported("dup3", Dup3),
|
||||
@@ -346,37 +344,37 @@ var AMD64 = &kernel.SyscallTable{
|
||||
295: syscalls.Supported("preadv", Preadv),
|
||||
296: syscalls.Supported("pwritev", Pwritev),
|
||||
297: syscalls.Supported("rt_tgsigqueueinfo", RtTgsigqueueinfo),
|
||||
298: syscalls.ErrorWithEvent("perf_event_open", syscall.ENODEV, "No support for perf counters", nil),
|
||||
298: syscalls.ErrorWithEvent("perf_event_open", syserror.ENODEV, "No support for perf counters", nil),
|
||||
299: syscalls.PartiallySupported("recvmmsg", RecvMMsg, "Not all flags and control messages are supported.", nil),
|
||||
300: syscalls.ErrorWithEvent("fanotify_init", syscall.ENOSYS, "Needs CONFIG_FANOTIFY", nil),
|
||||
301: syscalls.ErrorWithEvent("fanotify_mark", syscall.ENOSYS, "Needs CONFIG_FANOTIFY", nil),
|
||||
300: syscalls.ErrorWithEvent("fanotify_init", syserror.ENOSYS, "Needs CONFIG_FANOTIFY", nil),
|
||||
301: syscalls.ErrorWithEvent("fanotify_mark", syserror.ENOSYS, "Needs CONFIG_FANOTIFY", nil),
|
||||
302: syscalls.Supported("prlimit64", Prlimit64),
|
||||
303: syscalls.Error("name_to_handle_at", syscall.EOPNOTSUPP, "Not supported by gVisor filesystems", nil),
|
||||
304: syscalls.Error("open_by_handle_at", syscall.EOPNOTSUPP, "Not supported by gVisor filesystems", nil),
|
||||
303: syscalls.Error("name_to_handle_at", syserror.EOPNOTSUPP, "Not supported by gVisor filesystems", nil),
|
||||
304: syscalls.Error("open_by_handle_at", syserror.EOPNOTSUPP, "Not supported by gVisor filesystems", nil),
|
||||
305: syscalls.CapError("clock_adjtime", linux.CAP_SYS_TIME, "", nil),
|
||||
306: syscalls.PartiallySupported("syncfs", Syncfs, "Depends on backing file system.", nil),
|
||||
307: syscalls.PartiallySupported("sendmmsg", SendMMsg, "Not all flags and control messages are supported.", nil),
|
||||
308: syscalls.ErrorWithEvent("setns", syscall.EOPNOTSUPP, "Needs filesystem support", []string{"gvisor.dev/issue/140"}), // TODO(b/29354995)
|
||||
308: syscalls.ErrorWithEvent("setns", syserror.EOPNOTSUPP, "Needs filesystem support", []string{"gvisor.dev/issue/140"}), // TODO(b/29354995)
|
||||
309: syscalls.Supported("getcpu", Getcpu),
|
||||
310: syscalls.ErrorWithEvent("process_vm_readv", syscall.ENOSYS, "", []string{"gvisor.dev/issue/158"}),
|
||||
311: syscalls.ErrorWithEvent("process_vm_writev", syscall.ENOSYS, "", []string{"gvisor.dev/issue/158"}),
|
||||
310: syscalls.ErrorWithEvent("process_vm_readv", syserror.ENOSYS, "", []string{"gvisor.dev/issue/158"}),
|
||||
311: syscalls.ErrorWithEvent("process_vm_writev", syserror.ENOSYS, "", []string{"gvisor.dev/issue/158"}),
|
||||
312: syscalls.CapError("kcmp", linux.CAP_SYS_PTRACE, "", nil),
|
||||
313: syscalls.CapError("finit_module", linux.CAP_SYS_MODULE, "", nil),
|
||||
314: syscalls.ErrorWithEvent("sched_setattr", syscall.ENOSYS, "gVisor does not implement a scheduler.", []string{"gvisor.dev/issue/264"}), // TODO(b/118902272)
|
||||
315: syscalls.ErrorWithEvent("sched_getattr", syscall.ENOSYS, "gVisor does not implement a scheduler.", []string{"gvisor.dev/issue/264"}), // TODO(b/118902272)
|
||||
316: syscalls.ErrorWithEvent("renameat2", syscall.ENOSYS, "", []string{"gvisor.dev/issue/263"}), // TODO(b/118902772)
|
||||
314: syscalls.ErrorWithEvent("sched_setattr", syserror.ENOSYS, "gVisor does not implement a scheduler.", []string{"gvisor.dev/issue/264"}), // TODO(b/118902272)
|
||||
315: syscalls.ErrorWithEvent("sched_getattr", syserror.ENOSYS, "gVisor does not implement a scheduler.", []string{"gvisor.dev/issue/264"}), // TODO(b/118902272)
|
||||
316: syscalls.ErrorWithEvent("renameat2", syserror.ENOSYS, "", []string{"gvisor.dev/issue/263"}), // TODO(b/118902772)
|
||||
317: syscalls.Supported("seccomp", Seccomp),
|
||||
318: syscalls.Supported("getrandom", GetRandom),
|
||||
319: syscalls.Supported("memfd_create", MemfdCreate),
|
||||
320: syscalls.CapError("kexec_file_load", linux.CAP_SYS_BOOT, "", nil),
|
||||
321: syscalls.CapError("bpf", linux.CAP_SYS_ADMIN, "", nil),
|
||||
322: syscalls.ErrorWithEvent("execveat", syscall.ENOSYS, "", []string{"gvisor.dev/issue/265"}), // TODO(b/118901836)
|
||||
323: syscalls.ErrorWithEvent("userfaultfd", syscall.ENOSYS, "", []string{"gvisor.dev/issue/266"}), // TODO(b/118906345)
|
||||
324: syscalls.ErrorWithEvent("membarrier", syscall.ENOSYS, "", []string{"gvisor.dev/issue/267"}), // TODO(b/118904897)
|
||||
322: syscalls.ErrorWithEvent("execveat", syserror.ENOSYS, "", []string{"gvisor.dev/issue/265"}), // TODO(b/118901836)
|
||||
323: syscalls.ErrorWithEvent("userfaultfd", syserror.ENOSYS, "", []string{"gvisor.dev/issue/266"}), // TODO(b/118906345)
|
||||
324: syscalls.ErrorWithEvent("membarrier", syserror.ENOSYS, "", []string{"gvisor.dev/issue/267"}), // TODO(b/118904897)
|
||||
325: syscalls.PartiallySupported("mlock2", Mlock2, "Stub implementation. The sandbox lacks appropriate permissions.", nil),
|
||||
|
||||
// Syscalls after 325 are "backports" from versions of Linux after 4.4.
|
||||
326: syscalls.ErrorWithEvent("copy_file_range", syscall.ENOSYS, "", nil),
|
||||
326: syscalls.ErrorWithEvent("copy_file_range", syserror.ENOSYS, "", nil),
|
||||
327: syscalls.Supported("preadv2", Preadv2),
|
||||
328: syscalls.PartiallySupported("pwritev2", Pwritev2, "Flag RWF_HIPRI is not supported.", nil),
|
||||
332: syscalls.Supported("statx", Statx),
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
package linux
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
@@ -27,7 +25,7 @@ import (
|
||||
// STOP are clear.
|
||||
func copyInSigSet(t *kernel.Task, sigSetAddr usermem.Addr, size uint) (linux.SignalSet, error) {
|
||||
if size != linux.SignalSetSize {
|
||||
return 0, syscall.EINVAL
|
||||
return 0, syserror.EINVAL
|
||||
}
|
||||
b := t.CopyScratchBuffer(8)
|
||||
if _, err := t.CopyInBytes(sigSetAddr, b); err != nil {
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
package linux
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel/epoll"
|
||||
@@ -29,11 +28,11 @@ import (
|
||||
// EpollCreate1 implements the epoll_create1(2) linux syscall.
|
||||
func EpollCreate1(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {
|
||||
flags := args[0].Int()
|
||||
if flags & ^syscall.EPOLL_CLOEXEC != 0 {
|
||||
if flags & ^linux.EPOLL_CLOEXEC != 0 {
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
closeOnExec := flags&syscall.EPOLL_CLOEXEC != 0
|
||||
closeOnExec := flags&linux.EPOLL_CLOEXEC != 0
|
||||
fd, err := syscalls.CreateEpoll(t, closeOnExec)
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
@@ -69,37 +68,34 @@ func EpollCtl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
|
||||
flags := epoll.EntryFlags(0)
|
||||
mask := waiter.EventMask(0)
|
||||
var data [2]int32
|
||||
if op != syscall.EPOLL_CTL_DEL {
|
||||
var e syscall.EpollEvent
|
||||
if op != linux.EPOLL_CTL_DEL {
|
||||
var e linux.EpollEvent
|
||||
if _, err := t.CopyIn(eventAddr, &e); err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
|
||||
if e.Events&syscall.EPOLLONESHOT != 0 {
|
||||
if e.Events&linux.EPOLLONESHOT != 0 {
|
||||
flags |= epoll.OneShot
|
||||
}
|
||||
|
||||
// syscall.EPOLLET is incorrectly generated as a negative number
|
||||
// in Go, see https://github.com/golang/go/issues/5328 for
|
||||
// details.
|
||||
if e.Events&-syscall.EPOLLET != 0 {
|
||||
if e.Events&linux.EPOLLET != 0 {
|
||||
flags |= epoll.EdgeTriggered
|
||||
}
|
||||
|
||||
mask = waiter.EventMaskFromLinux(e.Events)
|
||||
data[0] = e.Fd
|
||||
data[1] = e.Pad
|
||||
data[1] = e.Data
|
||||
}
|
||||
|
||||
// Perform the requested operations.
|
||||
switch op {
|
||||
case syscall.EPOLL_CTL_ADD:
|
||||
case linux.EPOLL_CTL_ADD:
|
||||
// See fs/eventpoll.c.
|
||||
mask |= waiter.EventHUp | waiter.EventErr
|
||||
return 0, nil, syscalls.AddEpoll(t, epfd, fd, flags, mask, data)
|
||||
case syscall.EPOLL_CTL_DEL:
|
||||
case linux.EPOLL_CTL_DEL:
|
||||
return 0, nil, syscalls.RemoveEpoll(t, epfd, fd)
|
||||
case syscall.EPOLL_CTL_MOD:
|
||||
case linux.EPOLL_CTL_MOD:
|
||||
// Same as EPOLL_CTL_ADD.
|
||||
mask |= waiter.EventHUp | waiter.EventErr
|
||||
return 0, nil, syscalls.UpdateEpoll(t, epfd, fd, flags, mask, data)
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
package linux
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel/eventfd"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -38,7 +37,7 @@ func Eventfd2(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
|
||||
allOps := uint(EFD_SEMAPHORE | EFD_NONBLOCK | EFD_CLOEXEC)
|
||||
|
||||
if flags & ^allOps != 0 {
|
||||
return 0, nil, syscall.EINVAL
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
event := eventfd.New(t, uint64(initVal), flags&EFD_SEMAPHORE != 0)
|
||||
|
||||
@@ -768,7 +768,7 @@ func Close(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
defer file.DecRef()
|
||||
|
||||
err := file.Flush(t)
|
||||
return 0, nil, handleIOError(t, false /* partial */, err, syscall.EINTR, "close", file)
|
||||
return 0, nil, handleIOError(t, false /* partial */, err, syserror.EINTR, "close", file)
|
||||
}
|
||||
|
||||
// Dup implements linux syscall dup(2).
|
||||
@@ -910,7 +910,7 @@ func Fcntl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
|
||||
// Copy in the lock request.
|
||||
flockAddr := args[2].Pointer()
|
||||
var flock syscall.Flock_t
|
||||
var flock linux.Flock
|
||||
if _, err := t.CopyIn(flockAddr, &flock); err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
@@ -959,11 +959,11 @@ func Fcntl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
// These locks don't block; execute the non-blocking operation using the inode's lock
|
||||
// context directly.
|
||||
switch flock.Type {
|
||||
case syscall.F_RDLCK:
|
||||
case linux.F_RDLCK:
|
||||
if !file.Flags().Read {
|
||||
return 0, nil, syserror.EBADF
|
||||
}
|
||||
if cmd == syscall.F_SETLK {
|
||||
if cmd == linux.F_SETLK {
|
||||
// Non-blocking lock, provide a nil lock.Blocker.
|
||||
if !file.Dirent.Inode.LockCtx.Posix.LockRegion(lockUniqueID, lock.ReadLock, rng, nil) {
|
||||
return 0, nil, syserror.EAGAIN
|
||||
@@ -975,11 +975,11 @@ func Fcntl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
}
|
||||
}
|
||||
return 0, nil, nil
|
||||
case syscall.F_WRLCK:
|
||||
case linux.F_WRLCK:
|
||||
if !file.Flags().Write {
|
||||
return 0, nil, syserror.EBADF
|
||||
}
|
||||
if cmd == syscall.F_SETLK {
|
||||
if cmd == linux.F_SETLK {
|
||||
// Non-blocking lock, provide a nil lock.Blocker.
|
||||
if !file.Dirent.Inode.LockCtx.Posix.LockRegion(lockUniqueID, lock.WriteLock, rng, nil) {
|
||||
return 0, nil, syserror.EAGAIN
|
||||
@@ -991,7 +991,7 @@ func Fcntl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
}
|
||||
}
|
||||
return 0, nil, nil
|
||||
case syscall.F_UNLCK:
|
||||
case linux.F_UNLCK:
|
||||
file.Dirent.Inode.LockCtx.Posix.UnlockRegion(lockUniqueID, rng)
|
||||
return 0, nil, nil
|
||||
default:
|
||||
@@ -1476,7 +1476,7 @@ func Truncate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
|
||||
|
||||
if uint64(length) >= t.ThreadGroup().Limits().Get(limits.FileSize).Cur {
|
||||
t.SendSignal(&arch.SignalInfo{
|
||||
Signo: int32(syscall.SIGXFSZ),
|
||||
Signo: int32(linux.SIGXFSZ),
|
||||
Code: arch.SignalInfoUser,
|
||||
})
|
||||
return 0, nil, syserror.EFBIG
|
||||
@@ -1536,7 +1536,7 @@ func Ftruncate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sys
|
||||
|
||||
if uint64(length) >= t.ThreadGroup().Limits().Get(limits.FileSize).Cur {
|
||||
t.SendSignal(&arch.SignalInfo{
|
||||
Signo: int32(syscall.SIGXFSZ),
|
||||
Signo: int32(linux.SIGXFSZ),
|
||||
Code: arch.SignalInfoUser,
|
||||
})
|
||||
return 0, nil, syserror.EFBIG
|
||||
@@ -1826,7 +1826,7 @@ func Utime(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
// No timesAddr argument will be interpreted as current system time.
|
||||
ts := defaultSetToSystemTimeSpec()
|
||||
if timesAddr != 0 {
|
||||
var times syscall.Utimbuf
|
||||
var times linux.Utime
|
||||
if _, err := t.CopyIn(timesAddr, ×); err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
@@ -2018,7 +2018,7 @@ func Fallocate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sys
|
||||
}
|
||||
if uint64(size) >= t.ThreadGroup().Limits().Get(limits.FileSize).Cur {
|
||||
t.SendSignal(&arch.SignalInfo{
|
||||
Signo: int32(syscall.SIGXFSZ),
|
||||
Signo: int32(linux.SIGXFSZ),
|
||||
Code: arch.SignalInfoUser,
|
||||
})
|
||||
return 0, nil, syserror.EFBIG
|
||||
|
||||
@@ -17,8 +17,8 @@ package linux
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/binary"
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
@@ -82,7 +82,7 @@ func getdents(t *kernel.Task, fd int32, addr usermem.Addr, size int, f func(*dir
|
||||
|
||||
switch err := handleIOError(t, ds.Written() > 0, rerr, kernel.ERESTARTSYS, "getdents", dir); err {
|
||||
case nil:
|
||||
dir.Dirent.InotifyEvent(syscall.IN_ACCESS, 0)
|
||||
dir.Dirent.InotifyEvent(linux.IN_ACCESS, 0)
|
||||
return uintptr(ds.Written()), nil
|
||||
case io.EOF:
|
||||
return 0, nil
|
||||
@@ -146,21 +146,21 @@ func smallestDirent64(a arch.Context) uint {
|
||||
func toType(nodeType fs.InodeType) uint8 {
|
||||
switch nodeType {
|
||||
case fs.RegularFile, fs.SpecialFile:
|
||||
return syscall.DT_REG
|
||||
return linux.DT_REG
|
||||
case fs.Symlink:
|
||||
return syscall.DT_LNK
|
||||
return linux.DT_LNK
|
||||
case fs.Directory, fs.SpecialDirectory:
|
||||
return syscall.DT_DIR
|
||||
return linux.DT_DIR
|
||||
case fs.Pipe:
|
||||
return syscall.DT_FIFO
|
||||
return linux.DT_FIFO
|
||||
case fs.CharacterDevice:
|
||||
return syscall.DT_CHR
|
||||
return linux.DT_CHR
|
||||
case fs.BlockDevice:
|
||||
return syscall.DT_BLK
|
||||
return linux.DT_BLK
|
||||
case fs.Socket:
|
||||
return syscall.DT_SOCK
|
||||
return linux.DT_SOCK
|
||||
default:
|
||||
return syscall.DT_UNKNOWN
|
||||
return linux.DT_UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,12 @@
|
||||
package linux
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs/anon"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
const allFlags = int(linux.IN_NONBLOCK | linux.IN_CLOEXEC)
|
||||
@@ -31,7 +30,7 @@ func InotifyInit1(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.
|
||||
flags := int(args[0].Int())
|
||||
|
||||
if flags&^allFlags != 0 {
|
||||
return 0, nil, syscall.EINVAL
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
dirent := fs.NewDirent(t, anon.NewInode(t), "inotify")
|
||||
@@ -66,14 +65,14 @@ func fdToInotify(t *kernel.Task, fd int32) (*fs.Inotify, *fs.File, error) {
|
||||
file := t.GetFile(fd)
|
||||
if file == nil {
|
||||
// Invalid fd.
|
||||
return nil, nil, syscall.EBADF
|
||||
return nil, nil, syserror.EBADF
|
||||
}
|
||||
|
||||
ino, ok := file.FileOperations.(*fs.Inotify)
|
||||
if !ok {
|
||||
// Not an inotify fd.
|
||||
file.DecRef()
|
||||
return nil, nil, syscall.EINVAL
|
||||
return nil, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
return ino, file, nil
|
||||
@@ -92,7 +91,7 @@ func InotifyAddWatch(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kern
|
||||
// "EINVAL: The given event mask contains no valid events."
|
||||
// -- inotify_add_watch(2)
|
||||
if validBits := mask & linux.ALL_INOTIFY_BITS; validBits == 0 {
|
||||
return 0, nil, syscall.EINVAL
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
ino, file, err := fdToInotify(t, fd)
|
||||
@@ -109,7 +108,7 @@ func InotifyAddWatch(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kern
|
||||
err = fileOpOn(t, linux.AT_FDCWD, path, resolve, func(root *fs.Dirent, dirent *fs.Dirent, _ uint) error {
|
||||
// "IN_ONLYDIR: Only watch pathname if it is a directory." -- inotify(7)
|
||||
if onlyDir := mask&linux.IN_ONLYDIR != 0; onlyDir && !fs.IsDir(dirent.Inode.StableAttr) {
|
||||
return syscall.ENOTDIR
|
||||
return syserror.ENOTDIR
|
||||
}
|
||||
|
||||
// Copy out to the return frame.
|
||||
|
||||
@@ -15,20 +15,19 @@
|
||||
package linux
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel/pipe"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
// pipe2 implements the actual system call with flags.
|
||||
func pipe2(t *kernel.Task, addr usermem.Addr, flags uint) (uintptr, error) {
|
||||
if flags&^(linux.O_NONBLOCK|linux.O_CLOEXEC) != 0 {
|
||||
return 0, syscall.EINVAL
|
||||
return 0, syserror.EINVAL
|
||||
}
|
||||
r, w := pipe.NewConnectedPipe(t, pipe.DefaultPipeSize, usermem.PageSize)
|
||||
|
||||
@@ -49,7 +48,7 @@ func pipe2(t *kernel.Task, addr usermem.Addr, flags uint) (uintptr, error) {
|
||||
// The files are not closed in this case, the exact semantics
|
||||
// of this error case are not well defined, but they could have
|
||||
// already been observed by user space.
|
||||
return 0, syscall.EFAULT
|
||||
return 0, syserror.EFAULT
|
||||
}
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user