mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add more unimplemented syscall events
Added events for *ctl syscalls that may have multiple different commands. For runsc, each syscall event is only logged once. For *ctl syscalls, use the cmd as identifier, not only the syscall number. PiperOrigin-RevId: 218015941 Change-Id: Ie3c19131ae36124861e9b492a7dbe1765d9e5e59
This commit is contained in:
committed by
Shentubot
parent
8fce67af24
commit
b2068cf5a5
+53
-22
@@ -18,28 +18,59 @@ package linux
|
||||
//
|
||||
// These are ordered by request number (low byte).
|
||||
const (
|
||||
TCGETS = 0x00005401
|
||||
TCSETS = 0x00005402
|
||||
TCSETSW = 0x00005403
|
||||
TCSETSF = 0x00005404
|
||||
TIOCSCTTY = 0x0000540e
|
||||
TIOCGPGRP = 0x0000540f
|
||||
TIOCSPGRP = 0x00005410
|
||||
TIOCOUTQ = 0x00005411
|
||||
TIOCGWINSZ = 0x00005413
|
||||
TIOCSWINSZ = 0x00005414
|
||||
TIOCINQ = 0x0000541b
|
||||
FIONREAD = TIOCINQ
|
||||
FIONBIO = 0x00005421
|
||||
TIOCGPTN = 0x80045430
|
||||
TIOCSPTLCK = 0x40045431
|
||||
FIONCLEX = 0x00005450
|
||||
FIOCLEX = 0x00005451
|
||||
FIOASYNC = 0x00005452
|
||||
FIOSETOWN = 0x00008901
|
||||
SIOCSPGRP = 0x00008902
|
||||
FIOGETOWN = 0x00008903
|
||||
SIOCGPGRP = 0x00008904
|
||||
TCGETS = 0x00005401
|
||||
TCSETS = 0x00005402
|
||||
TCSETSW = 0x00005403
|
||||
TCSETSF = 0x00005404
|
||||
TCSBRK = 0x00005409
|
||||
TIOCEXCL = 0x0000540c
|
||||
TIOCNXCL = 0x0000540d
|
||||
TIOCSCTTY = 0x0000540e
|
||||
TIOCGPGRP = 0x0000540f
|
||||
TIOCSPGRP = 0x00005410
|
||||
TIOCOUTQ = 0x00005411
|
||||
TIOCSTI = 0x00005412
|
||||
TIOCGWINSZ = 0x00005413
|
||||
TIOCSWINSZ = 0x00005414
|
||||
TIOCMGET = 0x00005415
|
||||
TIOCMBIS = 0x00005416
|
||||
TIOCMBIC = 0x00005417
|
||||
TIOCMSET = 0x00005418
|
||||
TIOCINQ = 0x0000541b
|
||||
FIONREAD = TIOCINQ
|
||||
FIONBIO = 0x00005421
|
||||
TIOCSETD = 0x00005423
|
||||
TIOCNOTTY = 0x00005422
|
||||
TIOCGETD = 0x00005424
|
||||
TCSBRKP = 0x00005425
|
||||
TIOCSBRK = 0x00005427
|
||||
TIOCCBRK = 0x00005428
|
||||
TIOCGSID = 0x00005429
|
||||
TIOCGPTN = 0x80045430
|
||||
TIOCSPTLCK = 0x40045431
|
||||
TIOCGDEV = 0x80045432
|
||||
TIOCVHANGUP = 0x00005437
|
||||
TCFLSH = 0x0000540b
|
||||
TIOCCONS = 0x0000541d
|
||||
TIOCSSERIAL = 0x0000541f
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGPTPEER = 0x80045441
|
||||
TIOCGICOUNT = 0x0000545d
|
||||
FIONCLEX = 0x00005450
|
||||
FIOCLEX = 0x00005451
|
||||
FIOASYNC = 0x00005452
|
||||
FIOSETOWN = 0x00008901
|
||||
SIOCSPGRP = 0x00008902
|
||||
FIOGETOWN = 0x00008903
|
||||
SIOCGPGRP = 0x00008904
|
||||
)
|
||||
|
||||
// ioctl(2) requests provided by uapi/linux/sockios.h
|
||||
const (
|
||||
SIOCGIFMEM = 0x891f
|
||||
SIOCGIFPFLAGS = 0x8935
|
||||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
)
|
||||
|
||||
// ioctl(2) requests provided by uapi/linux/android/binder.h
|
||||
|
||||
+91
-8
@@ -22,26 +22,102 @@ const (
|
||||
// PR_GET_PDEATHSIG will get the process' death signal.
|
||||
PR_GET_PDEATHSIG = 2
|
||||
|
||||
// PR_GET_DUMPABLE will get the process's dumpable flag.
|
||||
PR_GET_DUMPABLE = 3
|
||||
|
||||
// PR_SET_DUMPABLE will set the process's dumpable flag.
|
||||
PR_SET_DUMPABLE = 4
|
||||
|
||||
// PR_GET_KEEPCAPS will get the value of the keep capabilities flag.
|
||||
PR_GET_KEEPCAPS = 7
|
||||
|
||||
// PR_SET_KEEPCAPS will set the value of the keep capabilities flag.
|
||||
PR_SET_KEEPCAPS = 8
|
||||
|
||||
// PR_GET_TIMING will get the process's timing method.
|
||||
PR_GET_TIMING = 13
|
||||
|
||||
// PR_SET_TIMING will set the process's timing method.
|
||||
PR_SET_TIMING = 14
|
||||
|
||||
// PR_SET_NAME will set the process' name.
|
||||
PR_SET_NAME = 15
|
||||
|
||||
// PR_GET_NAME will get the process' name.
|
||||
PR_GET_NAME = 16
|
||||
|
||||
// PR_GET_SECCOMP will get a process' seccomp mode.
|
||||
PR_GET_SECCOMP = 21
|
||||
|
||||
// PR_SET_SECCOMP will set a process' seccomp mode.
|
||||
PR_SET_SECCOMP = 22
|
||||
|
||||
// PR_CAPBSET_READ will get the capability bounding set.
|
||||
PR_CAPBSET_READ = 23
|
||||
|
||||
// PR_CAPBSET_DROP will set the capability bounding set.
|
||||
PR_CAPBSET_DROP = 24
|
||||
|
||||
// PR_GET_TSC will get the the value of the flag determining whether the
|
||||
// timestamp counter can be read.
|
||||
PR_GET_TSC = 25
|
||||
|
||||
// PR_SET_TSC will set the the value of the flag determining whether the
|
||||
// timestamp counter can be read.
|
||||
PR_SET_TSC = 26
|
||||
|
||||
// PR_SET_TIMERSLACK set the process's time slack.
|
||||
PR_SET_TIMERSLACK = 29
|
||||
|
||||
// PR_GET_TIMERSLACK get the process's time slack.
|
||||
PR_GET_TIMERSLACK = 30
|
||||
|
||||
// PR_TASK_PERF_EVENTS_DISABLE disable all performance counters attached to
|
||||
// the calling process.
|
||||
PR_TASK_PERF_EVENTS_DISABLE = 31
|
||||
|
||||
// PR_TASK_PERF_EVENTS_ENABLE enable all performance counters attached to
|
||||
// the calling process.
|
||||
PR_TASK_PERF_EVENTS_ENABLE = 32
|
||||
|
||||
// PR_MCE_KILL set the machine check memory corruption kill policy for the
|
||||
// calling thread.
|
||||
PR_MCE_KILL = 33
|
||||
|
||||
// PR_MCE_KILL_GET get the machine check memory corruption kill policy for the
|
||||
// calling thread.
|
||||
PR_MCE_KILL_GET = 34
|
||||
|
||||
// PR_SET_MM will modify certain kernel memory map descriptor fields of the
|
||||
// calling process. See prctl(2) for more information.
|
||||
PR_SET_MM = 35
|
||||
|
||||
PR_SET_MM_START_CODE = 1
|
||||
PR_SET_MM_END_CODE = 2
|
||||
PR_SET_MM_START_DATA = 3
|
||||
PR_SET_MM_END_DATA = 4
|
||||
PR_SET_MM_START_STACK = 5
|
||||
PR_SET_MM_START_BRK = 6
|
||||
PR_SET_MM_BRK = 7
|
||||
PR_SET_MM_ARG_START = 8
|
||||
PR_SET_MM_ARG_END = 9
|
||||
PR_SET_MM_ENV_START = 10
|
||||
PR_SET_MM_ENV_END = 11
|
||||
PR_SET_MM_AUXV = 12
|
||||
// PR_SET_MM_EXE_FILE will supersede the /proc/pid/exe symbolic link with a
|
||||
// new one pointing to a new executable file identified by the file descriptor
|
||||
// provided in arg3 argument. See prctl(2) for more information.
|
||||
PR_SET_MM_EXE_FILE = 13
|
||||
PR_SET_MM_MAP = 14
|
||||
PR_SET_MM_MAP_SIZE = 15
|
||||
|
||||
// PR_SET_CHILD_SUBREAPER set the "child subreaper" attribute of the calling
|
||||
// process.
|
||||
PR_SET_CHILD_SUBREAPER = 36
|
||||
|
||||
// PR_GET_CHILD_SUBREAPER get the "child subreaper" attribute of the calling
|
||||
// process.
|
||||
PR_GET_CHILD_SUBREAPER = 37
|
||||
|
||||
// PR_SET_NO_NEW_PRIVS will set the calling thread's no_new_privs bit.
|
||||
PR_SET_NO_NEW_PRIVS = 38
|
||||
@@ -49,17 +125,24 @@ const (
|
||||
// PR_GET_NO_NEW_PRIVS will get the calling thread's no_new_privs bit.
|
||||
PR_GET_NO_NEW_PRIVS = 39
|
||||
|
||||
// PR_SET_SECCOMP will set a process' seccomp mode.
|
||||
PR_SET_SECCOMP = 22
|
||||
// PR_GET_TID_ADDRESS retrieve the clear_child_tid address.
|
||||
PR_GET_TID_ADDRESS = 40
|
||||
|
||||
// PR_GET_SECCOMP will get a process' seccomp mode.
|
||||
PR_GET_SECCOMP = 21
|
||||
// PR_SET_THP_DISABLE set the state of the "THP disable" flag for the calling
|
||||
// thread.
|
||||
PR_SET_THP_DISABLE = 41
|
||||
|
||||
// PR_CAPBSET_READ will get the capability bounding set.
|
||||
PR_CAPBSET_READ = 23
|
||||
// PR_GET_THP_DISABLE get the state of the "THP disable" flag for the calling
|
||||
// thread.
|
||||
PR_GET_THP_DISABLE = 42
|
||||
|
||||
// PR_CAPBSET_DROP will set the capability bounding set.
|
||||
PR_CAPBSET_DROP = 24
|
||||
// PR_MPX_ENABLE_MANAGEMENT enable kernel management of Memory Protection
|
||||
// eXtensions (MPX) bounds tables.
|
||||
PR_MPX_ENABLE_MANAGEMENT = 43
|
||||
|
||||
// PR_MPX_DISABLE_MANAGEMENTdisable kernel management of Memory Protection
|
||||
// eXtensions (MPX) bounds tables.
|
||||
PR_MPX_DISABLE_MANAGEMENT = 44
|
||||
)
|
||||
|
||||
// From <asm/prctl.h>
|
||||
|
||||
@@ -43,6 +43,7 @@ go_library(
|
||||
"//pkg/sentry/socket/control",
|
||||
"//pkg/sentry/socket/unix",
|
||||
"//pkg/sentry/socket/unix/transport",
|
||||
"//pkg/sentry/unimpl",
|
||||
"//pkg/sentry/uniqueid",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/syserr",
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/context"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/fs"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/unimpl"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.googlesource.com/gvisor/pkg/syserror"
|
||||
)
|
||||
@@ -179,6 +180,35 @@ func (t *TTYFileOperations) Ioctl(ctx context.Context, io usermem.IO, args arch.
|
||||
err := ioctlSetWinsize(fd, &winsize)
|
||||
return 0, err
|
||||
|
||||
// Unimplemented commands.
|
||||
case linux.TIOCSETD,
|
||||
linux.TIOCSBRK,
|
||||
linux.TIOCCBRK,
|
||||
linux.TCSBRK,
|
||||
linux.TCSBRKP,
|
||||
linux.TIOCSTI,
|
||||
linux.TIOCCONS,
|
||||
linux.FIONBIO,
|
||||
linux.TIOCEXCL,
|
||||
linux.TIOCNXCL,
|
||||
linux.TIOCGEXCL,
|
||||
linux.TIOCNOTTY,
|
||||
linux.TIOCSCTTY,
|
||||
linux.TIOCGSID,
|
||||
linux.TIOCGETD,
|
||||
linux.TIOCVHANGUP,
|
||||
linux.TIOCGDEV,
|
||||
linux.TIOCMGET,
|
||||
linux.TIOCMSET,
|
||||
linux.TIOCMBIC,
|
||||
linux.TIOCMBIS,
|
||||
linux.TIOCGICOUNT,
|
||||
linux.TCFLSH,
|
||||
linux.TIOCSSERIAL,
|
||||
linux.TIOCGPTPEER:
|
||||
|
||||
unimpl.EmitUnimplementedEvent(ctx)
|
||||
fallthrough
|
||||
default:
|
||||
return 0, syserror.ENOTTY
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ go_library(
|
||||
"//pkg/sentry/kernel/auth",
|
||||
"//pkg/sentry/kernel/time",
|
||||
"//pkg/sentry/socket/unix/transport",
|
||||
"//pkg/sentry/unimpl",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/syserror",
|
||||
"//pkg/waiter",
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/context"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/fs"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/fs/fsutil"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/unimpl"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.googlesource.com/gvisor/pkg/syserror"
|
||||
"gvisor.googlesource.com/gvisor/pkg/waiter"
|
||||
@@ -149,7 +150,7 @@ func (mf *masterFileOperations) Write(ctx context.Context, _ *fs.File, src userm
|
||||
|
||||
// Ioctl implements fs.FileOperations.Ioctl.
|
||||
func (mf *masterFileOperations) Ioctl(ctx context.Context, io usermem.IO, args arch.SyscallArguments) (uintptr, error) {
|
||||
switch args[1].Uint() {
|
||||
switch cmd := args[1].Uint(); cmd {
|
||||
case linux.FIONREAD: // linux.FIONREAD == linux.TIOCINQ
|
||||
// Get the number of bytes in the output queue read buffer.
|
||||
return 0, mf.t.ld.outputQueueReadSize(ctx, io, args)
|
||||
@@ -177,6 +178,48 @@ func (mf *masterFileOperations) Ioctl(ctx context.Context, io usermem.IO, args a
|
||||
case linux.TIOCSWINSZ:
|
||||
return 0, mf.t.ld.setWindowSize(ctx, io, args)
|
||||
default:
|
||||
maybeEmitUnimplementedEvent(ctx, cmd)
|
||||
return 0, syserror.ENOTTY
|
||||
}
|
||||
}
|
||||
|
||||
// maybeEmitUnimplementedEvent emits unimplemented event if cmd is valid.
|
||||
func maybeEmitUnimplementedEvent(ctx context.Context, cmd uint32) {
|
||||
switch cmd {
|
||||
case linux.TCGETS,
|
||||
linux.TCSETS,
|
||||
linux.TCSETSW,
|
||||
linux.TCSETSF,
|
||||
linux.TIOCGPGRP,
|
||||
linux.TIOCSPGRP,
|
||||
linux.TIOCGWINSZ,
|
||||
linux.TIOCSWINSZ,
|
||||
linux.TIOCSETD,
|
||||
linux.TIOCSBRK,
|
||||
linux.TIOCCBRK,
|
||||
linux.TCSBRK,
|
||||
linux.TCSBRKP,
|
||||
linux.TIOCSTI,
|
||||
linux.TIOCCONS,
|
||||
linux.FIONBIO,
|
||||
linux.TIOCEXCL,
|
||||
linux.TIOCNXCL,
|
||||
linux.TIOCGEXCL,
|
||||
linux.TIOCNOTTY,
|
||||
linux.TIOCSCTTY,
|
||||
linux.TIOCGSID,
|
||||
linux.TIOCGETD,
|
||||
linux.TIOCVHANGUP,
|
||||
linux.TIOCGDEV,
|
||||
linux.TIOCMGET,
|
||||
linux.TIOCMSET,
|
||||
linux.TIOCMBIC,
|
||||
linux.TIOCMBIS,
|
||||
linux.TIOCGICOUNT,
|
||||
linux.TCFLSH,
|
||||
linux.TIOCSSERIAL,
|
||||
linux.TIOCGPTPEER:
|
||||
|
||||
unimpl.EmitUnimplementedEvent(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ func (sf *slaveFileOperations) Write(ctx context.Context, _ *fs.File, src userme
|
||||
|
||||
// Ioctl implements fs.FileOperations.Ioctl.
|
||||
func (sf *slaveFileOperations) Ioctl(ctx context.Context, io usermem.IO, args arch.SyscallArguments) (uintptr, error) {
|
||||
switch args[1].Uint() {
|
||||
switch cmd := args[1].Uint(); cmd {
|
||||
case linux.FIONREAD: // linux.FIONREAD == linux.TIOCINQ
|
||||
// Get the number of bytes in the input queue read buffer.
|
||||
return 0, sf.si.t.ld.inputQueueReadSize(ctx, io, args)
|
||||
@@ -161,6 +161,7 @@ func (sf *slaveFileOperations) Ioctl(ctx context.Context, io usermem.IO, args ar
|
||||
// control.
|
||||
return 0, nil
|
||||
default:
|
||||
maybeEmitUnimplementedEvent(ctx, cmd)
|
||||
return 0, syserror.ENOTTY
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,6 +157,8 @@ go_library(
|
||||
"//pkg/sentry/socket/netlink/port",
|
||||
"//pkg/sentry/socket/unix/transport",
|
||||
"//pkg/sentry/time",
|
||||
"//pkg/sentry/unimpl",
|
||||
"//pkg/sentry/unimpl:unimplemented_syscall_go_proto",
|
||||
"//pkg/sentry/uniqueid",
|
||||
"//pkg/sentry/usage",
|
||||
"//pkg/sentry/usermem",
|
||||
|
||||
@@ -40,6 +40,7 @@ import (
|
||||
|
||||
"gvisor.googlesource.com/gvisor/pkg/abi/linux"
|
||||
"gvisor.googlesource.com/gvisor/pkg/cpuid"
|
||||
"gvisor.googlesource.com/gvisor/pkg/eventchannel"
|
||||
"gvisor.googlesource.com/gvisor/pkg/log"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/arch"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/context"
|
||||
@@ -58,6 +59,8 @@ import (
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/platform"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/socket/netlink/port"
|
||||
sentrytime "gvisor.googlesource.com/gvisor/pkg/sentry/time"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/unimpl"
|
||||
uspb "gvisor.googlesource.com/gvisor/pkg/sentry/unimpl/unimplemented_syscall_go_proto"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/uniqueid"
|
||||
"gvisor.googlesource.com/gvisor/pkg/state"
|
||||
"gvisor.googlesource.com/gvisor/pkg/tcpip"
|
||||
@@ -595,6 +598,8 @@ func (ctx *createProcessContext) Value(key interface{}) interface{} {
|
||||
return ctx.k
|
||||
case uniqueid.CtxInotifyCookie:
|
||||
return ctx.k.GenerateInotifyCookie()
|
||||
case unimpl.CtxEvents:
|
||||
return ctx.k
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
@@ -1033,6 +1038,16 @@ func (k *Kernel) SupervisorContext() context.Context {
|
||||
}
|
||||
}
|
||||
|
||||
// EmitUnimplementedEvent emits an UnimplementedSyscall event via the event
|
||||
// channel.
|
||||
func (k *Kernel) EmitUnimplementedEvent(ctx context.Context) {
|
||||
t := TaskFromContext(ctx)
|
||||
eventchannel.Emit(&uspb.UnimplementedSyscall{
|
||||
Tid: int32(t.ThreadID()),
|
||||
Registers: t.Arch().StateData().Proto(),
|
||||
})
|
||||
}
|
||||
|
||||
type supervisorContext struct {
|
||||
context.NoopSleeper
|
||||
log.Logger
|
||||
@@ -1073,6 +1088,8 @@ func (ctx supervisorContext) Value(key interface{}) interface{} {
|
||||
return ctx.k
|
||||
case uniqueid.CtxInotifyCookie:
|
||||
return ctx.k.GenerateInotifyCookie()
|
||||
case unimpl.CtxEvents:
|
||||
return ctx.k
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"math"
|
||||
"syscall"
|
||||
|
||||
"gvisor.googlesource.com/gvisor/pkg/abi/linux"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/arch"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/context"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/fs"
|
||||
@@ -77,7 +78,7 @@ func (rw *ReaderWriter) Readiness(mask waiter.EventMask) waiter.EventMask {
|
||||
func (rw *ReaderWriter) Ioctl(ctx context.Context, io usermem.IO, args arch.SyscallArguments) (uintptr, error) {
|
||||
// Switch on ioctl request.
|
||||
switch int(args[1].Int()) {
|
||||
case syscall.TIOCINQ:
|
||||
case linux.FIONREAD:
|
||||
v := rw.queuedSize()
|
||||
if v > math.MaxInt32 {
|
||||
panic(fmt.Sprintf("Impossibly large pipe queued size: %d", v))
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
ktime "gvisor.googlesource.com/gvisor/pkg/sentry/kernel/time"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/limits"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/platform"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/unimpl"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/uniqueid"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/usage"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/usermem"
|
||||
@@ -594,6 +595,8 @@ func (t *Task) Value(key interface{}) interface{} {
|
||||
return t.k
|
||||
case uniqueid.CtxInotifyCookie:
|
||||
return t.k.GenerateInotifyCookie()
|
||||
case unimpl.CtxEvents:
|
||||
return t.k
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ go_library(
|
||||
"//pkg/sentry/safemem",
|
||||
"//pkg/sentry/socket",
|
||||
"//pkg/sentry/socket/unix/transport",
|
||||
"//pkg/sentry/unimpl",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/syserr",
|
||||
"//pkg/syserror",
|
||||
|
||||
@@ -45,6 +45,7 @@ import (
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/safemem"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/socket"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/unimpl"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.googlesource.com/gvisor/pkg/syserr"
|
||||
"gvisor.googlesource.com/gvisor/pkg/syserror"
|
||||
@@ -1184,6 +1185,8 @@ func Ioctl(ctx context.Context, ep commonEndpoint, io usermem.IO, args arch.Sysc
|
||||
})
|
||||
return 0, err
|
||||
|
||||
case linux.SIOCGIFMEM, linux.SIOCGIFPFLAGS, linux.SIOCGMIIPHY, linux.SIOCGMIIREG:
|
||||
unimpl.EmitUnimplementedEvent(ctx)
|
||||
}
|
||||
|
||||
return 0, syserror.ENOTTY
|
||||
|
||||
@@ -32,6 +32,7 @@ go_library(
|
||||
"//pkg/sentry/socket/rpcinet/conn",
|
||||
"//pkg/sentry/socket/rpcinet/notifier",
|
||||
"//pkg/sentry/socket/unix/transport",
|
||||
"//pkg/sentry/unimpl",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/syserr",
|
||||
"//pkg/syserror",
|
||||
|
||||
@@ -32,6 +32,7 @@ import (
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/socket/rpcinet/notifier"
|
||||
pb "gvisor.googlesource.com/gvisor/pkg/sentry/socket/rpcinet/syscall_rpc_go_proto"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/unimpl"
|
||||
"gvisor.googlesource.com/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.googlesource.com/gvisor/pkg/syserr"
|
||||
"gvisor.googlesource.com/gvisor/pkg/syserror"
|
||||
@@ -555,6 +556,10 @@ func (s *socketOperations) Ioctl(ctx context.Context, io usermem.IO, args arch.S
|
||||
})
|
||||
|
||||
return 0, err
|
||||
|
||||
case linux.SIOCGIFMEM, linux.SIOCGIFPFLAGS, linux.SIOCGMIIPHY, linux.SIOCGMIIREG:
|
||||
unimpl.EmitUnimplementedEvent(ctx)
|
||||
|
||||
default:
|
||||
return 0, syserror.ENOTTY
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package(licenses = ["notice"]) # Apache 2.0
|
||||
|
||||
load("//tools/go_stateify:defs.bzl", "go_library")
|
||||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
|
||||
|
||||
go_library(
|
||||
name = "syscalls",
|
||||
@@ -13,9 +12,7 @@ go_library(
|
||||
importpath = "gvisor.googlesource.com/gvisor/pkg/sentry/syscalls",
|
||||
visibility = ["//:sandbox"],
|
||||
deps = [
|
||||
":unimplemented_syscall_go_proto",
|
||||
"//pkg/abi/linux",
|
||||
"//pkg/eventchannel",
|
||||
"//pkg/sentry/arch",
|
||||
"//pkg/sentry/fs",
|
||||
"//pkg/sentry/kernel",
|
||||
@@ -26,18 +23,3 @@ go_library(
|
||||
"//pkg/waiter",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "unimplemented_syscall_proto",
|
||||
srcs = ["unimplemented_syscall.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//pkg/sentry/arch:registers_proto"],
|
||||
)
|
||||
|
||||
go_proto_library(
|
||||
name = "unimplemented_syscall_go_proto",
|
||||
importpath = "gvisor.googlesource.com/gvisor/pkg/sentry/syscalls/unimplemented_syscall_go_proto",
|
||||
proto = ":unimplemented_syscall_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//pkg/sentry/arch:registers_go_proto"],
|
||||
)
|
||||
|
||||
@@ -369,7 +369,7 @@ var AMD64 = &kernel.SyscallTable{
|
||||
0xffffffffff600800: 309, // vsyscall getcpu(2)
|
||||
},
|
||||
Missing: func(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, error) {
|
||||
syscalls.UnimplementedEvent(t)
|
||||
t.Kernel().EmitUnimplementedEvent(t)
|
||||
return 0, syserror.ENOSYS
|
||||
},
|
||||
}
|
||||
|
||||
@@ -104,6 +104,22 @@ func Prctl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
|
||||
// Set the underlying executable.
|
||||
t.MemoryManager().SetExecutable(file.Dirent)
|
||||
|
||||
case linux.PR_SET_MM_AUXV,
|
||||
linux.PR_SET_MM_START_CODE,
|
||||
linux.PR_SET_MM_END_CODE,
|
||||
linux.PR_SET_MM_START_DATA,
|
||||
linux.PR_SET_MM_END_DATA,
|
||||
linux.PR_SET_MM_START_STACK,
|
||||
linux.PR_SET_MM_START_BRK,
|
||||
linux.PR_SET_MM_BRK,
|
||||
linux.PR_SET_MM_ARG_START,
|
||||
linux.PR_SET_MM_ARG_END,
|
||||
linux.PR_SET_MM_ENV_START,
|
||||
linux.PR_SET_MM_ENV_END:
|
||||
|
||||
t.Kernel().EmitUnimplementedEvent(t)
|
||||
fallthrough
|
||||
default:
|
||||
return 0, nil, syscall.EINVAL
|
||||
}
|
||||
@@ -151,8 +167,29 @@ func Prctl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
|
||||
}
|
||||
return 0, nil, t.DropBoundingCapability(cp)
|
||||
|
||||
case linux.PR_GET_DUMPABLE,
|
||||
linux.PR_SET_DUMPABLE,
|
||||
linux.PR_GET_TIMING,
|
||||
linux.PR_SET_TIMING,
|
||||
linux.PR_GET_TSC,
|
||||
linux.PR_SET_TSC,
|
||||
linux.PR_TASK_PERF_EVENTS_DISABLE,
|
||||
linux.PR_TASK_PERF_EVENTS_ENABLE,
|
||||
linux.PR_GET_TIMERSLACK,
|
||||
linux.PR_SET_TIMERSLACK,
|
||||
linux.PR_MCE_KILL,
|
||||
linux.PR_MCE_KILL_GET,
|
||||
linux.PR_GET_TID_ADDRESS,
|
||||
linux.PR_SET_CHILD_SUBREAPER,
|
||||
linux.PR_GET_CHILD_SUBREAPER,
|
||||
linux.PR_GET_THP_DISABLE,
|
||||
linux.PR_SET_THP_DISABLE,
|
||||
linux.PR_MPX_ENABLE_MANAGEMENT,
|
||||
linux.PR_MPX_DISABLE_MANAGEMENT:
|
||||
|
||||
t.Kernel().EmitUnimplementedEvent(t)
|
||||
fallthrough
|
||||
default:
|
||||
t.Warningf("Unsupported prctl %d", option)
|
||||
return 0, nil, syscall.EINVAL
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ func Shmctl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal
|
||||
// We currently do not support memmory locking anywhere.
|
||||
// mlock(2)/munlock(2) are currently stubbed out as no-ops so do the
|
||||
// same here.
|
||||
t.Kernel().EmitUnimplementedEvent(t)
|
||||
return 0, nil, nil
|
||||
|
||||
default:
|
||||
|
||||
@@ -45,6 +45,9 @@ func ArchPrctl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sys
|
||||
regs.Fs = 0
|
||||
regs.Fs_base = fsbase
|
||||
|
||||
case linux.ARCH_GET_GS, linux.ARCH_SET_GS:
|
||||
t.Kernel().EmitUnimplementedEvent(t)
|
||||
fallthrough
|
||||
default:
|
||||
return 0, nil, syscall.EINVAL
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user