summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2018-12-06 11:42:23 -0800
committerShentubot <shentubot@google.com>2018-12-06 11:43:11 -0800
commit666db00c262c7d6d6359fbaba28e344d015a7823 (patch)
treebe5e9ca85570c04ec5625b79657ab47b0a38aada /pkg
parent000fa84a3bb1aebeda235c56545c942d7c29003d (diff)
Convert ValueSet to a map
Unlike FlagSet, order doesn't matter here, so it can simply be a map. PiperOrigin-RevId: 224377910 Change-Id: I15810c698a7f02d8614bf09b59583ab73cba0514
Diffstat (limited to 'pkg')
-rw-r--r--pkg/abi/flag.go25
-rw-r--r--pkg/abi/linux/file.go35
-rw-r--r--pkg/sentry/strace/futex.go65
-rw-r--r--pkg/sentry/strace/open.go15
-rw-r--r--pkg/sentry/strace/ptrace.go190
-rw-r--r--pkg/sentry/strace/socket.go470
-rw-r--r--pkg/sentry/strace/strace.go15
7 files changed, 168 insertions, 647 deletions
diff --git a/pkg/abi/flag.go b/pkg/abi/flag.go
index 0698e410f..049c1b0dd 100644
--- a/pkg/abi/flag.go
+++ b/pkg/abi/flag.go
@@ -46,30 +46,25 @@ func (s FlagSet) Parse(val uint64) string {
return strings.Join(flags, "|")
}
-// ValueSet is a slice of syscall values and their name. Parse will replace
-// values that exactly match an entry with its name.
-type ValueSet []struct {
- Value uint64
- Name string
-}
+// ValueSet is a map of syscall values to their name. Parse will use the name
+// or the value if unknown.
+type ValueSet map[uint64]string
// Parse returns the name of the value associated with `val`. Unknown values
// are converted to hex.
-func (e ValueSet) Parse(val uint64) string {
- for _, f := range e {
- if val == f.Value {
- return f.Name
- }
+func (s ValueSet) Parse(val uint64) string {
+ if v, ok := s[val]; ok {
+ return v
}
return fmt.Sprintf("%#x", val)
}
// ParseName returns the flag value associated with 'name'. Returns false
// if no value is found.
-func (e ValueSet) ParseName(name string) (uint64, bool) {
- for _, f := range e {
- if name == f.Name {
- return f.Value, true
+func (s ValueSet) ParseName(name string) (uint64, bool) {
+ for k, v := range s {
+ if v == name {
+ return k, true
}
}
return math.MaxUint64, false
diff --git a/pkg/abi/linux/file.go b/pkg/abi/linux/file.go
index 8d48e1753..ac49ae9a6 100644
--- a/pkg/abi/linux/file.go
+++ b/pkg/abi/linux/file.go
@@ -223,32 +223,11 @@ var modeExtraBits = abi.FlagSet{
}
var fileType = abi.ValueSet{
- {
- Value: ModeSocket,
- Name: "S_IFSOCK",
- },
- {
- Value: ModeSymlink,
- Name: "S_IFLINK",
- },
- {
- Value: ModeRegular,
- Name: "S_IFREG",
- },
- {
- Value: ModeBlockDevice,
- Name: "S_IFBLK",
- },
- {
- Value: ModeDirectory,
- Name: "S_IFDIR",
- },
- {
- Value: ModeCharacterDevice,
- Name: "S_IFCHR",
- },
- {
- Value: ModeNamedPipe,
- Name: "S_IFIFO",
- },
+ ModeSocket: "S_IFSOCK",
+ ModeSymlink: "S_IFLINK",
+ ModeRegular: "S_IFREG",
+ ModeBlockDevice: "S_IFBLK",
+ ModeDirectory: "S_IFDIR",
+ ModeCharacterDevice: "S_IFCHR",
+ ModeNamedPipe: "S_IFIFO",
}
diff --git a/pkg/sentry/strace/futex.go b/pkg/sentry/strace/futex.go
index ceb3dc21d..f4aa7fcad 100644
--- a/pkg/sentry/strace/futex.go
+++ b/pkg/sentry/strace/futex.go
@@ -21,58 +21,19 @@ import (
// FutexCmd are the possible futex(2) commands.
var FutexCmd = abi.ValueSet{
- {
- Value: linux.FUTEX_WAIT,
- Name: "FUTEX_WAIT",
- },
- {
- Value: linux.FUTEX_WAKE,
- Name: "FUTEX_WAKE",
- },
- {
- Value: linux.FUTEX_FD,
- Name: "FUTEX_FD",
- },
- {
- Value: linux.FUTEX_REQUEUE,
- Name: "FUTEX_REQUEUE",
- },
- {
- Value: linux.FUTEX_CMP_REQUEUE,
- Name: "FUTEX_CMP_REQUEUE",
- },
- {
- Value: linux.FUTEX_WAKE_OP,
- Name: "FUTEX_WAKE_OP",
- },
- {
- Value: linux.FUTEX_LOCK_PI,
- Name: "FUTEX_LOCK_PI",
- },
- {
- Value: linux.FUTEX_UNLOCK_PI,
- Name: "FUTEX_UNLOCK_PI",
- },
- {
- Value: linux.FUTEX_TRYLOCK_PI,
- Name: "FUTEX_TRYLOCK_PI",
- },
- {
- Value: linux.FUTEX_WAIT_BITSET,
- Name: "FUTEX_WAIT_BITSET",
- },
- {
- Value: linux.FUTEX_WAKE_BITSET,
- Name: "FUTEX_WAKE_BITSET",
- },
- {
- Value: linux.FUTEX_WAIT_REQUEUE_PI,
- Name: "FUTEX_WAIT_REQUEUE_PI",
- },
- {
- Value: linux.FUTEX_CMP_REQUEUE_PI,
- Name: "FUTEX_CMP_REQUEUE_PI",
- },
+ linux.FUTEX_WAIT: "FUTEX_WAIT",
+ linux.FUTEX_WAKE: "FUTEX_WAKE",
+ linux.FUTEX_FD: "FUTEX_FD",
+ linux.FUTEX_REQUEUE: "FUTEX_REQUEUE",
+ linux.FUTEX_CMP_REQUEUE: "FUTEX_CMP_REQUEUE",
+ linux.FUTEX_WAKE_OP: "FUTEX_WAKE_OP",
+ linux.FUTEX_LOCK_PI: "FUTEX_LOCK_PI",
+ linux.FUTEX_UNLOCK_PI: "FUTEX_UNLOCK_PI",
+ linux.FUTEX_TRYLOCK_PI: "FUTEX_TRYLOCK_PI",
+ linux.FUTEX_WAIT_BITSET: "FUTEX_WAIT_BITSET",
+ linux.FUTEX_WAKE_BITSET: "FUTEX_WAKE_BITSET",
+ linux.FUTEX_WAIT_REQUEUE_PI: "FUTEX_WAIT_REQUEUE_PI",
+ linux.FUTEX_CMP_REQUEUE_PI: "FUTEX_CMP_REQUEUE_PI",
}
func futex(op uint64) string {
diff --git a/pkg/sentry/strace/open.go b/pkg/sentry/strace/open.go
index 5a72a940c..3bf348d7a 100644
--- a/pkg/sentry/strace/open.go
+++ b/pkg/sentry/strace/open.go
@@ -22,18 +22,9 @@ import (
// OpenMode represents the mode to open(2) a file.
var OpenMode = abi.ValueSet{
- {
- Value: syscall.O_RDWR,
- Name: "O_RDWR",
- },
- {
- Value: syscall.O_WRONLY,
- Name: "O_WRONLY",
- },
- {
- Value: syscall.O_RDONLY,
- Name: "O_RDONLY",
- },
+ syscall.O_RDWR: "O_RDWR",
+ syscall.O_WRONLY: "O_WRONLY",
+ syscall.O_RDONLY: "O_RDONLY",
}
// OpenFlagSet is the set of open(2) flags.
diff --git a/pkg/sentry/strace/ptrace.go b/pkg/sentry/strace/ptrace.go
index c572aafb4..8c4b79227 100644
--- a/pkg/sentry/strace/ptrace.go
+++ b/pkg/sentry/strace/ptrace.go
@@ -21,156 +21,42 @@ import (
// PtraceRequestSet are the possible ptrace(2) requests.
var PtraceRequestSet = abi.ValueSet{
- {
- Value: linux.PTRACE_TRACEME,
- Name: "PTRACE_TRACEME",
- },
- {
- Value: linux.PTRACE_PEEKTEXT,
- Name: "PTRACE_PEEKTEXT",
- },
- {
- Value: linux.PTRACE_PEEKDATA,
- Name: "PTRACE_PEEKDATA",
- },
- {
- Value: linux.PTRACE_PEEKUSR,
- Name: "PTRACE_PEEKUSR",
- },
- {
- Value: linux.PTRACE_POKETEXT,
- Name: "PTRACE_POKETEXT",
- },
- {
- Value: linux.PTRACE_POKEDATA,
- Name: "PTRACE_POKEDATA",
- },
- {
- Value: linux.PTRACE_POKEUSR,
- Name: "PTRACE_POKEUSR",
- },
- {
- Value: linux.PTRACE_CONT,
- Name: "PTRACE_CONT",
- },
- {
- Value: linux.PTRACE_KILL,
- Name: "PTRACE_KILL",
- },
- {
- Value: linux.PTRACE_SINGLESTEP,
- Name: "PTRACE_SINGLESTEP",
- },
- {
- Value: linux.PTRACE_ATTACH,
- Name: "PTRACE_ATTACH",
- },
- {
- Value: linux.PTRACE_DETACH,
- Name: "PTRACE_DETACH",
- },
- {
- Value: linux.PTRACE_SYSCALL,
- Name: "PTRACE_SYSCALL",
- },
- {
- Value: linux.PTRACE_SETOPTIONS,
- Name: "PTRACE_SETOPTIONS",
- },
- {
- Value: linux.PTRACE_GETEVENTMSG,
- Name: "PTRACE_GETEVENTMSG",
- },
- {
- Value: linux.PTRACE_GETSIGINFO,
- Name: "PTRACE_GETSIGINFO",
- },
- {
- Value: linux.PTRACE_SETSIGINFO,
- Name: "PTRACE_SETSIGINFO",
- },
- {
- Value: linux.PTRACE_GETREGSET,
- Name: "PTRACE_GETREGSET",
- },
- {
- Value: linux.PTRACE_SETREGSET,
- Name: "PTRACE_SETREGSET",
- },
- {
- Value: linux.PTRACE_SEIZE,
- Name: "PTRACE_SEIZE",
- },
- {
- Value: linux.PTRACE_INTERRUPT,
- Name: "PTRACE_INTERRUPT",
- },
- {
- Value: linux.PTRACE_LISTEN,
- Name: "PTRACE_LISTEN",
- },
- {
- Value: linux.PTRACE_PEEKSIGINFO,
- Name: "PTRACE_PEEKSIGINFO",
- },
- {
- Value: linux.PTRACE_GETSIGMASK,
- Name: "PTRACE_GETSIGMASK",
- },
- {
- Value: linux.PTRACE_SETSIGMASK,
- Name: "PTRACE_SETSIGMASK",
- },
- {
- Value: linux.PTRACE_GETREGS,
- Name: "PTRACE_GETREGS",
- },
- {
- Value: linux.PTRACE_SETREGS,
- Name: "PTRACE_SETREGS",
- },
- {
- Value: linux.PTRACE_GETFPREGS,
- Name: "PTRACE_GETFPREGS",
- },
- {
- Value: linux.PTRACE_SETFPREGS,
- Name: "PTRACE_SETFPREGS",
- },
- {
- Value: linux.PTRACE_GETFPXREGS,
- Name: "PTRACE_GETFPXREGS",
- },
- {
- Value: linux.PTRACE_SETFPXREGS,
- Name: "PTRACE_SETFPXREGS",
- },
- {
- Value: linux.PTRACE_OLDSETOPTIONS,
- Name: "PTRACE_OLDSETOPTIONS",
- },
- {
- Value: linux.PTRACE_GET_THREAD_AREA,
- Name: "PTRACE_GET_THREAD_AREA",
- },
- {
- Value: linux.PTRACE_SET_THREAD_AREA,
- Name: "PTRACE_SET_THREAD_AREA",
- },
- {
- Value: linux.PTRACE_ARCH_PRCTL,
- Name: "PTRACE_ARCH_PRCTL",
- },
- {
- Value: linux.PTRACE_SYSEMU,
- Name: "PTRACE_SYSEMU",
- },
- {
- Value: linux.PTRACE_SYSEMU_SINGLESTEP,
- Name: "PTRACE_SYSEMU_SINGLESTEP",
- },
- {
- Value: linux.PTRACE_SINGLEBLOCK,
- Name: "PTRACE_SINGLEBLOCK",
- },
+ linux.PTRACE_TRACEME: "PTRACE_TRACEME",
+ linux.PTRACE_PEEKTEXT: "PTRACE_PEEKTEXT",
+ linux.PTRACE_PEEKDATA: "PTRACE_PEEKDATA",
+ linux.PTRACE_PEEKUSR: "PTRACE_PEEKUSR",
+ linux.PTRACE_POKETEXT: "PTRACE_POKETEXT",
+ linux.PTRACE_POKEDATA: "PTRACE_POKEDATA",
+ linux.PTRACE_POKEUSR: "PTRACE_POKEUSR",
+ linux.PTRACE_CONT: "PTRACE_CONT",
+ linux.PTRACE_KILL: "PTRACE_KILL",
+ linux.PTRACE_SINGLESTEP: "PTRACE_SINGLESTEP",
+ linux.PTRACE_ATTACH: "PTRACE_ATTACH",
+ linux.PTRACE_DETACH: "PTRACE_DETACH",
+ linux.PTRACE_SYSCALL: "PTRACE_SYSCALL",
+ linux.PTRACE_SETOPTIONS: "PTRACE_SETOPTIONS",
+ linux.PTRACE_GETEVENTMSG: "PTRACE_GETEVENTMSG",
+ linux.PTRACE_GETSIGINFO: "PTRACE_GETSIGINFO",
+ linux.PTRACE_SETSIGINFO: "PTRACE_SETSIGINFO",
+ linux.PTRACE_GETREGSET: "PTRACE_GETREGSET",
+ linux.PTRACE_SETREGSET: "PTRACE_SETREGSET",
+ linux.PTRACE_SEIZE: "PTRACE_SEIZE",
+ linux.PTRACE_INTERRUPT: "PTRACE_INTERRUPT",
+ linux.PTRACE_LISTEN: "PTRACE_LISTEN",
+ linux.PTRACE_PEEKSIGINFO: "PTRACE_PEEKSIGINFO",
+ linux.PTRACE_GETSIGMASK: "PTRACE_GETSIGMASK",
+ linux.PTRACE_SETSIGMASK: "PTRACE_SETSIGMASK",
+ linux.PTRACE_GETREGS: "PTRACE_GETREGS",
+ linux.PTRACE_SETREGS: "PTRACE_SETREGS",
+ linux.PTRACE_GETFPREGS: "PTRACE_GETFPREGS",
+ linux.PTRACE_SETFPREGS: "PTRACE_SETFPREGS",
+ linux.PTRACE_GETFPXREGS: "PTRACE_GETFPXREGS",
+ linux.PTRACE_SETFPXREGS: "PTRACE_SETFPXREGS",
+ linux.PTRACE_OLDSETOPTIONS: "PTRACE_OLDSETOPTIONS",
+ linux.PTRACE_GET_THREAD_AREA: "PTRACE_GET_THREAD_AREA",
+ linux.PTRACE_SET_THREAD_AREA: "PTRACE_SET_THREAD_AREA",
+ linux.PTRACE_ARCH_PRCTL: "PTRACE_ARCH_PRCTL",
+ linux.PTRACE_SYSEMU: "PTRACE_SYSEMU",
+ linux.PTRACE_SYSEMU_SINGLESTEP: "PTRACE_SYSEMU_SINGLESTEP",
+ linux.PTRACE_SINGLEBLOCK: "PTRACE_SINGLEBLOCK",
}
diff --git a/pkg/sentry/strace/socket.go b/pkg/sentry/strace/socket.go
index 375418dc1..4c1a9d469 100644
--- a/pkg/sentry/strace/socket.go
+++ b/pkg/sentry/strace/socket.go
@@ -31,202 +31,58 @@ import (
// SocketFamily are the possible socket(2) families.
var SocketFamily = abi.ValueSet{
- {
- Value: linux.AF_UNSPEC,
- Name: "AF_UNSPEC",
- },
- {
- Value: linux.AF_UNIX,
- Name: "AF_UNIX",
- },
- {
- Value: linux.AF_INET,
- Name: "AF_INET",
- },
- {
- Value: linux.AF_AX25,
- Name: "AF_AX25",
- },
- {
- Value: linux.AF_IPX,
- Name: "AF_IPX",
- },
- {
- Value: linux.AF_APPLETALK,
- Name: "AF_APPLETALK",
- },
- {
- Value: linux.AF_NETROM,
- Name: "AF_NETROM",
- },
- {
- Value: linux.AF_BRIDGE,
- Name: "AF_BRIDGE",
- },
- {
- Value: linux.AF_ATMPVC,
- Name: "AF_ATMPVC",
- },
- {
- Value: linux.AF_X25,
- Name: "AF_X25",
- },
- {
- Value: linux.AF_INET6,
- Name: "AF_INET6",
- },
- {
- Value: linux.AF_ROSE,
- Name: "AF_ROSE",
- },
- {
- Value: linux.AF_DECnet,
- Name: "AF_DECnet",
- },
- {
- Value: linux.AF_NETBEUI,
- Name: "AF_NETBEUI",
- },
- {
- Value: linux.AF_SECURITY,
- Name: "AF_SECURITY",
- },
- {
- Value: linux.AF_KEY,
- Name: "AF_KEY",
- },
- {
- Value: linux.AF_NETLINK,
- Name: "AF_NETLINK",
- },
- {
- Value: linux.AF_PACKET,
- Name: "AF_PACKET",
- },
- {
- Value: linux.AF_ASH,
- Name: "AF_ASH",
- },
- {
- Value: linux.AF_ECONET,
- Name: "AF_ECONET",
- },
- {
- Value: linux.AF_ATMSVC,
- Name: "AF_ATMSVC",
- },
- {
- Value: linux.AF_RDS,
- Name: "AF_RDS",
- },
- {
- Value: linux.AF_SNA,
- Name: "AF_SNA",
- },
- {
- Value: linux.AF_IRDA,
- Name: "AF_IRDA",
- },
- {
- Value: linux.AF_PPPOX,
- Name: "AF_PPPOX",
- },
- {
- Value: linux.AF_WANPIPE,
- Name: "AF_WANPIPE",
- },
- {
- Value: linux.AF_LLC,
- Name: "AF_LLC",
- },
- {
- Value: linux.AF_IB,
- Name: "AF_IB",
- },
- {
- Value: linux.AF_MPLS,
- Name: "AF_MPLS",
- },
- {
- Value: linux.AF_CAN,
- Name: "AF_CAN",
- },
- {
- Value: linux.AF_TIPC,
- Name: "AF_TIPC",
- },
- {
- Value: linux.AF_BLUETOOTH,
- Name: "AF_BLUETOOTH",
- },
- {
- Value: linux.AF_IUCV,
- Name: "AF_IUCV",
- },
- {
- Value: linux.AF_RXRPC,
- Name: "AF_RXRPC",
- },
- {
- Value: linux.AF_ISDN,
- Name: "AF_ISDN",
- },
- {
- Value: linux.AF_PHONET,
- Name: "AF_PHONET",
- },
- {
- Value: linux.AF_IEEE802154,
- Name: "AF_IEEE802154",
- },
- {
- Value: linux.AF_CAIF,
- Name: "AF_CAIF",
- },
- {
- Value: linux.AF_ALG,
- Name: "AF_ALG",
- },
- {
- Value: linux.AF_NFC,
- Name: "AF_NFC",
- },
- {
- Value: linux.AF_VSOCK,
- Name: "AF_VSOCK",
- },
+ linux.AF_UNSPEC: "AF_UNSPEC",
+ linux.AF_UNIX: "AF_UNIX",
+ linux.AF_INET: "AF_INET",
+ linux.AF_AX25: "AF_AX25",
+ linux.AF_IPX: "AF_IPX",
+ linux.AF_APPLETALK: "AF_APPLETALK",
+ linux.AF_NETROM: "AF_NETROM",
+ linux.AF_BRIDGE: "AF_BRIDGE",
+ linux.AF_ATMPVC: "AF_ATMPVC",
+ linux.AF_X25: "AF_X25",
+ linux.AF_INET6: "AF_INET6",
+ linux.AF_ROSE: "AF_ROSE",
+ linux.AF_DECnet: "AF_DECnet",
+ linux.AF_NETBEUI: "AF_NETBEUI",
+ linux.AF_SECURITY: "AF_SECURITY",
+ linux.AF_KEY: "AF_KEY",
+ linux.AF_NETLINK: "AF_NETLINK",
+ linux.AF_PACKET: "AF_PACKET",
+ linux.AF_ASH: "AF_ASH",
+ linux.AF_ECONET: "AF_ECONET",
+ linux.AF_ATMSVC: "AF_ATMSVC",
+ linux.AF_RDS: "AF_RDS",
+ linux.AF_SNA: "AF_SNA",
+ linux.AF_IRDA: "AF_IRDA",
+ linux.AF_PPPOX: "AF_PPPOX",
+ linux.AF_WANPIPE: "AF_WANPIPE",
+ linux.AF_LLC: "AF_LLC",
+ linux.AF_IB: "AF_IB",
+ linux.AF_MPLS: "AF_MPLS",
+ linux.AF_CAN: "AF_CAN",
+ linux.AF_TIPC: "AF_TIPC",
+ linux.AF_BLUETOOTH: "AF_BLUETOOTH",
+ linux.AF_IUCV: "AF_IUCV",
+ linux.AF_RXRPC: "AF_RXRPC",
+ linux.AF_ISDN: "AF_ISDN",
+ linux.AF_PHONET: "AF_PHONET",
+ linux.AF_IEEE802154: "AF_IEEE802154",
+ linux.AF_CAIF: "AF_CAIF",
+ linux.AF_ALG: "AF_ALG",
+ linux.AF_NFC: "AF_NFC",
+ linux.AF_VSOCK: "AF_VSOCK",
}
// SocketType are the possible socket(2) types.
var SocketType = abi.ValueSet{
- {
- Value: linux.SOCK_STREAM,
- Name: "SOCK_STREAM",
- },
- {
- Value: linux.SOCK_DGRAM,
- Name: "SOCK_DGRAM",
- },
- {
- Value: linux.SOCK_RAW,
- Name: "SOCK_RAW",
- },
- {
- Value: linux.SOCK_RDM,
- Name: "SOCK_RDM",
- },
- {
- Value: linux.SOCK_SEQPACKET,
- Name: "SOCK_SEQPACKET",
- },
- {
- Value: linux.SOCK_DCCP,
- Name: "SOCK_DCCP",
- },
- {
- Value: linux.SOCK_PACKET,
- Name: "SOCK_PACKET",
- },
+ linux.SOCK_STREAM: "SOCK_STREAM",
+ linux.SOCK_DGRAM: "SOCK_DGRAM",
+ linux.SOCK_RAW: "SOCK_RAW",
+ linux.SOCK_RDM: "SOCK_RDM",
+ linux.SOCK_SEQPACKET: "SOCK_SEQPACKET",
+ linux.SOCK_DCCP: "SOCK_DCCP",
+ linux.SOCK_PACKET: "SOCK_PACKET",
}
// SocketFlagSet are the possible socket(2) flags.
@@ -243,106 +99,31 @@ var SocketFlagSet = abi.FlagSet{
// ipProtocol are the possible socket(2) types for INET and INET6 sockets.
var ipProtocol = abi.ValueSet{
- {
- Value: linux.IPPROTO_IP,
- Name: "IPPROTO_IP",
- },
- {
- Value: linux.IPPROTO_ICMP,
- Name: "IPPROTO_ICMP",
- },
- {
- Value: linux.IPPROTO_IGMP,
- Name: "IPPROTO_IGMP",
- },
- {
- Value: linux.IPPROTO_IPIP,
- Name: "IPPROTO_IPIP",
- },
- {
- Value: linux.IPPROTO_TCP,
- Name: "IPPROTO_TCP",
- },
- {
- Value: linux.IPPROTO_EGP,
- Name: "IPPROTO_EGP",
- },
- {
- Value: linux.IPPROTO_PUP,
- Name: "IPPROTO_PUP",
- },
- {
- Value: linux.IPPROTO_UDP,
- Name: "IPPROTO_UDP",
- },
- {
- Value: linux.IPPROTO_IDP,
- Name: "IPPROTO_IDP",
- },
- {
- Value: linux.IPPROTO_TP,
- Name: "IPPROTO_TP",
- },
- {
- Value: linux.IPPROTO_DCCP,
- Name: "IPPROTO_DCCP",
- },
- {
- Value: linux.IPPROTO_IPV6,
- Name: "IPPROTO_IPV6",
- },
- {
- Value: linux.IPPROTO_RSVP,
- Name: "IPPROTO_RSVP",
- },
- {
- Value: linux.IPPROTO_GRE,
- Name: "IPPROTO_GRE",
- },
- {
- Value: linux.IPPROTO_ESP,
- Name: "IPPROTO_ESP",
- },
- {
- Value: linux.IPPROTO_AH,
- Name: "IPPROTO_AH",
- },
- {
- Value: linux.IPPROTO_MTP,
- Name: "IPPROTO_MTP",
- },
- {
- Value: linux.IPPROTO_BEETPH,
- Name: "IPPROTO_BEETPH",
- },
- {
- Value: linux.IPPROTO_ENCAP,
- Name: "IPPROTO_ENCAP",
- },
- {
- Value: linux.IPPROTO_PIM,
- Name: "IPPROTO_PIM",
- },
- {
- Value: linux.IPPROTO_COMP,
- Name: "IPPROTO_COMP",
- },
- {
- Value: linux.IPPROTO_SCTP,
- Name: "IPPROTO_SCTP",
- },
- {
- Value: linux.IPPROTO_UDPLITE,
- Name: "IPPROTO_UDPLITE",
- },
- {
- Value: linux.IPPROTO_MPLS,
- Name: "IPPROTO_MPLS",
- },
- {
- Value: linux.IPPROTO_RAW,
- Name: "IPPROTO_RAW",
- },
+ linux.IPPROTO_IP: "IPPROTO_IP",
+ linux.IPPROTO_ICMP: "IPPROTO_ICMP",
+ linux.IPPROTO_IGMP: "IPPROTO_IGMP",
+ linux.IPPROTO_IPIP: "IPPROTO_IPIP",
+ linux.IPPROTO_TCP: "IPPROTO_TCP",
+ linux.IPPROTO_EGP: "IPPROTO_EGP",
+ linux.IPPROTO_PUP: "IPPROTO_PUP",
+ linux.IPPROTO_UDP: "IPPROTO_UDP",
+ linux.IPPROTO_IDP: "IPPROTO_IDP",
+ linux.IPPROTO_TP: "IPPROTO_TP",
+ linux.IPPROTO_DCCP: "IPPROTO_DCCP",
+ linux.IPPROTO_IPV6: "IPPROTO_IPV6",
+ linux.IPPROTO_RSVP: "IPPROTO_RSVP",
+ linux.IPPROTO_GRE: "IPPROTO_GRE",
+ linux.IPPROTO_ESP: "IPPROTO_ESP",
+ linux.IPPROTO_AH: "IPPROTO_AH",
+ linux.IPPROTO_MTP: "IPPROTO_MTP",
+ linux.IPPROTO_BEETPH: "IPPROTO_BEETPH",
+ linux.IPPROTO_ENCAP: "IPPROTO_ENCAP",
+ linux.IPPROTO_PIM: "IPPROTO_PIM",
+ linux.IPPROTO_COMP: "IPPROTO_COMP",
+ linux.IPPROTO_SCTP: "IPPROTO_SCTP",
+ linux.IPPROTO_UDPLITE: "IPPROTO_UDPLITE",
+ linux.IPPROTO_MPLS: "IPPROTO_MPLS",
+ linux.IPPROTO_RAW: "IPPROTO_RAW",
}
// SocketProtocol are the possible socket(2) protocols for each protocol family.
@@ -350,90 +131,27 @@ var SocketProtocol = map[int32]abi.ValueSet{
linux.AF_INET: ipProtocol,
linux.AF_INET6: ipProtocol,
linux.AF_NETLINK: {
- {
- Value: linux.NETLINK_ROUTE,
- Name: "NETLINK_ROUTE",
- },
- {
- Value: linux.NETLINK_UNUSED,
- Name: "NETLINK_UNUSED",
- },
- {
- Value: linux.NETLINK_USERSOCK,
- Name: "NETLINK_USERSOCK",
- },
- {
- Value: linux.NETLINK_FIREWALL,
- Name: "NETLINK_FIREWALL",
- },
- {
- Value: linux.NETLINK_SOCK_DIAG,
- Name: "NETLINK_SOCK_DIAG",
- },
- {
- Value: linux.NETLINK_NFLOG,
- Name: "NETLINK_NFLOG",
- },
- {
- Value: linux.NETLINK_XFRM,
- Name: "NETLINK_XFRM",
- },
- {
- Value: linux.NETLINK_SELINUX,
- Name: "NETLINK_SELINUX",
- },
- {
- Value: linux.NETLINK_ISCSI,
- Name: "NETLINK_ISCSI",
- },
- {
- Value: linux.NETLINK_AUDIT,
- Name: "NETLINK_AUDIT",
- },
- {
- Value: linux.NETLINK_FIB_LOOKUP,
- Name: "NETLINK_FIB_LOOKUP",
- },
- {
- Value: linux.NETLINK_CONNECTOR,
- Name: "NETLINK_CONNECTOR",
- },
- {
- Value: linux.NETLINK_NETFILTER,
- Name: "NETLINK_NETFILTER",
- },
- {
- Value: linux.NETLINK_IP6_FW,
- Name: "NETLINK_IP6_FW",
- },
- {
- Value: linux.NETLINK_DNRTMSG,
- Name: "NETLINK_DNRTMSG",
- },
- {
- Value: linux.NETLINK_KOBJECT_UEVENT,
- Name: "NETLINK_KOBJECT_UEVENT",
- },
- {
- Value: linux.NETLINK_GENERIC,
- Name: "NETLINK_GENERIC",
- },
- {
- Value: linux.NETLINK_SCSITRANSPORT,
- Name: "NETLINK_SCSITRANSPORT",
- },
- {
- Value: linux.NETLINK_ECRYPTFS,
- Name: "NETLINK_ECRYPTFS",
- },
- {
- Value: linux.NETLINK_RDMA,
- Name: "NETLINK_RDMA",
- },
- {
- Value: linux.NETLINK_CRYPTO,
- Name: "NETLINK_CRYPTO",
- },
+ linux.NETLINK_ROUTE: "NETLINK_ROUTE",
+ linux.NETLINK_UNUSED: "NETLINK_UNUSED",
+ linux.NETLINK_USERSOCK: "NETLINK_USERSOCK",
+ linux.NETLINK_FIREWALL: "NETLINK_FIREWALL",
+ linux.NETLINK_SOCK_DIAG: "NETLINK_SOCK_DIAG",
+ linux.NETLINK_NFLOG: "NETLINK_NFLOG",
+ linux.NETLINK_XFRM: "NETLINK_XFRM",
+ linux.NETLINK_SELINUX: "NETLINK_SELINUX",
+ linux.NETLINK_ISCSI: "NETLINK_ISCSI",
+ linux.NETLINK_AUDIT: "NETLINK_AUDIT",
+ linux.NETLINK_FIB_LOOKUP: "NETLINK_FIB_LOOKUP",
+ linux.NETLINK_CONNECTOR: "NETLINK_CONNECTOR",
+ linux.NETLINK_NETFILTER: "NETLINK_NETFILTER",
+ linux.NETLINK_IP6_FW: "NETLINK_IP6_FW",
+ linux.NETLINK_DNRTMSG: "NETLINK_DNRTMSG",
+ linux.NETLINK_KOBJECT_UEVENT: "NETLINK_KOBJECT_UEVENT",
+ linux.NETLINK_GENERIC: "NETLINK_GENERIC",
+ linux.NETLINK_SCSITRANSPORT: "NETLINK_SCSITRANSPORT",
+ linux.NETLINK_ECRYPTFS: "NETLINK_ECRYPTFS",
+ linux.NETLINK_RDMA: "NETLINK_RDMA",
+ linux.NETLINK_CRYPTO: "NETLINK_CRYPTO",
},
}
diff --git a/pkg/sentry/strace/strace.go b/pkg/sentry/strace/strace.go
index 4286f0df7..e40e0b57c 100644
--- a/pkg/sentry/strace/strace.go
+++ b/pkg/sentry/strace/strace.go
@@ -50,18 +50,9 @@ var EventMaximumSize uint
// ItimerTypes are the possible itimer types.
var ItimerTypes = abi.ValueSet{
- {
- Value: linux.ITIMER_REAL,
- Name: "ITIMER_REAL",
- },
- {
- Value: linux.ITIMER_VIRTUAL,
- Name: "ITIMER_VIRTUAL",
- },
- {
- Value: linux.ITIMER_PROF,
- Name: "ITIMER_PROF",
- },
+ linux.ITIMER_REAL: "ITIMER_REAL",
+ linux.ITIMER_VIRTUAL: "ITIMER_VIRTUAL",
+ linux.ITIMER_PROF: "ITIMER_PROF",
}
func iovecs(t *kernel.Task, addr usermem.Addr, iovcnt int, printContent bool, maxBytes uint64) string {